Update/add docstrings (PEP257)
This commit is contained in:
1 parent
c64da761f1
commit
60d579af84
46 files changed
+407
-510
No files matched your search
@@ -1,7 +1,5 @@
|
||||
"""
|
||||
homeassistant.components.sensor.torque
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Get data from the Torque OBD application.
|
||||
Support for the Torque OBD application.
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
https://home-assistant.io/components/sensor.torque/
|
||||
@@ -29,25 +27,24 @@ VALUE_KEY = re.compile(SENSOR_VALUE_KEY)
|
||||
|
||||
|
||||
def decode(value):
|
||||
""" Double-decode required. """
|
||||
"""Double-decode required."""
|
||||
return value.encode('raw_unicode_escape').decode('utf-8')
|
||||
|
||||
|
||||
def convert_pid(value):
|
||||
""" Convert pid from hex string to integer. """
|
||||
"""Convert pid from hex string to integer."""
|
||||
return int(value, 16)
|
||||
|
||||
|
||||
# pylint: disable=unused-argument
|
||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||
""" Set up Torque platform. """
|
||||
|
||||
"""Set up Torque platform."""
|
||||
vehicle = config.get('name', DEFAULT_NAME)
|
||||
email = config.get('email', None)
|
||||
sensors = {}
|
||||
|
||||
def _receive_data(handler, path_match, data):
|
||||
""" Received data from Torque. """
|
||||
"""Received data from Torque."""
|
||||
handler.send_response(HTTP_OK)
|
||||
handler.end_headers()
|
||||
|
||||
@@ -84,7 +81,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||
|
||||
|
||||
class TorqueSensor(Entity):
|
||||
""" Represents a Torque sensor. """
|
||||
"""Represents a Torque sensor."""
|
||||
|
||||
def __init__(self, name, unit):
|
||||
self._name = name
|
||||
@@ -93,25 +90,25 @@ class TorqueSensor(Entity):
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
""" Returns the name of the sensor. """
|
||||
"""Returns the name of the sensor."""
|
||||
return self._name
|
||||
|
||||
@property
|
||||
def unit_of_measurement(self):
|
||||
""" Returns the unit of measurement. """
|
||||
"""Returns the unit of measurement."""
|
||||
return self._unit
|
||||
|
||||
@property
|
||||
def state(self):
|
||||
""" State of the sensor. """
|
||||
"""State of the sensor."""
|
||||
return self._state
|
||||
|
||||
@property
|
||||
def icon(self):
|
||||
""" Sensor default icon. """
|
||||
"""Sensor default icon."""
|
||||
return 'mdi:car'
|
||||
|
||||
def on_update(self, value):
|
||||
""" Receive an update. """
|
||||
"""Receive an update."""
|
||||
self._state = value
|
||||
self.update_ha_state()
|
||||
Reference in new issue
Block a user