Modify docstrings to match PEP257

This commit is contained in:
Fabian Affolter 2016-02-28 12:03:47 +01:00
parent 49982ac83c
commit 9c4fe6e7fe
3 changed files with 29 additions and 38 deletions

View File

@ -1,6 +1,4 @@
"""
homeassistant.components.lock
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Component to interface with various locks that can be controlled remotely.
For more details about this component, please refer to the documentation
@ -106,12 +104,11 @@ def setup(hass, config):
class LockDevice(Entity):
""" Represents a lock within Home Assistant. """
"""Represents a lock."""
# pylint: disable=no-self-use
@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
@property
@ -139,6 +136,7 @@ class LockDevice(Entity):
@property
def state(self):
"""Return the state."""
locked = self.is_locked
if locked is None:
return STATE_UNKNOWN

View File

@ -1,6 +1,4 @@
"""
homeassistant.components.lock.verisure
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Interfaces with Verisure locks.
For more details about this platform, please refer to the documentation at
@ -18,7 +16,6 @@ ATTR_CODE = 'code'
def setup_platform(hass, config, add_devices, discovery_info=None):
"""Sets up the Verisure platform."""
locks = []
if int(hub.config.get('locks', '1')):
hub.update_locks()
@ -31,8 +28,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
# pylint: disable=abstract-method
class VerisureDoorlock(LockDevice):
""" Represents a Verisure doorlock status. """
"""Represents a Verisure doorlock."""
def __init__(self, device_id):
self._id = device_id
self._state = STATE_UNKNOWN
@ -40,12 +36,12 @@ class VerisureDoorlock(LockDevice):
@property
def name(self):
""" Returns the name of the device. """
"""Returns the name of the lock."""
return 'Lock {}'.format(self._id)
@property
def state(self):
""" Returns the state of the device. """
"""Returns the state of the lock."""
return self._state
@property
@ -54,7 +50,7 @@ class VerisureDoorlock(LockDevice):
return '^\\d{%s}$' % self._digits
def update(self):
""" Update lock status """
"""Update lock status."""
hub.update_locks()
if hub.lock_status[self._id].status == 'unlocked':
@ -68,7 +64,7 @@ class VerisureDoorlock(LockDevice):
@property
def is_locked(self):
""" True if device is locked. """
"""Return true if lock is locked."""
return hub.lock_status[self._id].status
def unlock(self, **kwargs):

View File

@ -1,6 +1,4 @@
"""
homeassistant.components.lock.wink
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Support for Wink locks.
For more details about this platform, please refer to the documentation at
@ -15,7 +13,7 @@ REQUIREMENTS = ['python-wink==0.6.2']
def setup_platform(hass, config, add_devices, discovery_info=None):
""" Sets up the Wink platform. """
"""Setup the Wink platform."""
import pywink
if discovery_info is None:
@ -34,18 +32,17 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
class WinkLockDevice(LockDevice):
"""Represents a Wink lock."""
def __init__(self, wink):
self.wink = wink
@property
def unique_id(self):
""" Returns the id of this wink lock """
"""Return the id of this wink lock."""
return "{}.{}".format(self.__class__, self.wink.device_id())
@property
def name(self):
""" Returns the name of the lock if any. """
"""Return the name of the lock if any."""
return self.wink.name()
def update(self):
@ -54,7 +51,7 @@ class WinkLockDevice(LockDevice):
@property
def is_locked(self):
""" True if device is locked. """
"""Return true if device is locked."""
return self.wink.state()
def lock(self, **kwargs):