More pylint 2 fixes (#15516)

* Pylint 2 useless-import-alias fixes

* Pylint 2 chained-comparison fixes

* Pylint 2 consider-using-get fixes

* Pylint 2 len-as-condition fixes
This commit is contained in:
Ville Skyttä authored and Paulus Schoutsen committed 2018-07-18 11:54:27 +02:00
1 parent 058081b1f5
commit bf17ed0917
104 files changed
+126 -137

No files matched your search

+1 -1
View File
@@ -11,7 +11,7 @@ import logging
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
import homeassistant.components.arduino as arduino
from homeassistant.components import arduino
from homeassistant.const import CONF_NAME
from homeassistant.helpers.entity import Entity
import homeassistant.helpers.config_validation as cv
+1 -1
View File
@@ -8,7 +8,7 @@ import asyncio
import json
import logging
import homeassistant.components.mqtt as mqtt
from homeassistant.components import mqtt
from homeassistant.core import callback
from homeassistant.const import TEMP_FAHRENHEIT, TEMP_CELSIUS
from homeassistant.helpers.entity import Entity
+2 -2
View File
@@ -128,7 +128,7 @@ class DHTSensor(Entity):
temperature = data[SENSOR_TEMPERATURE]
_LOGGER.debug("Temperature %.1f \u00b0C + offset %.1f",
temperature, temperature_offset)
if (temperature >= -20) and (temperature < 80):
if -20 <= temperature < 80:
self._state = round(temperature + temperature_offset, 1)
if self.temp_unit == TEMP_FAHRENHEIT:
self._state = round(celsius_to_fahrenheit(temperature), 1)
@@ -136,7 +136,7 @@ class DHTSensor(Entity):
humidity = data[SENSOR_HUMIDITY]
_LOGGER.debug("Humidity %.1f%% + offset %.1f",
humidity, humidity_offset)
if (humidity >= 0) and (humidity <= 100):
if 0 <= humidity <= 100:
self._state = round(humidity + humidity_offset, 1)
+1 -1
View File
@@ -23,7 +23,7 @@ import homeassistant.helpers.config_validation as cv
from homeassistant.util.decorator import Registry
from homeassistant.helpers.entity import Entity
from homeassistant.helpers.event import async_track_state_change
import homeassistant.components.history as history
from homeassistant.components import history
import homeassistant.util.dt as dt_util
_LOGGER = logging.getLogger(__name__)
@@ -17,7 +17,7 @@ from homeassistant.const import (
ATTR_LONGITUDE, CONF_MODE)
from homeassistant.util import Throttle
import homeassistant.helpers.config_validation as cv
import homeassistant.helpers.location as location
from homeassistant.helpers import location
import homeassistant.util.dt as dt_util
REQUIREMENTS = ['googlemaps==2.5.1']
@@ -10,7 +10,7 @@ from datetime import timedelta
import voluptuous as vol
import requests
import homeassistant.util.dt as dt
from homeassistant.util import dt
import homeassistant.helpers.config_validation as cv
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import (
+1 -1
View File
@@ -176,7 +176,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
gtfs = pygtfs.Schedule(joined_path)
# pylint: disable=no-member
if len(gtfs.feeds) < 1:
if not gtfs.feeds:
pygtfs.append_feed(gtfs, os.path.join(gtfs_dir, data))
add_devices([GTFSDepartureSensor(gtfs, name, origin, destination, offset)])
@@ -10,7 +10,7 @@ import math
import voluptuous as vol
import homeassistant.components.history as history
from homeassistant.components import history
import homeassistant.helpers.config_validation as cv
import homeassistant.util.dt as dt_util
from homeassistant.components.sensor import PLATFORM_SCHEMA
+1 -1
View File
@@ -9,7 +9,7 @@ import struct
import voluptuous as vol
import homeassistant.components.modbus as modbus
from homeassistant.components import modbus
from homeassistant.const import (
CONF_NAME, CONF_OFFSET, CONF_UNIT_OF_MEASUREMENT, CONF_SLAVE,
CONF_STRUCTURE)
@@ -10,7 +10,7 @@ import math
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
import homeassistant.util as util
from homeassistant import util
from homeassistant.helpers.entity import Entity
from homeassistant.helpers.event import track_state_change
from homeassistant.const import (
+1 -1
View File
@@ -20,7 +20,7 @@ from homeassistant.const import (
CONF_FORCE_UPDATE, CONF_NAME, CONF_VALUE_TEMPLATE, STATE_UNKNOWN,
CONF_UNIT_OF_MEASUREMENT, CONF_ICON, CONF_DEVICE_CLASS)
from homeassistant.helpers.entity import Entity
import homeassistant.components.mqtt as mqtt
from homeassistant.components import mqtt
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.typing import HomeAssistantType, ConfigType
from homeassistant.helpers.event import async_track_point_in_utc_time
+1 -1
View File
@@ -11,7 +11,7 @@ from datetime import timedelta
import voluptuous as vol
import homeassistant.components.mqtt as mqtt
from homeassistant.components import mqtt
import homeassistant.helpers.config_validation as cv
from homeassistant.components.mqtt import CONF_STATE_TOPIC
from homeassistant.components.sensor import PLATFORM_SCHEMA
+1 -1
View File
@@ -12,7 +12,7 @@ from homeassistant.const import (
CONF_NAME, STATE_UNKNOWN, CONF_UNIT_OF_MEASUREMENT, CONF_PAYLOAD)
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.helpers.entity import Entity
import homeassistant.components.pilight as pilight
from homeassistant.components import pilight
import homeassistant.helpers.config_validation as cv
_LOGGER = logging.getLogger(__name__)
+1 -1
View File
@@ -8,7 +8,7 @@ import logging
import voluptuous as vol
import homeassistant.components.rfxtrx as rfxtrx
from homeassistant.components import rfxtrx
from homeassistant.components.rfxtrx import (
ATTR_DATA_TYPE, ATTR_FIRE_EVENT, CONF_AUTOMATIC_ADD, CONF_DATA_TYPE,
CONF_DEVICES, CONF_FIRE_EVENT, DATA_TYPES)
+1 -1
View File
@@ -12,7 +12,7 @@ import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import CONF_TYPE
from homeassistant.helpers.entity import Entity
import homeassistant.util as util
from homeassistant import util
REQUIREMENTS = ['ephem==3.7.6.0']
+1 -1
View File
@@ -39,7 +39,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
def setup_platform(hass, config, add_devices, discovery_info=None):
"""Set up the Tellstick sensors."""
import tellcore.telldus as telldus
from tellcore import telldus
import tellcore.constants as tellcore_constants
sensor_value_descriptions = {
@@ -7,7 +7,7 @@ https://home-assistant.io/components/sensor.thinkingcleaner/
import logging
from datetime import timedelta
import homeassistant.util as util
from homeassistant import util
from homeassistant.helpers.entity import Entity
_LOGGER = logging.getLogger(__name__)
+1 -1
View File
@@ -5,7 +5,7 @@ For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.toon/
"""
import logging
import datetime as datetime
import datetime
from homeassistant.helpers.entity import Entity
import homeassistant.components.toon as toon_main
@@ -14,7 +14,7 @@ from homeassistant.const import (
ATTR_ATTRIBUTION, CONF_NAME, CONF_REGION, EVENT_HOMEASSISTANT_START,
ATTR_LATITUDE, ATTR_LONGITUDE)
import homeassistant.helpers.config_validation as cv
import homeassistant.helpers.location as location
from homeassistant.helpers import location
from homeassistant.helpers.entity import Entity
from homeassistant.util import Throttle
+1 -1
View File
@@ -8,7 +8,7 @@ import logging
import voluptuous as vol
import homeassistant.components.zabbix as zabbix
from homeassistant.components import zabbix
import homeassistant.helpers.config_validation as cv
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import CONF_NAME
@@ -12,7 +12,7 @@ from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import STATE_UNKNOWN
from homeassistant.const import CONF_MONITORED_CONDITIONS
from homeassistant.helpers.entity import Entity
import homeassistant.components.zoneminder as zoneminder
from homeassistant.components import zoneminder
import homeassistant.helpers.config_validation as cv
_LOGGER = logging.getLogger(__name__)