Update docstrings to match PEP257

This commit is contained in:
Fabian Affolter 2016-03-07 18:49:31 +01:00
parent 7ff9aecd4e
commit b8a40457ee
40 changed files with 371 additions and 483 deletions

View file

@ -1,6 +1,4 @@
"""
homeassistant.components.input_select
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Component to offer a way to select an option from a list.
For more details about this component, please refer to the documentation
@ -29,7 +27,7 @@ SERVICE_SELECT_OPTION = 'select_option'
def select_option(hass, entity_id, option):
""" Set input_select to False. """
"""Set input_select to False."""
hass.services.call(DOMAIN, SERVICE_SELECT_OPTION, {
ATTR_ENTITY_ID: entity_id,
ATTR_OPTION: option,
@ -37,7 +35,7 @@ def select_option(hass, entity_id, option):
def setup(hass, config):
""" Set up input select. """
"""Setup input select."""
if not isinstance(config.get(DOMAIN), dict):
_LOGGER.error('Expected %s config to be a dictionary', DOMAIN)
return False
@ -77,7 +75,7 @@ def setup(hass, config):
return False
def select_option_service(call):
""" Handle a calls to the input select services. """
"""Handle a calls to the input select services."""
target_inputs = component.extract_from_service(call)
for input_select in target_inputs:
@ -92,8 +90,7 @@ def setup(hass, config):
class InputSelect(Entity):
""" Represent a select input. """
"""Represent a select input."""
# pylint: disable=too-many-arguments
def __init__(self, object_id, name, state, options, icon):
""" Initialize a select input. """
@ -105,33 +102,33 @@ class InputSelect(Entity):
@property
def should_poll(self):
""" If entity should be polled. """
"""If entity should be polled."""
return False
@property
def name(self):
""" Name of the select input. """
"""Return the name of the select input."""
return self._name
@property
def icon(self):
""" Icon to be used for this entity. """
"""Return the icon to be used for this entity."""
return self._icon
@property
def state(self):
""" State of the component. """
"""Return the state of the component."""
return self._current_option
@property
def state_attributes(self):
""" State attributes. """
"""Return the state attributes."""
return {
ATTR_OPTIONS: self._options,
}
def select_option(self, option):
""" Select new option. """
"""Select new option."""
if option not in self._options:
_LOGGER.warning('Invalid option: %s (possible options: %s)',
option, ', '.join(self._options))