Fix PEPE257 issues

This commit is contained in:
Fabian Affolter committed 2016-03-08 16:46:34 +01:00
1 parent 49ebc6d0b0
commit 8bff97083c
49 files changed
+429 -363

No files matched your search

+10 -8
View File
@@ -44,7 +44,7 @@ MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=120)
def setup_platform(hass, config, add_devices, discovery_info=None):
"""Get the Forecast.io sensor."""
"""Setup the Forecast.io sensor."""
import forecastio
if None in (hass.config.latitude, hass.config.longitude):
@@ -86,9 +86,10 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
# pylint: disable=too-few-public-methods
class ForeCastSensor(Entity):
"""Implements an Forecast.io sensor."""
"""Implementation of a Forecast.io sensor."""
def __init__(self, weather_data, sensor_type):
"""Initialize the sensor."""
self.client_name = 'Weather'
self._name = SENSOR_TYPES[sensor_type][0]
self.forecast_client = weather_data
@@ -109,27 +110,27 @@ class ForeCastSensor(Entity):
@property
def name(self):
"""The name of the sensor."""
"""Return the name of the sensor."""
return '{} {}'.format(self.client_name, self._name)
@property
def state(self):
"""Returns the state of the sensor."""
"""Return the state of the sensor."""
return self._state
@property
def unit_of_measurement(self):
"""Unit of measurement of this entity, if any."""
"""Return the unit of measurement of this entity, if any."""
return self._unit_of_measurement
@property
def unit_system(self):
"""Unit system of this entity."""
"""Return the unit system of this entity."""
return self._unit_system
# pylint: disable=too-many-branches
def update(self):
"""Gets the latest data from Forecast.io and updates the states."""
"""Get the latest data from Forecast.io and updates the states."""
import forecastio
self.forecast_client.update()
@@ -179,6 +180,7 @@ class ForeCastData(object):
"""Gets the latest data from Forecast.io."""
def __init__(self, api_key, latitude, longitude, units):
"""Initialize the data object."""
self._api_key = api_key
self.latitude = latitude
self.longitude = longitude
@@ -189,7 +191,7 @@ class ForeCastData(object):
@Throttle(MIN_TIME_BETWEEN_UPDATES)
def update(self):
"""Gets the latest data from Forecast.io."""
"""Get the latest data from Forecast.io."""
import forecastio
forecast = forecastio.load_forecast(self._api_key,