Modify docstrings to match PEP257

This commit is contained in:
Fabian Affolter 2016-03-07 16:45:21 +01:00
parent 18f48191d9
commit 1e97d31711
6 changed files with 66 additions and 85 deletions

View file

@ -1,6 +1,4 @@
"""
homeassistant.components.alarm_control_panel.alarmdotcom
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Interfaces with Verisure alarm control panel.
For more details about this platform, please refer to the documentation at
@ -23,8 +21,7 @@ DEFAULT_NAME = 'Alarm.com'
def setup_platform(hass, config, add_devices, discovery_info=None):
""" Setup an Alarm.com control panel. """
"""Setup an Alarm.com control panel."""
username = config.get(CONF_USERNAME)
password = config.get(CONF_PASSWORD)
@ -42,8 +39,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
# pylint: disable=too-many-arguments, too-many-instance-attributes
# pylint: disable=abstract-method
class AlarmDotCom(alarm.AlarmControlPanel):
""" Represents a Alarm.com status. """
"""Represents a Alarm.com status."""
def __init__(self, hass, name, code, username, password):
from pyalarmdotcom.pyalarmdotcom import Alarmdotcom
self._alarm = Alarmdotcom(username, password, timeout=10)
@ -55,22 +51,22 @@ class AlarmDotCom(alarm.AlarmControlPanel):
@property
def should_poll(self):
""" No polling needed. """
"""No polling needed."""
return True
@property
def name(self):
""" Returns the name of the device. """
"""Returns the name of the device."""
return self._name
@property
def code_format(self):
""" One or more characters if code is defined. """
"""One or more characters if code is defined."""
return None if self._code is None else '.+'
@property
def state(self):
""" Returns the state of the device. """
"""Returns the state of the device."""
if self._alarm.state == 'Disarmed':
return STATE_ALARM_DISARMED
elif self._alarm.state == 'Armed Stay':
@ -81,7 +77,7 @@ class AlarmDotCom(alarm.AlarmControlPanel):
return STATE_UNKNOWN
def alarm_disarm(self, code=None):
""" Send disarm command. """
"""Send disarm command."""
if not self._validate_code(code, 'arming home'):
return
from pyalarmdotcom.pyalarmdotcom import Alarmdotcom
@ -90,7 +86,7 @@ class AlarmDotCom(alarm.AlarmControlPanel):
_alarm.disarm()
def alarm_arm_home(self, code=None):
""" Send arm home command. """
"""Send arm home command."""
if not self._validate_code(code, 'arming home'):
return
from pyalarmdotcom.pyalarmdotcom import Alarmdotcom
@ -99,7 +95,7 @@ class AlarmDotCom(alarm.AlarmControlPanel):
_alarm.arm_stay()
def alarm_arm_away(self, code=None):
""" Send arm away command. """
"""Send arm away command."""
if not self._validate_code(code, 'arming home'):
return
from pyalarmdotcom.pyalarmdotcom import Alarmdotcom
@ -108,7 +104,7 @@ class AlarmDotCom(alarm.AlarmControlPanel):
_alarm.arm_away()
def _validate_code(self, code, state):
""" Validate given code. """
"""Validate given code."""
check = self._code is None or code == self._code
if not check:
_LOGGER.warning('Wrong code entered for %s', state)