mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Fix PEP257 issues
This commit is contained in:
parent
f6bc1a4575
commit
ac43d23bd7
@ -33,13 +33,13 @@ _LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def is_closed(hass, entity_id=None):
|
||||
"""Returns if the garage door is closed based on the statemachine."""
|
||||
"""Return if the garage door is closed based on the statemachine."""
|
||||
entity_id = entity_id or ENTITY_ID_ALL_GARAGE_DOORS
|
||||
return hass.states.is_state(entity_id, STATE_CLOSED)
|
||||
|
||||
|
||||
def close_door(hass, entity_id=None):
|
||||
"""Closes all or specified garage door."""
|
||||
"""Close all or a specified garage door."""
|
||||
data = {ATTR_ENTITY_ID: entity_id} if entity_id else None
|
||||
hass.services.call(DOMAIN, SERVICE_CLOSE, data)
|
||||
|
||||
@ -58,7 +58,7 @@ def setup(hass, config):
|
||||
component.setup(config)
|
||||
|
||||
def handle_garage_door_service(service):
|
||||
"""Handles calls to the garage door services."""
|
||||
"""Handle calls to the garage door services."""
|
||||
target_locks = component.extract_from_service(service)
|
||||
|
||||
for item in target_locks:
|
||||
@ -81,7 +81,8 @@ def setup(hass, config):
|
||||
|
||||
|
||||
class GarageDoorDevice(Entity):
|
||||
"""Represents a garage door."""
|
||||
"""Representation of a garage door."""
|
||||
|
||||
# pylint: disable=no-self-use
|
||||
@property
|
||||
def is_closed(self):
|
||||
@ -98,7 +99,7 @@ class GarageDoorDevice(Entity):
|
||||
|
||||
@property
|
||||
def state(self):
|
||||
"""Returns the state of the garage door."""
|
||||
"""Return the state of the garage door."""
|
||||
closed = self.is_closed
|
||||
if closed is None:
|
||||
return STATE_UNKNOWN
|
||||
|
@ -19,7 +19,9 @@ def setup_platform(hass, config, add_devices_callback, discovery_info=None):
|
||||
|
||||
class DemoGarageDoor(GarageDoorDevice):
|
||||
"""Provides a demo garage door."""
|
||||
|
||||
def __init__(self, name, state):
|
||||
"""Initialize the garage door."""
|
||||
self._name = name
|
||||
self._state = state
|
||||
|
||||
|
@ -13,7 +13,7 @@ REQUIREMENTS = ['python-wink==0.6.2']
|
||||
|
||||
|
||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||
"""Sets up the Wink garage door platform."""
|
||||
"""Setup the Wink garage door platform."""
|
||||
import pywink
|
||||
|
||||
if discovery_info is None:
|
||||
@ -32,19 +32,20 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||
|
||||
|
||||
class WinkGarageDoorDevice(GarageDoorDevice):
|
||||
"""Represents a Wink garage door."""
|
||||
"""Representation of a Wink garage door."""
|
||||
|
||||
def __init__(self, wink):
|
||||
"""Initialize the garage door."""
|
||||
self.wink = wink
|
||||
|
||||
@property
|
||||
def unique_id(self):
|
||||
"""Returns the id of this wink garage door."""
|
||||
"""Return the ID of this wink garage door."""
|
||||
return "{}.{}".format(self.__class__, self.wink.device_id())
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
"""Returns the name of the garage door if any."""
|
||||
"""Return the name of the garage door if any."""
|
||||
return self.wink.name()
|
||||
|
||||
def update(self):
|
||||
@ -53,11 +54,11 @@ class WinkGarageDoorDevice(GarageDoorDevice):
|
||||
|
||||
@property
|
||||
def is_closed(self):
|
||||
"""Returns true if door is closed."""
|
||||
"""Return true if door is closed."""
|
||||
return self.wink.state() == 0
|
||||
|
||||
def close_door(self):
|
||||
"""Closes the door."""
|
||||
"""Close the door."""
|
||||
self.wink.set_state(0)
|
||||
|
||||
def open_door(self):
|
||||
|
Loading…
x
Reference in New Issue
Block a user