Fix PEP257 issues

This commit is contained in:
Fabian Affolter committed 2016-03-08 13:35:39 +01:00
1 parent 652f059d6a
commit 49ebc6d0b0
29 files changed
+294 -309

No files matched your search

+21 -20
View File
@@ -1,6 +1,4 @@
"""
homeassistant.components.switch.scsgate
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Support for SCSGate switches.
For more details about this platform, please refer to the documentation at
@@ -16,8 +14,7 @@ DEPENDENCIES = ['scsgate']
def setup_platform(hass, config, add_devices_callback, discovery_info=None):
""" Add the SCSGate swiches defined inside of the configuration file. """
"""Setup the SCSGate switches."""
logger = logging.getLogger(__name__)
_setup_traditional_switches(
@@ -32,7 +29,7 @@ def setup_platform(hass, config, add_devices_callback, discovery_info=None):
def _setup_traditional_switches(logger, config, add_devices_callback):
""" Add traditional SCSGate switches """
"""Add traditional SCSGate switches."""
traditional = config.get('traditional')
switches = []
@@ -58,7 +55,7 @@ def _setup_traditional_switches(logger, config, add_devices_callback):
def _setup_scenario_switches(logger, config, hass):
""" Add only SCSGate scenario switches """
"""Add only SCSGate scenario switches."""
scenario = config.get("scenario")
if scenario:
@@ -81,8 +78,10 @@ def _setup_scenario_switches(logger, config, hass):
class SCSGateSwitch(SwitchDevice):
""" Provides a SCSGate switch. """
"""Representation of a SCSGate switch."""
def __init__(self, scs_id, name, logger):
"""Initialize the switch."""
self._name = name
self._scs_id = scs_id
self._toggled = False
@@ -90,26 +89,26 @@ class SCSGateSwitch(SwitchDevice):
@property
def scs_id(self):
""" SCS ID """
"""Return the SCS ID."""
return self._scs_id
@property
def should_poll(self):
""" No polling needed for a SCSGate switch. """
"""No polling needed."""
return False
@property
def name(self):
""" Returns the name of the device if any. """
"""Return the name of the device if any."""
return self._name
@property
def is_on(self):
""" True if switch is on. """
"""Return true if switch is on."""
return self._toggled
def turn_on(self, **kwargs):
""" Turn the device on. """
"""Turn the device on."""
from scsgate.tasks import ToggleStatusTask
scsgate.SCSGATE.append_task(
@@ -121,7 +120,7 @@ class SCSGateSwitch(SwitchDevice):
self.update_ha_state()
def turn_off(self, **kwargs):
""" Turn the device off. """
"""Turn the device off."""
from scsgate.tasks import ToggleStatusTask
scsgate.SCSGATE.append_task(
@@ -133,7 +132,7 @@ class SCSGateSwitch(SwitchDevice):
self.update_ha_state()
def process_event(self, message):
""" Handle a SCSGate message related with this switch"""
"""Handle a SCSGate message related with this switch."""
if self._toggled == message.toggled:
self._logger.info(
"Switch %s, ignoring message %s because state already active",
@@ -157,12 +156,14 @@ class SCSGateSwitch(SwitchDevice):
class SCSGateScenarioSwitch:
""" Provides a SCSGate scenario switch.
"""Provides a SCSGate scenario switch.
This switch is always in a 'off" state, when toggled
it's used to trigger events
This switch is always in a 'off" state, when toggled it's used to trigger
events.
"""
def __init__(self, scs_id, name, logger, hass):
"""Initialize the scenario."""
self._name = name
self._scs_id = scs_id
self._logger = logger
@@ -170,16 +171,16 @@ class SCSGateScenarioSwitch:
@property
def scs_id(self):
""" SCS ID """
"""Return the SCS ID."""
return self._scs_id
@property
def name(self):
""" Returns the name of the device if any. """
"""Return the name of the device if any."""
return self._name
def process_event(self, message):
""" Handle a SCSGate message related with this switch"""
"""Handle a SCSGate message related with this switch."""
from scsgate.messages import StateMessage, ScenarioTriggeredMessage
if isinstance(message, StateMessage):