Showing 22 of 52 total issues
File api.py
has 963 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""Low level api to communicate with samsung multiroom speaker."""
import inspect
import logging
import urllib.parse
SamsungMultiroomApi
has 68 functions (exceeds 20 allowed). Consider refactoring. Open
class SamsungMultiroomApi:
"""
Samsung Multiroom Api implementation.
Contains non-inclusive list of API calls you can make to control the speaker.
Function open
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def open(self, uri):
"""
Generator consuming events from speaker's main info stream.
Yields ApiResponse instance.
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
SpeakerGroup
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
class SpeakerGroup(SpeakerBase):
"""
Speaker group.
Use Speaker.group() to initiate grouping.
Speaker
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
class Speaker(SpeakerBase):
"""Entry control for speaker operation."""
def __init__(self, api, event_loop, clock, equalizer, player_operator, service_registry):
"""
SpeakerBase
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class SpeakerBase(metaclass=abc.ABCMeta):
"""Speaker interface to control speaker operation."""
@property
def ip_address(self):
Function _factory_item
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def _factory_item(self, data):
kwargs = {'metadata': {}}
# mandatory
if 'dmsid' in data:
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _factory_item
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def _factory_item(self, data):
kwargs = {'metadata': {}}
# mandatory
if '@id' in data:
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function set
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def set(self, time=None, weekdays=None, duration=None, volume=None, station_data=None, playlist=None, enabled=None):
"""
Update speaker's configuration for this slot.
:param time: hour/minute when to trigger the alarm in HH:MM format
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function set
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def set(self, *args):
"""
Set equalizer values by preset name or list of band values
:param: Name of the preset to set or list of 7 band values to set
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function get_current_track
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def get_current_track(self):
"""
Get current track info.
:returns: Track instance, or None if unavailable
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function format_param
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def format_param(param):
"""
Format request parameter.
:param param: Tuple e.g. ('list_count', 30, 'dec')
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function set
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def set(self, time=None, weekdays=None, duration=None, volume=None, station_data=None, playlist=None, enabled=None):
Function __init__
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, title, artist, album, duration, position, thumbnail_url, metadata=None):
Function set_alarm_info
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def set_alarm_info(self, index, hour, minute, week, duration, volume, station_data):
Function get_current_track
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_current_track(self):
"""
Get current track info.
:returns: Track instance, or None if unavailable
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function paginator
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def paginator(*args):
"""
Generator to paginate over api call.
Api method must accept start_index and list_count parameters.
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, api, event_loop, clock, equalizer, player_operator, service_registry):
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, api, app_id, app_name, path=None, items=None):
Function set_playlist_playback_control
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def set_playlist_playback_control(self, items):
"""
Create a playlist and playback.
Use pc_get_music_list_by_id() to fetch item information required for playlist item.
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"