Fix PEP257 issues
This commit is contained in:
parent
7f1e181c9b
commit
cf7c2c492a
14 changed files with 460 additions and 473 deletions
|
@ -1,7 +1,5 @@
|
|||
"""
|
||||
homeassistant.components.media_player.snapcast
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Provides functionality to interact with Snapcast clients.
|
||||
Support for interacting with Snapcast clients.
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
https://home-assistant.io/components/media_player.snapcast/
|
||||
|
@ -22,7 +20,7 @@ _LOGGER = logging.getLogger(__name__)
|
|||
|
||||
# pylint: disable=unused-argument
|
||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||
""" Sets up the Snapcast platform. """
|
||||
"""Setup the Snapcast platform."""
|
||||
import snapcast.control
|
||||
host = config.get('host')
|
||||
port = config.get('port', snapcast.control.CONTROL_PORT)
|
||||
|
@ -39,44 +37,44 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||
|
||||
|
||||
class SnapcastDevice(MediaPlayerDevice):
|
||||
""" Represents a Snapcast client device. """
|
||||
"""Representation of a Snapcast client device."""
|
||||
|
||||
# pylint: disable=abstract-method
|
||||
|
||||
def __init__(self, client):
|
||||
"""Initialize the Snapcast device."""
|
||||
self._client = client
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
""" Device name. """
|
||||
"""Return the name of the device."""
|
||||
return self._client.identifier
|
||||
|
||||
@property
|
||||
def volume_level(self):
|
||||
""" Volume level. """
|
||||
"""Return the volume level."""
|
||||
return self._client.volume / 100
|
||||
|
||||
@property
|
||||
def is_volume_muted(self):
|
||||
""" Volume muted. """
|
||||
"""Volume muted."""
|
||||
return self._client.muted
|
||||
|
||||
@property
|
||||
def supported_media_commands(self):
|
||||
""" Flags of media commands that are supported. """
|
||||
"""Flag of media commands that are supported."""
|
||||
return SUPPORT_SNAPCAST
|
||||
|
||||
@property
|
||||
def state(self):
|
||||
""" State of the player. """
|
||||
"""Return the state of the player."""
|
||||
if self._client.connected:
|
||||
return STATE_ON
|
||||
return STATE_OFF
|
||||
|
||||
def mute_volume(self, mute):
|
||||
""" Mute status. """
|
||||
"""Send the mute command."""
|
||||
self._client.muted = mute
|
||||
|
||||
def set_volume_level(self, volume):
|
||||
""" Volume level. """
|
||||
"""Set the volume level."""
|
||||
self._client.volume = round(volume * 100)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue