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,7 +1,8 @@
"""
homeassistant.components.alarm_control_panel
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Component to interface with a alarm control panel.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/alarm_control_panel/
"""
import logging
import os
@ -120,11 +121,10 @@ def alarm_trigger(hass, code=None, entity_id=None):
# pylint: disable=no-self-use
class AlarmControlPanel(Entity):
""" ABC for alarm control devices. """
"""An ABC for alarm control devices."""
@property
def code_format(self):
""" regex for code format or None if no code is required. """
"""Regex for code format or None if no code is required."""
return None
def alarm_disarm(self, code=None):

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
@ -24,7 +22,6 @@ DEFAULT_NAME = 'Alarm.com'
def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup an Alarm.com control panel."""
username = config.get(CONF_USERNAME)
password = config.get(CONF_PASSWORD)
@ -43,7 +40,6 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
# pylint: disable=abstract-method
class AlarmDotCom(alarm.AlarmControlPanel):
"""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)

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
@ -25,7 +23,6 @@ DEFAULT_TRIGGER_TIME = 120
def setup_platform(hass, config, add_devices, discovery_info=None):
"""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

View File

@ -1,6 +1,4 @@
"""
homeassistant.components.alarm_control_panel.mqtt
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This platform enables the possibility to control a MQTT alarm.
For more details about this platform, please refer to the documentation at
@ -27,7 +25,6 @@ DEPENDENCIES = ['mqtt']
def setup_platform(hass, config, add_devices, discovery_info=None):
"""Sets up the MQTT platform."""
if config.get('state_topic') is None:
_LOGGER.error("Missing required variable: state_topic")
return False
@ -51,8 +48,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 MqttAlarm(alarm.AlarmControlPanel):
""" represents a MQTT alarm status within home assistant. """
"""Represents a MQTT alarm status."""
def __init__(self, hass, name, state_topic, command_topic, qos,
payload_disarm, payload_arm_home, payload_arm_away, code):
self._state = STATE_UNKNOWN
@ -80,7 +76,7 @@ class MqttAlarm(alarm.AlarmControlPanel):
@property
def should_poll(self):
""" No polling needed """
"""No polling needed."""
return False
@property
@ -95,7 +91,7 @@ class MqttAlarm(alarm.AlarmControlPanel):
@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 '.+'
def alarm_disarm(self, code=None):

View File

@ -1,6 +1,4 @@
"""
homeassistant.components.alarm_control_panel.nx584
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Support for NX584 alarm control panels.
For more details about this platform, please refer to the documentation at
@ -16,12 +14,11 @@ from homeassistant.const import (
STATE_UNKNOWN)
REQUIREMENTS = ['pynx584==0.2']
_LOGGER = logging.getLogger(__name__)
def setup_platform(hass, config, add_devices, discovery_info=None):
""" Setup nx584. """
"""Setup nx584 platform."""
host = config.get('host', 'localhost:5007')
try:
@ -32,7 +29,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
class NX584Alarm(alarm.AlarmControlPanel):
""" NX584-based alarm panel. """
"""Represents the NX584-based alarm panel. """
def __init__(self, hass, host, name):
from nx584 import client
self._hass = hass

View File

@ -1,10 +1,8 @@
"""
homeassistant.components.alarm_control_panel.verisure
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Interfaces with Verisure alarm control panel.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/verisure/
https://home-assistant.io/components/alarm_control_panel.verisure/
"""
import logging
@ -19,8 +17,7 @@ _LOGGER = logging.getLogger(__name__)
def setup_platform(hass, config, add_devices, discovery_info=None):
""" Sets up the Verisure platform. """
"""Setup the Verisure platform."""
alarms = []
if int(hub.config.get('alarm', '1')):
hub.update_alarms()
@ -34,7 +31,6 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
# pylint: disable=abstract-method
class VerisureAlarm(alarm.AlarmControlPanel):
"""Represents a Verisure alarm status."""
def __init__(self, device_id):
self._id = device_id
self._state = STATE_UNKNOWN
@ -52,11 +48,11 @@ class VerisureAlarm(alarm.AlarmControlPanel):
@property
def code_format(self):
""" code format as regex """
"""Code format as regex."""
return '^\\d{%s}$' % self._digits
def update(self):
""" Update alarm status """
"""Update alarm status."""
hub.update_alarms()
if hub.alarm_status[self._id].status == 'unarmed':