Fix some issues for PyLint 1.7.2 (#8356)
* Fix some issues for PyLint 1.7.2 * More fixes * Revert position change for cover
This commit is contained in:
1 parent
83a5f932d1
commit
5779d64e98
66 files changed
+176
-272
No files matched your search
@@ -123,7 +123,7 @@ class ArestSensor(Entity):
|
||||
if self._pin is not None:
|
||||
request = requests.get(
|
||||
'{}/mode/{}/i'.format(self._resource, self._pin), timeout=10)
|
||||
if request.status_code is not 200:
|
||||
if request.status_code != 200:
|
||||
_LOGGER.error("Can't set mode of %s", self._resource)
|
||||
|
||||
@property
|
||||
|
||||
@@ -141,7 +141,7 @@ class PublicTransportData(object):
|
||||
params = {}
|
||||
params['stopid'] = self.stop
|
||||
|
||||
if len(self.route) > 0:
|
||||
if self.route:
|
||||
params['routeid'] = self.route
|
||||
|
||||
params['maxresults'] = 2
|
||||
|
||||
@@ -56,8 +56,8 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||
return
|
||||
|
||||
devices = []
|
||||
for config in discovery_info[ATTR_DISCOVER_DEVICES]:
|
||||
new_device = HMSensor(hass, config)
|
||||
for conf in discovery_info[ATTR_DISCOVER_DEVICES]:
|
||||
new_device = HMSensor(hass, conf)
|
||||
new_device.link_homematic()
|
||||
devices.append(new_device)
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||
password = config.get(CONF_PASSWORD)
|
||||
use_tls = config.get(CONF_SSL)
|
||||
verify_tls = config.get(CONF_VERIFY_SSL)
|
||||
default_port = use_tls and 6443 or 6080
|
||||
default_port = 6443 if use_tls else 6080
|
||||
port = int(config.get(CONF_PORT, default_port))
|
||||
|
||||
from mficlient.client import FailedToLogin, MFiClient
|
||||
@@ -97,10 +97,9 @@ class MfiSensor(Entity):
|
||||
if tag is None:
|
||||
return STATE_OFF
|
||||
elif self._port.model == 'Input Digital':
|
||||
return self._port.value > 0 and STATE_ON or STATE_OFF
|
||||
else:
|
||||
digits = DIGITS.get(self._port.tag, 0)
|
||||
return round(self._port.value, digits)
|
||||
return STATE_ON if self._port.value > 0 else STATE_OFF
|
||||
digits = DIGITS.get(self._port.tag, 0)
|
||||
return round(self._port.value, digits)
|
||||
|
||||
@property
|
||||
def unit_of_measurement(self):
|
||||
|
||||
@@ -242,10 +242,9 @@ class MoldIndicator(Entity):
|
||||
ATTR_DEWPOINT: self._dewpoint,
|
||||
ATTR_CRITICAL_TEMP: self._crit_temp,
|
||||
}
|
||||
else:
|
||||
return {
|
||||
ATTR_DEWPOINT:
|
||||
util.temperature.celsius_to_fahrenheit(self._dewpoint),
|
||||
ATTR_CRITICAL_TEMP:
|
||||
util.temperature.celsius_to_fahrenheit(self._crit_temp),
|
||||
}
|
||||
return {
|
||||
ATTR_DEWPOINT:
|
||||
util.temperature.celsius_to_fahrenheit(self._dewpoint),
|
||||
ATTR_CRITICAL_TEMP:
|
||||
util.temperature.celsius_to_fahrenheit(self._crit_temp),
|
||||
}
|
||||
@@ -147,13 +147,13 @@ class OpenHardwareMonitorData(object):
|
||||
"""Recursively loop through child objects, finding the values."""
|
||||
result = devices.copy()
|
||||
|
||||
if len(json[OHM_CHILDREN]) > 0:
|
||||
if json[OHM_CHILDREN]:
|
||||
for child_index in range(0, len(json[OHM_CHILDREN])):
|
||||
child_path = path.copy()
|
||||
child_path.append(child_index)
|
||||
|
||||
child_names = names.copy()
|
||||
if len(path) > 0:
|
||||
if path:
|
||||
child_names.append(json[OHM_NAME])
|
||||
|
||||
obj = json[OHM_CHILDREN][child_index]
|
||||
|
||||
@@ -58,7 +58,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||
continue
|
||||
dev.append(UberSensor('time', timeandpriceest, product_id, product))
|
||||
if (product.get('price_details') is not None) and \
|
||||
product['price_details']['estimate'] is not 'Metered':
|
||||
product['price_details']['estimate'] != 'Metered':
|
||||
dev.append(UberSensor(
|
||||
'price', timeandpriceest, product_id, product))
|
||||
add_devices(dev)
|
||||
|
||||
@@ -57,10 +57,6 @@ class Sensor(zha.Entity):
|
||||
value_attribute = 0
|
||||
min_reportable_change = 1
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
"""Initialize ZHA sensor."""
|
||||
super().__init__(**kwargs)
|
||||
|
||||
@property
|
||||
def state(self) -> str:
|
||||
"""Return the state of the entity."""
|
||||
|
||||
Reference in new issue
Block a user