Update/add docstrings (PEP257)

This commit is contained in:
Fabian Affolter 2016-02-23 06:21:49 +01:00
parent c64da761f1
commit 60d579af84
46 changed files with 407 additions and 510 deletions

View file

@ -1,6 +1,4 @@
"""
homeassistant.components.sensor.command_sensor
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Allows to configure custom shell commands to turn a value for a sensor.
For more details about this platform, please refer to the documentation at
@ -24,7 +22,7 @@ MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=60)
# pylint: disable=unused-argument
def setup_platform(hass, config, add_devices_callback, discovery_info=None):
""" Add the Command Sensor. """
"""Add the Command Sensor."""
if config.get('command') is None:
_LOGGER.error('Missing required variable: "command"')
@ -43,7 +41,7 @@ def setup_platform(hass, config, add_devices_callback, discovery_info=None):
# pylint: disable=too-many-arguments
class CommandSensor(Entity):
""" Represents a sensor that is returning a value of a shell commands. """
"""Represents a sensor that is returning a value of a shell commands."""
def __init__(self, hass, data, name, unit_of_measurement, value_template):
self._hass = hass
self.data = data
@ -55,21 +53,21 @@ class CommandSensor(Entity):
@property
def name(self):
""" The name of the sensor. """
"""The name of the sensor."""
return self._name
@property
def unit_of_measurement(self):
""" Unit the value is expressed in. """
"""Unit the value is expressed in."""
return self._unit_of_measurement
@property
def state(self):
""" Returns the state of the device. """
"""Returns the state of the device."""
return self._state
def update(self):
""" Gets the latest data and updates the state. """
"""Gets the latest data and updates the state."""
self.data.update()
value = self.data.value
@ -82,7 +80,7 @@ class CommandSensor(Entity):
# pylint: disable=too-few-public-methods
class CommandSensorData(object):
""" Class for handling the data retrieval. """
"""Class for handling the data retrieval."""
def __init__(self, command):
self.command = command
@ -90,7 +88,7 @@ class CommandSensorData(object):
@Throttle(MIN_TIME_BETWEEN_UPDATES)
def update(self):
""" Gets the latest data with a shell command. """
"""Gets the latest data with a shell command."""
_LOGGER.info('Running command: %s', self.command)
try: