mirror of
https://github.com/home-assistant/core.git
synced 2025-07-13 08:17:08 +00:00
Modify docstrings to match PEP257
This commit is contained in:
parent
49982ac83c
commit
9c4fe6e7fe
@ -1,6 +1,4 @@
|
|||||||
"""
|
"""
|
||||||
homeassistant.components.lock
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
Component to interface with various locks that can be controlled remotely.
|
Component to interface with various locks that can be controlled remotely.
|
||||||
|
|
||||||
For more details about this component, please refer to the documentation
|
For more details about this component, please refer to the documentation
|
||||||
@ -106,12 +104,11 @@ def setup(hass, config):
|
|||||||
|
|
||||||
|
|
||||||
class LockDevice(Entity):
|
class LockDevice(Entity):
|
||||||
""" Represents a lock within Home Assistant. """
|
"""Represents a lock."""
|
||||||
# pylint: disable=no-self-use
|
# pylint: disable=no-self-use
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def code_format(self):
|
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
|
return None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -139,6 +136,7 @@ class LockDevice(Entity):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def state(self):
|
def state(self):
|
||||||
|
"""Return the state."""
|
||||||
locked = self.is_locked
|
locked = self.is_locked
|
||||||
if locked is None:
|
if locked is None:
|
||||||
return STATE_UNKNOWN
|
return STATE_UNKNOWN
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
"""
|
"""
|
||||||
homeassistant.components.lock.verisure
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
Interfaces with Verisure locks.
|
Interfaces with Verisure locks.
|
||||||
|
|
||||||
For more details about this platform, please refer to the documentation at
|
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):
|
def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
"""Sets up the Verisure platform."""
|
"""Sets up the Verisure platform."""
|
||||||
|
|
||||||
locks = []
|
locks = []
|
||||||
if int(hub.config.get('locks', '1')):
|
if int(hub.config.get('locks', '1')):
|
||||||
hub.update_locks()
|
hub.update_locks()
|
||||||
@ -31,8 +28,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
|
|
||||||
# pylint: disable=abstract-method
|
# pylint: disable=abstract-method
|
||||||
class VerisureDoorlock(LockDevice):
|
class VerisureDoorlock(LockDevice):
|
||||||
""" Represents a Verisure doorlock status. """
|
"""Represents a Verisure doorlock."""
|
||||||
|
|
||||||
def __init__(self, device_id):
|
def __init__(self, device_id):
|
||||||
self._id = device_id
|
self._id = device_id
|
||||||
self._state = STATE_UNKNOWN
|
self._state = STATE_UNKNOWN
|
||||||
@ -40,12 +36,12 @@ class VerisureDoorlock(LockDevice):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def name(self):
|
def name(self):
|
||||||
""" Returns the name of the device. """
|
"""Returns the name of the lock."""
|
||||||
return 'Lock {}'.format(self._id)
|
return 'Lock {}'.format(self._id)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def state(self):
|
def state(self):
|
||||||
""" Returns the state of the device. """
|
"""Returns the state of the lock."""
|
||||||
return self._state
|
return self._state
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -54,7 +50,7 @@ class VerisureDoorlock(LockDevice):
|
|||||||
return '^\\d{%s}$' % self._digits
|
return '^\\d{%s}$' % self._digits
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
""" Update lock status """
|
"""Update lock status."""
|
||||||
hub.update_locks()
|
hub.update_locks()
|
||||||
|
|
||||||
if hub.lock_status[self._id].status == 'unlocked':
|
if hub.lock_status[self._id].status == 'unlocked':
|
||||||
@ -68,7 +64,7 @@ class VerisureDoorlock(LockDevice):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def is_locked(self):
|
def is_locked(self):
|
||||||
""" True if device is locked. """
|
"""Return true if lock is locked."""
|
||||||
return hub.lock_status[self._id].status
|
return hub.lock_status[self._id].status
|
||||||
|
|
||||||
def unlock(self, **kwargs):
|
def unlock(self, **kwargs):
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
"""
|
"""
|
||||||
homeassistant.components.lock.wink
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
Support for Wink locks.
|
Support for Wink locks.
|
||||||
|
|
||||||
For more details about this platform, please refer to the documentation at
|
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):
|
def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
""" Sets up the Wink platform. """
|
"""Setup the Wink platform."""
|
||||||
import pywink
|
import pywink
|
||||||
|
|
||||||
if discovery_info is None:
|
if discovery_info is None:
|
||||||
@ -34,18 +32,17 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
|
|
||||||
class WinkLockDevice(LockDevice):
|
class WinkLockDevice(LockDevice):
|
||||||
"""Represents a Wink lock."""
|
"""Represents a Wink lock."""
|
||||||
|
|
||||||
def __init__(self, wink):
|
def __init__(self, wink):
|
||||||
self.wink = wink
|
self.wink = wink
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def unique_id(self):
|
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())
|
return "{}.{}".format(self.__class__, self.wink.device_id())
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def name(self):
|
def name(self):
|
||||||
""" Returns the name of the lock if any. """
|
"""Return the name of the lock if any."""
|
||||||
return self.wink.name()
|
return self.wink.name()
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
@ -54,7 +51,7 @@ class WinkLockDevice(LockDevice):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def is_locked(self):
|
def is_locked(self):
|
||||||
""" True if device is locked. """
|
"""Return true if device is locked."""
|
||||||
return self.wink.state()
|
return self.wink.state()
|
||||||
|
|
||||||
def lock(self, **kwargs):
|
def lock(self, **kwargs):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user