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.manual
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Support for manual alarms.
For more details about this platform, please refer to the documentation at
@ -24,8 +22,7 @@ DEFAULT_TRIGGER_TIME = 120
def setup_platform(hass, config, add_devices, discovery_info=None):
""" Sets up the manual alarm platform. """
"""Sets up the manual alarm platform."""
add_devices([ManualAlarm(
hass,
config.get('name', DEFAULT_ALARM_NAME),
@ -45,7 +42,6 @@ class ManualAlarm(alarm.AlarmControlPanel):
When triggered, will be pending for 'trigger_time'. After that will be
triggered for 'trigger_time', after that we return to disarmed.
"""
def __init__(self, hass, name, code, pending_time, trigger_time):
self._state = STATE_ALARM_DISARMED
self._hass = hass
@ -57,17 +53,17 @@ class ManualAlarm(alarm.AlarmControlPanel):
@property
def should_poll(self):
""" No polling needed. """
"""No polling needed."""
return False
@property
def name(self):
""" Returns the name of the device. """
"""Returns the name of the device."""
return self._name
@property
def state(self):
""" Returns the state of the device. """
"""Returns the state of the device."""
if self._state in (STATE_ALARM_ARMED_HOME,
STATE_ALARM_ARMED_AWAY) and \
self._pending_time and self._state_ts + self._pending_time > \
@ -85,11 +81,11 @@ class ManualAlarm(alarm.AlarmControlPanel):
@property
def code_format(self):
""" One or more characters. """
"""One or more characters."""
return None if self._code is None else '.+'
def alarm_disarm(self, code=None):
""" Send disarm command. """
"""Send disarm command."""
if not self._validate_code(code, STATE_ALARM_DISARMED):
return
@ -98,7 +94,7 @@ class ManualAlarm(alarm.AlarmControlPanel):
self.update_ha_state()
def alarm_arm_home(self, code=None):
""" Send arm home command. """
"""Send arm home command."""
if not self._validate_code(code, STATE_ALARM_ARMED_HOME):
return
@ -112,7 +108,7 @@ class ManualAlarm(alarm.AlarmControlPanel):
self._state_ts + self._pending_time)
def alarm_arm_away(self, code=None):
""" Send arm away command. """
"""Send arm away command."""
if not self._validate_code(code, STATE_ALARM_ARMED_AWAY):
return
@ -126,7 +122,7 @@ class ManualAlarm(alarm.AlarmControlPanel):
self._state_ts + self._pending_time)
def alarm_trigger(self, code=None):
""" Send alarm trigger command. No code needed. """
"""Send alarm trigger command. No code needed."""
self._state = STATE_ALARM_TRIGGERED
self._state_ts = dt_util.utcnow()
self.update_ha_state()
@ -141,7 +137,7 @@ class ManualAlarm(alarm.AlarmControlPanel):
self._state_ts + self._pending_time + self._trigger_time)
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('Invalid code given for %s', state)