More pylint 2 fixes (#15565)

## Description:

More fixes flagged by pylint 2 that don't hurt to have before the actual pylint 2 upgrade (which I'll submit soon).

## Checklist:
  - [ ] The code change is tested and works locally.
  - [x] Local tests pass with `tox`. **Your PR cannot be merged unless tests pass**
This commit is contained in:
Ville Skyttä authored and Andrey committed 2018-07-20 11:45:20 +03:00
1 parent ea18e06b08
commit 2f7b79764a
242 files changed
+284 -284

No files matched your search

+1 -1
View File
@@ -248,7 +248,7 @@ class AirVisualSensor(Entity):
})
class AirVisualData(object):
class AirVisualData:
"""Define an object to hold sensor data."""
def __init__(self, client, **kwargs):
+1 -1
View File
@@ -158,7 +158,7 @@ class ArestSensor(Entity):
return self.arest.available
class ArestData(object):
class ArestData:
"""The Class for handling the data retrieval for variables."""
def __init__(self, resource, pin=None):
+1 -1
View File
@@ -125,7 +125,7 @@ class BboxSensor(Entity):
2)
class BboxData(object):
class BboxData:
"""Get data from the Bbox."""
def __init__(self):
+1 -1
View File
@@ -169,7 +169,7 @@ class BitcoinSensor(Entity):
self._state = '{0:.2f}'.format(stats.market_price_usd)
class BitcoinData(object):
class BitcoinData:
"""Get the latest data and update the states."""
def __init__(self):
+1 -1
View File
@@ -180,7 +180,7 @@ class BOMCurrentSensor(Entity):
self.bom_data.update()
class BOMCurrentData(object):
class BOMCurrentData:
"""Get data from BOM."""
def __init__(self, hass, station_id):
+1 -1
View File
@@ -96,7 +96,7 @@ class BroadlinkSensor(Entity):
self._state = self._broadlink_data.data[self._type]
class BroadlinkData(object):
class BroadlinkData:
"""Representation of a Broadlink data object."""
def __init__(self, interval, ip_addr, mac_addr, timeout):
@@ -374,7 +374,7 @@ class BrSensor(Entity):
return self._force_update
class BrData(object):
class BrData:
"""Get the latest data and updates the states."""
def __init__(self, hass, coordinates, timeframe, devices):
@@ -140,7 +140,7 @@ class CoinMarketCapSensor(Entity):
self._ticker = self.data.ticker.get('data')
class CoinMarketCapData(object):
class CoinMarketCapData:
"""Get the latest data and update the states."""
def __init__(self, currency_id, display_currency):
@@ -95,7 +95,7 @@ class CommandSensor(Entity):
self._state = value
class CommandSensorData(object):
class CommandSensorData:
"""The class for handling the data retrieval."""
def __init__(self, hass, command, command_timeout):
+1 -1
View File
@@ -129,7 +129,7 @@ class CupsSensor(Entity):
# pylint: disable=no-name-in-module
class CupsData(object):
class CupsData:
"""Get the latest data from CUPS and update the state."""
def __init__(self, host, port):
@@ -104,7 +104,7 @@ class CurrencylayerSensor(Entity):
value['{}{}'.format(self._base, self._quote)], 4)
class CurrencylayerData(object):
class CurrencylayerData:
"""Get data from Currencylayer.org."""
def __init__(self, resource, parameters):
+1 -1
View File
@@ -372,7 +372,7 @@ def convert_to_camel(data):
return components[0] + "".join(x.title() for x in components[1:])
class DarkSkyData(object):
class DarkSkyData:
"""Get the latest data from Darksky."""
def __init__(self, api_key, latitude, longitude, units, language,
@@ -85,7 +85,7 @@ class DeutscheBahnSensor(Entity):
self._state += " + {}".format(self.data.connections[0]['delay'])
class SchieneData(object):
class SchieneData:
"""Pull data from the bahn.de web page."""
def __init__(self, start, goal, only_direct):
+1 -1
View File
@@ -140,7 +140,7 @@ class DHTSensor(Entity):
self._state = round(humidity + humidity_offset, 1)
class DHTClient(object):
class DHTClient:
"""Get the latest data from the DHT sensor."""
def __init__(self, adafruit_dht, sensor, pin):
@@ -125,7 +125,7 @@ class DublinPublicTransportSensor(Entity):
pass
class PublicTransportData(object):
class PublicTransportData:
"""The Class for handling the data retrieval."""
def __init__(self, stop, route):
@@ -163,7 +163,7 @@ class DwdWeatherWarningsSensor(Entity):
self._api.update()
class DwdWeatherWarningsAPI(object):
class DwdWeatherWarningsAPI:
"""Get the latest data and update the states."""
def __init__(self, region_name):
+1 -1
View File
@@ -99,7 +99,7 @@ class DweetSensor(Entity):
values, STATE_UNKNOWN)
class DweetData(object):
class DweetData:
"""The class for handling the data retrieval."""
def __init__(self, device):
+1 -1
View File
@@ -129,7 +129,7 @@ class EBoxSensor(Entity):
self._state = round(self.ebox_data.data[self.type], 2)
class EBoxData(object):
class EBoxData:
"""Get data from Ebox."""
def __init__(self, username, password, httpsession):
@@ -120,7 +120,7 @@ class EddystoneTemp(Entity):
return False
class Monitor(object):
class Monitor:
"""Continuously scan for BLE advertisements."""
def __init__(self, hass, devices, bt_device_id):
+1 -1
View File
@@ -190,7 +190,7 @@ class EmonCmsSensor(Entity):
self._state = round(float(elem["value"]), DECIMALS)
class EmonCmsData(object):
class EmonCmsData:
"""The class for handling the data retrieval."""
def __init__(self, hass, url, apikey, interval):
@@ -138,7 +138,7 @@ class EnvirophatSensor(Entity):
self._state = self.data.voltage_3
class EnvirophatData(object):
class EnvirophatData:
"""Get the latest data and update."""
def __init__(self, envirophat, use_leds):
+1 -1
View File
@@ -112,7 +112,7 @@ class BanSensor(Entity):
self.last_ban = 'None'
class BanLogParser(object):
class BanLogParser:
"""Class to parse fail2ban logs."""
def __init__(self, interval, log_file):
@@ -102,7 +102,7 @@ class SpeedtestSensor(Entity):
return ICON
class SpeedtestData(object):
class SpeedtestData:
"""Get the latest data from fast.com."""
def __init__(self, hass, config):
+1 -1
View File
@@ -147,7 +147,7 @@ class FidoSensor(Entity):
self._state = round(self._state, 2)
class FidoData(object):
class FidoData:
"""Get data from Fido."""
def __init__(self, username, password, httpsession):
+2 -2
View File
@@ -258,7 +258,7 @@ class SensorFilter(Entity):
return state_attr
class FilterState(object):
class FilterState:
"""State abstraction for filter usage."""
def __init__(self, state):
@@ -283,7 +283,7 @@ class FilterState(object):
return "{} : {}".format(self.timestamp, self.state)
class Filter(object):
class Filter:
"""Filter skeleton.
Args:
+1 -1
View File
@@ -101,7 +101,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
add_devices(accounts, True)
class FinTsClient(object):
class FinTsClient:
"""Wrapper around the FinTS3PinTanClient.
Use this class as Context Manager to get the FinTS3Client object.
+1 -1
View File
@@ -102,7 +102,7 @@ class ExchangeRateSensor(Entity):
self._state = round(self.data.rate['rates'][self._target], 3)
class ExchangeData(object):
class ExchangeData:
"""Get the latest data and update the states."""
def __init__(self, target_currency, api_key):
@@ -143,7 +143,7 @@ class FritzBoxCallSensor(Entity):
self.phonebook.update_phonebook()
class FritzBoxCallMonitor(object):
class FritzBoxCallMonitor:
"""Event listener to monitor calls on the Fritz!Box."""
def __init__(self, host, port, sensor):
@@ -225,7 +225,7 @@ class FritzBoxCallMonitor(object):
self._sensor.schedule_update_ha_state()
class FritzBoxPhonebook(object):
class FritzBoxPhonebook:
"""This connects to a FritzBox router and downloads its phone book."""
def __init__(self, host, port, username, password,
+1 -1
View File
@@ -98,7 +98,7 @@ class Geizwatch(Entity):
self._state = self.data.prices[0]
class GeizParser(object):
class GeizParser:
"""Pull data from the geizhals website."""
def __init__(self, product_id, domain, regex):
@@ -149,7 +149,7 @@ class GeoRssServiceSensor(Entity):
self._state_attributes = matrix
class GeoRssServiceData(object):
class GeoRssServiceData:
"""Provide access to GeoRSS feed and stores the latest data."""
def __init__(self, home_latitude, home_longitude, url, radius_in_km):
+1 -1
View File
@@ -176,7 +176,7 @@ class GlancesSensor(Entity):
self._state = round(use / 1024**2, 1)
class GlancesData(object):
class GlancesData:
"""The class for handling the data retrieval."""
def __init__(self, resource):
@@ -138,7 +138,7 @@ class GoogleWifiSensor(Entity):
self._state = STATE_UNKNOWN
class GoogleWifiAPI(object):
class GoogleWifiAPI:
"""Get the latest data and update the states."""
def __init__(self, host, conditions):
@@ -122,7 +122,7 @@ class HaveIBeenPwnedSensor(Entity):
self._state = len(self._data.data[self._email])
class HaveIBeenPwnedData(object):
class HaveIBeenPwnedData:
"""Class for handling the data retrieval."""
def __init__(self, emails):
+1 -1
View File
@@ -108,7 +108,7 @@ class HddTempSensor(Entity):
self._state = None
class HddTempData(object):
class HddTempData:
"""Get the latest data from HDDTemp and update the states."""
def __init__(self, host, port):
+1 -1
View File
@@ -147,7 +147,7 @@ class HpIloSensor(Entity):
self._state = ilo_data
class HpIloData(object):
class HpIloData:
"""Gets the latest data from HP ILO."""
def __init__(self, host, port, login, password):
@@ -162,7 +162,7 @@ class HydroQuebecSensor(Entity):
self._state = round(self.hydroquebec_data.data[self.type], 2)
class HydroquebecData(object):
class HydroquebecData:
"""Get data from HydroQuebec."""
def __init__(self, username, password, httpsession, contract=None):
@@ -58,7 +58,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
return False
class EmailReader(object):
class EmailReader:
"""A class to read emails from an IMAP server."""
def __init__(self, user, password, server, port):
+1 -1
View File
@@ -155,7 +155,7 @@ class InfluxSensor(Entity):
self._state = value
class InfluxSensorData(object):
class InfluxSensorData:
"""Class for handling the data retrieval."""
def __init__(self, influx, group, field, measurement, where):
@@ -132,7 +132,7 @@ class IrishRailTransportSensor(Entity):
self._state = None
class IrishRailTransportData(object):
class IrishRailTransportData:
"""The Class for handling the data retrieval."""
def __init__(self, irish_rail, station, direction, destination, stops_at):
@@ -71,7 +71,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
add_devices(sensors, True)
class APIData(object):
class APIData:
"""Get the latest data for all authorities."""
def __init__(self):
@@ -95,7 +95,7 @@ class LondonTubeSensor(Entity):
self._description = self._data.data[self.name]['Description']
class TubeData(object):
class TubeData:
"""Get the latest tube data from TFL."""
def __init__(self):
+1 -1
View File
@@ -137,7 +137,7 @@ class LuftdatenSensor(Entity):
await self.luftdaten.async_update()
class LuftdatenData(object):
class LuftdatenData:
"""Class for handling the data retrieval."""
def __init__(self, data):
+1 -1
View File
@@ -183,7 +183,7 @@ class LyftSensor(Entity):
estimate.get('estimated_cost_cents_max', 0)) / 2) / 100)
class LyftEstimate(object):
class LyftEstimate:
"""The class for handling the time and price estimate."""
def __init__(self, session, start_latitude, start_longitude,
+1 -1
View File
@@ -174,7 +174,7 @@ class MetOfficeCurrentSensor(Entity):
self.data.update()
class MetOfficeCurrentData(object):
class MetOfficeCurrentData:
"""Get data from Datapoint."""
def __init__(self, hass, datapoint, site):
+1 -1
View File
@@ -117,7 +117,7 @@ class MHZ19Sensor(Entity):
return result
class MHZClient(object):
class MHZClient:
"""Get the latest data from the MH-Z sensor."""
def __init__(self, co2sensor, serial):
+1 -1
View File
@@ -70,7 +70,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
for index, _ in enumerate(data.vehicles)], True)
class MoparData(object):
class MoparData:
"""Container for Mopar vehicle data.
Prevents session expiry re-login race condition.
+1 -1
View File
@@ -123,7 +123,7 @@ class MVGLiveSensor(Entity):
self._icon = ICONS[self.data.departures.get('product', '-')]
class MVGLiveData(object):
class MVGLiveData:
"""Pull data from the mvg-live.de web page."""
def __init__(self, station, destinations, directions,
+1 -1
View File
@@ -287,7 +287,7 @@ class NetAtmoSensor(Entity):
self._state = "Full"
class NetAtmoData(object):
class NetAtmoData:
"""Get the latest data from NetAtmo."""
def __init__(self, auth, station):
+1 -1
View File
@@ -134,7 +134,7 @@ class NetdataSensor(Entity):
resource_data['dimensions'][self._element]['value'], 2)
class NetdataData(object):
class NetdataData:
"""The class for handling the data retrieval."""
def __init__(self, api):
@@ -69,7 +69,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
add_devices([NeurioEnergy(data, DAILY_NAME, DAILY_TYPE, update_daily)])
class NeurioData(object):
class NeurioData:
"""Stores data retrieved from Neurio sensor."""
def __init__(self, api_key, api_secret, sensor_id):
@@ -73,7 +73,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
])
class StationPriceData(object):
class StationPriceData:
"""An object to store and fetch the latest data for a given station."""
def __init__(self, client, station_id: int) -> None:
+1 -1
View File
@@ -260,7 +260,7 @@ class NUTSensor(Entity):
self._state = self._data.status[self.type]
class PyNUTData(object):
class PyNUTData:
"""Stores the data retrieved from NUT.
For each entity to use, acts as the single point responsible for fetching
+1 -1
View File
@@ -138,7 +138,7 @@ class NZBGetSensor(Entity):
self._state = value
class NZBGetAPI(object):
class NZBGetAPI:
"""Simple JSON-RPC wrapper for NZBGet's API."""
def __init__(self, api_url, username=None, password=None):
@@ -93,7 +93,7 @@ class OpenexchangeratesSensor(Entity):
self._state = round(value[str(self._quote)], 4)
class OpenexchangeratesData(object):
class OpenexchangeratesData:
"""Get data from Openexchangerates.org."""
def __init__(self, resource, parameters, quote):
@@ -108,7 +108,7 @@ class OpenHardwareMonitorDevice(Entity):
})
class OpenHardwareMonitorData(object):
class OpenHardwareMonitorData:
"""Class used to pull data from OHM and create sensors."""
def __init__(self, config, hass):
@@ -179,7 +179,7 @@ class OpenWeatherMapSensor(Entity):
self._state = fc_data.get_weathers()[0].get_detailed_status()
class WeatherData(object):
class WeatherData:
"""Get the latest data from OpenWeatherMap."""
def __init__(self, owm, forecast, latitude, longitude):
+1 -1
View File
@@ -153,7 +153,7 @@ class PiHoleSensor(Entity):
self.data = self.pi_hole.api.data
class PiHoleData(object):
class PiHoleData:
"""Get the latest data and update the states."""
def __init__(self, api):
+1 -1
View File
@@ -263,7 +263,7 @@ class PollencomSensor(Entity):
self._state = average
class PollenComData(object):
class PollenComData:
"""Define a data object to retrieve info from Pollen.com."""
def __init__(self, client, sensor_types):
+1 -1
View File
@@ -124,7 +124,7 @@ class PyLoadSensor(Entity):
self._state = value
class PyLoadAPI(object):
class PyLoadAPI:
"""Simple wrapper for pyLoad's API."""
def __init__(self, api_url, username=None, password=None):
+1 -1
View File
@@ -164,7 +164,7 @@ def round_nicely(number):
return round(number)
class QNAPStatsAPI(object):
class QNAPStatsAPI:
"""Class to interface with the API."""
def __init__(self, config):
+1 -1
View File
@@ -158,7 +158,7 @@ class RestSensor(Entity):
return self._attributes
class RestData(object):
class RestData:
"""Class for handling the data retrieval."""
def __init__(self, method, resource, auth, headers, data, verify_ssl):
+1 -1
View File
@@ -27,7 +27,7 @@ CONSUMPTION_NAME = "Usage"
ACTIVE_TYPE = 'active'
class SensorConfig(object):
class SensorConfig:
"""Data structure holding sensor config."""
def __init__(self, name, sensor_type):
+1 -1
View File
@@ -109,7 +109,7 @@ class SenseHatSensor(Entity):
self._state = self.data.pressure
class SenseHatData(object):
class SenseHatData:
"""Get the latest data and update."""
def __init__(self, is_hat_attached):
+1 -1
View File
@@ -96,7 +96,7 @@ class ShodanSensor(Entity):
self._state = self.data.details['total']
class ShodanData(object):
class ShodanData:
"""Get the latest data and update the states."""
def __init__(self, api, query):
+1 -1
View File
@@ -75,7 +75,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
add_devices(devs)
class SHTClient(object):
class SHTClient:
"""Get the latest data from the SHT sensor."""
def __init__(self, adafruit_sht):
+1 -1
View File
@@ -55,7 +55,7 @@ def epoch_to_datetime(epoch_time):
return datetime.datetime.fromtimestamp(epoch_time).isoformat()
class SigfoxAPI(object):
class SigfoxAPI:
"""Class for interacting with the SigFox API."""
def __init__(self, api_login, api_password):
+1 -1
View File
@@ -131,7 +131,7 @@ class SnmpSensor(Entity):
self._state = value
class SnmpData(object):
class SnmpData:
"""Get the latest data and update the states."""
def __init__(self, host, port, community, baseoid, version, accept_errors,
+1 -1
View File
@@ -148,7 +148,7 @@ class SpeedtestSensor(Entity):
self._state = state.state
class SpeedtestData(object):
class SpeedtestData:
"""Get the latest data from speedtest.net."""
def __init__(self, hass, config):
+1 -1
View File
@@ -118,7 +118,7 @@ class StartcaSensor(Entity):
self._state = round(self.startcadata.data[self.type], 2)
class StartcaData(object):
class StartcaData:
"""Get data from Start.ca API."""
def __init__(self, loop, websession, api_key, bandwidth_cap):
@@ -145,7 +145,7 @@ class SwissHydrologicalDataSensor(Entity):
self._state = self.data.measurings['03']['current']
class HydrologicalData(object):
class HydrologicalData:
"""The Class for handling the data retrieval."""
def __init__(self, station):
@@ -129,7 +129,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
hass.bus.listen_once(EVENT_HOMEASSISTANT_START, run_setup)
class SynoApi(object):
class SynoApi:
"""Class to interface with Synology DSM API."""
def __init__(self, host, port, username, password, temp_unit, use_ssl):
+1 -1
View File
@@ -113,7 +113,7 @@ class SytadinSensor(Entity):
self._state = self.data.congestion
class SytadinData(object):
class SytadinData:
"""The class for handling the data retrieval."""
def __init__(self, resource):
+1 -1
View File
@@ -88,7 +88,7 @@ class Ted5000Sensor(Entity):
self._gateway.update()
class Ted5000Gateway(object):
class Ted5000Gateway:
"""The class for handling the data retrieval."""
def __init__(self, url):
+1 -1
View File
@@ -119,7 +119,7 @@ class TekSavvySensor(Entity):
self._state = round(self.teksavvydata.data[self.type], 2)
class TekSavvyData(object):
class TekSavvyData:
"""Get data from TekSavvy API."""
def __init__(self, loop, websession, api_key, bandwidth_cap):
@@ -110,7 +110,7 @@ class TtnDataSensor(Entity):
self._state = self._ttn_data_storage.data
class TtnDataStorage(object):
class TtnDataStorage:
"""Get the latest data from The Things Network Data Storage."""
def __init__(self, hass, app_id, device_id, access_key, values):
@@ -148,7 +148,7 @@ class TransmissionSensor(Entity):
self._state = self._data.torrentCount
class TransmissionData(object):
class TransmissionData:
"""Get the latest data and update the states."""
def __init__(self, api):
+1 -1
View File
@@ -175,7 +175,7 @@ class UberSensor(Entity):
self._state = 0
class UberEstimate(object):
class UberEstimate:
"""The class for handling the time and price estimate."""
def __init__(self, session, start_latitude, start_longitude,
@@ -16,7 +16,7 @@ from homeassistant.helpers.entity import Entity
from homeassistant.util import slugify
class WFSensorConfig(object):
class WFSensorConfig:
"""Water Furnace Sensor configuration."""
def __init__(self, friendly_name, field, icon="mdi:gauge",
@@ -40,7 +40,7 @@ MIN_TIME_BETWEEN_UPDATES = timedelta(minutes=5)
# Helper classes for declaring sensor configurations
class WUSensorConfig(object):
class WUSensorConfig:
"""WU Sensor Configuration.
defines basic HA properties of the weather sensor and
@@ -764,7 +764,7 @@ class WUndergroundSensor(Entity):
return self._unique_id
class WUndergroundData(object):
class WUndergroundData:
"""Get data from WUnderground."""
def __init__(self, hass, api_key, pws_id, lang, latitude, longitude):
@@ -104,7 +104,7 @@ class YahooFinanceSensor(Entity):
self._state = self.data.state
class YahooFinanceData(object):
class YahooFinanceData:
"""Get data from Yahoo Finance."""
def __init__(self, symbol):
+1 -1
View File
@@ -142,7 +142,7 @@ class YrSensor(Entity):
return self._unit_of_measurement
class YrData(object):
class YrData:
"""Get the latest data and updates the states."""
def __init__(self, hass, coordinates, forecast, devices):
+1 -1
View File
@@ -174,7 +174,7 @@ class YahooWeatherSensor(Entity):
float(self._data.yahoo.Atmosphere['visibility'])/1.61, 2)
class YahooWeatherData(object):
class YahooWeatherData:
"""Handle Yahoo! API object and limit updates."""
def __init__(self, woeid, temp_unit):
+1 -1
View File
@@ -133,7 +133,7 @@ class ZamgSensor(Entity):
self.probe.update()
class ZamgData(object):
class ZamgData:
"""The class for handling the data retrieval."""
API_URL = 'http://www.zamg.ac.at/ogd/'
+1 -1
View File
@@ -8,7 +8,7 @@ import logging
from homeassistant.components.sensor import DOMAIN
from homeassistant.components import zwave
from homeassistant.const import TEMP_CELSIUS, TEMP_FAHRENHEIT
from homeassistant.components.zwave import async_setup_platform # noqa # pylint: disable=unused-import
from homeassistant.components.zwave import async_setup_platform # noqa pylint: disable=unused-import
_LOGGER = logging.getLogger(__name__)