Update docstrings (#7361)

* Update docstrings

* Update docstrings

* Update docstrings

* Update docstrings

* update docstrings

* Update docstrings

* Update docstrings

* Update docstrings

* Update docstrings

* Update docstrings

* Update tomato.py

* Update isy994.py

* Lint + fix tests

* Lint
This commit is contained in:
Fabian Affolter authored and Paulus Schoutsen committed 2017-04-29 22:04:49 -07:00
1 parent e22e70a01a
commit 3ee4d1060f
264 files changed
+1686 -1768

No files matched your search

+12 -12
View File
@@ -9,9 +9,9 @@ import logging
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.const import (
ATTR_ENTITY_ID, ATTR_UNIT_OF_MEASUREMENT, CONF_ICON, CONF_NAME)
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import Entity
from homeassistant.helpers.entity_component import EntityComponent
from homeassistant.helpers.restore_state import async_get_last_state
@@ -39,7 +39,7 @@ SERVICE_SELECT_VALUE_SCHEMA = vol.Schema({
def _cv_input_slider(cfg):
"""Config validation helper for input slider (Voluptuous)."""
"""Configuration validation helper for input slider (voluptuous)."""
minimum = cfg.get(CONF_MIN)
maximum = cfg.get(CONF_MAX)
if minimum >= maximum:
@@ -78,7 +78,7 @@ def select_value(hass, entity_id, value):
@asyncio.coroutine
def async_setup(hass, config):
"""Set up input slider."""
"""Set up an input slider."""
component = EntityComponent(_LOGGER, DOMAIN, hass)
entities = []
@@ -92,8 +92,8 @@ def async_setup(hass, config):
icon = cfg.get(CONF_ICON)
unit = cfg.get(ATTR_UNIT_OF_MEASUREMENT)
entities.append(InputSlider(object_id, name, initial, minimum, maximum,
step, icon, unit))
entities.append(InputSlider(
object_id, name, initial, minimum, maximum, step, icon, unit))
if not entities:
return False
@@ -138,27 +138,27 @@ class InputSlider(Entity):
@property
def name(self):
"""Name of the select input."""
"""Return the name of the select input slider."""
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_value
@property
def unit_of_measurement(self):
"""Unit of measurement of slider."""
"""Return the unit the value is expressed in."""
return self._unit
@property
def state_attributes(self):
"""State attributes."""
"""Return the state attributes."""
return {
ATTR_MIN: self._minimum,
ATTR_MAX: self._maximum,
@@ -167,7 +167,7 @@ class InputSlider(Entity):
@asyncio.coroutine
def async_added_to_hass(self):
"""Called when entity about to be added to hass."""
"""Run when entity about to be added to hass."""
if self._current_value is not None:
return
@@ -185,7 +185,7 @@ class InputSlider(Entity):
"""Select new value."""
num_value = float(value)
if num_value < self._minimum or num_value > self._maximum:
_LOGGER.warning('Invalid value: %s (range %s - %s)',
_LOGGER.warning("Invalid value: %s (range %s - %s)",
num_value, self._minimum, self._maximum)
return
self._current_value = num_value