Update docstrings (#7374)
* Update docstrings * Update docstrings * Update docstrings * Update docstrings * Update docstrings * Update docstrings * Update docstring * Update docstrings * Update docstrings * Fix lint issues * Update docstrings * Revert changes in dict
This commit is contained in:
1 parent
0e08925259
commit
a4f1f6e724
340 files changed
+1533
-1708
No files matched your search
@@ -135,7 +135,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
||||
|
||||
|
||||
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
"""Setup the NUT sensors."""
|
||||
"""Set up the NUT sensors."""
|
||||
name = config.get(CONF_NAME)
|
||||
host = config.get(CONF_HOST)
|
||||
port = config.get(CONF_PORT)
|
||||
@@ -146,7 +146,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
data = PyNUTData(host, port, alias, username, password)
|
||||
|
||||
if data.status is None:
|
||||
_LOGGER.error("NUT Sensor has no data, unable to setup.")
|
||||
_LOGGER.error("NUT Sensor has no data, unable to setup")
|
||||
return False
|
||||
|
||||
_LOGGER.debug('NUT Sensors Available: %s', data.status)
|
||||
@@ -160,14 +160,14 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
entities.append(NUTSensor(name, data, sensor_type))
|
||||
else:
|
||||
_LOGGER.warning(
|
||||
'Sensor type: "%s" does not appear in the NUT status '
|
||||
'output, cannot add.', sensor_type)
|
||||
"Sensor type: %s does not appear in the NUT status "
|
||||
"output, cannot add", sensor_type)
|
||||
|
||||
try:
|
||||
data.update(no_throttle=True)
|
||||
except data.pynuterror as err:
|
||||
_LOGGER.error("Failure while testing NUT status retrieval. "
|
||||
"Cannot continue setup., %s", err)
|
||||
"Cannot continue setup: %s", err)
|
||||
return False
|
||||
|
||||
add_entities(entities)
|
||||
@@ -180,7 +180,7 @@ class NUTSensor(Entity):
|
||||
"""Initialize the sensor."""
|
||||
self._data = data
|
||||
self.type = sensor_type
|
||||
self._name = name + ' ' + SENSOR_TYPES[sensor_type][0]
|
||||
self._name = "{} {}".format(name, SENSOR_TYPES[sensor_type][0])
|
||||
self._unit = SENSOR_TYPES[sensor_type][1]
|
||||
self.update()
|
||||
|
||||
@@ -281,8 +281,8 @@ class PyNUTData(object):
|
||||
try:
|
||||
return self._client.list_vars(self._alias)
|
||||
except (self.pynuterror, ConnectionResetError) as err:
|
||||
_LOGGER.debug("Error getting NUT vars for host %s: %s",
|
||||
self._host, err)
|
||||
_LOGGER.debug(
|
||||
"Error getting NUT vars for host %s: %s", self._host, err)
|
||||
return None
|
||||
|
||||
@Throttle(MIN_TIME_BETWEEN_UPDATES)
|
||||
|
||||
Reference in new issue
Block a user