Upgrade pylint (#27279)
* Upgrade pylint to 2.4.2 and astroid to 2.3.1 https://pylint.readthedocs.io/en/latest/whatsnew/2.4.html https://pylint.readthedocs.io/en/latest/whatsnew/changelog.html#what-s-new-in-pylint-2-4-1 https://pylint.readthedocs.io/en/latest/whatsnew/changelog.html#what-s-new-in-pylint-2-4-2 * unnecessary-comprehension fixes * invalid-name fixes * self-assigning-variable fixes * Re-enable not-an-iterable * used-before-assignment fix * invalid-overridden-method fixes * undefined-variable __class__ workarounds https://github.com/PyCQA/pylint/issues/3090 * no-member false positive disabling * Remove some no longer needed disables * using-constant-test fix * Disable import-outside-toplevel for now * Disable some apparent no-value-for-parameter false positives * invalid-overridden-method false positive disables https://github.com/PyCQA/pylint/issues/3150 * Fix unintentional Entity.force_update override in AfterShipSensorpull/27288/head
parent
3adac699c7
commit
761d7f21e9
|
@ -146,10 +146,10 @@ class AfterShipSensor(Entity):
|
||||||
async def async_added_to_hass(self):
|
async def async_added_to_hass(self):
|
||||||
"""Register callbacks."""
|
"""Register callbacks."""
|
||||||
self.hass.helpers.dispatcher.async_dispatcher_connect(
|
self.hass.helpers.dispatcher.async_dispatcher_connect(
|
||||||
UPDATE_TOPIC, self.force_update
|
UPDATE_TOPIC, self._force_update
|
||||||
)
|
)
|
||||||
|
|
||||||
async def force_update(self):
|
async def _force_update(self):
|
||||||
"""Force update of data."""
|
"""Force update of data."""
|
||||||
await self.async_update(no_throttle=True)
|
await self.async_update(no_throttle=True)
|
||||||
await self.async_update_ha_state()
|
await self.async_update_ha_state()
|
||||||
|
|
|
@ -171,7 +171,7 @@ class AxisFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
if discovery_info[CONF_HOST].startswith("169.254"):
|
if discovery_info[CONF_HOST].startswith("169.254"):
|
||||||
return self.async_abort(reason="link_local_address")
|
return self.async_abort(reason="link_local_address")
|
||||||
|
|
||||||
# pylint: disable=unsupported-assignment-operation
|
# pylint: disable=no-member # https://github.com/PyCQA/pylint/issues/3167
|
||||||
self.context["macaddress"] = serialnumber
|
self.context["macaddress"] = serialnumber
|
||||||
|
|
||||||
if any(
|
if any(
|
||||||
|
|
|
@ -250,7 +250,7 @@ class BayesianBinarySensor(BinarySensorDevice):
|
||||||
def device_state_attributes(self):
|
def device_state_attributes(self):
|
||||||
"""Return the state attributes of the sensor."""
|
"""Return the state attributes of the sensor."""
|
||||||
return {
|
return {
|
||||||
ATTR_OBSERVATIONS: [val for val in self.current_obs.values()],
|
ATTR_OBSERVATIONS: list(self.current_obs.values()),
|
||||||
ATTR_PROBABILITY: round(self.probability, 2),
|
ATTR_PROBABILITY: round(self.probability, 2),
|
||||||
ATTR_PROBABILITY_THRESHOLD: self._probability_threshold,
|
ATTR_PROBABILITY_THRESHOLD: self._probability_threshold,
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,7 +69,7 @@ class BTSmartHubScanner(DeviceScanner):
|
||||||
_LOGGER.warning("Error scanning devices")
|
_LOGGER.warning("Error scanning devices")
|
||||||
return
|
return
|
||||||
|
|
||||||
clients = [client for client in data.values()]
|
clients = list(data.values())
|
||||||
self.last_results = clients
|
self.last_results = clients
|
||||||
|
|
||||||
def get_bt_smarthub_data(self):
|
def get_bt_smarthub_data(self):
|
||||||
|
|
|
@ -11,5 +11,6 @@ def get_cert(host, port):
|
||||||
address = (host, port)
|
address = (host, port)
|
||||||
with socket.create_connection(address, timeout=TIMEOUT) as sock:
|
with socket.create_connection(address, timeout=TIMEOUT) as sock:
|
||||||
with ctx.wrap_socket(sock, server_hostname=address[0]) as ssock:
|
with ctx.wrap_socket(sock, server_hostname=address[0]) as ssock:
|
||||||
cert = ssock.getpeercert()
|
# pylint disable: https://github.com/PyCQA/pylint/issues/3166
|
||||||
|
cert = ssock.getpeercert() # pylint: disable=no-member
|
||||||
return cert
|
return cert
|
||||||
|
|
|
@ -165,4 +165,4 @@ class DdWrtDeviceScanner(DeviceScanner):
|
||||||
|
|
||||||
def _parse_ddwrt_response(data_str):
|
def _parse_ddwrt_response(data_str):
|
||||||
"""Parse the DD-WRT data format."""
|
"""Parse the DD-WRT data format."""
|
||||||
return {key: val for key, val in _DDWRT_DATA_REGEX.findall(data_str)}
|
return dict(_DDWRT_DATA_REGEX.findall(data_str))
|
||||||
|
|
|
@ -187,7 +187,7 @@ class DeconzFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
):
|
):
|
||||||
return self.async_abort(reason="already_in_progress")
|
return self.async_abort(reason="already_in_progress")
|
||||||
|
|
||||||
# pylint: disable=unsupported-assignment-operation
|
# pylint: disable=no-member # https://github.com/PyCQA/pylint/issues/3167
|
||||||
self.context[CONF_BRIDGEID] = bridgeid
|
self.context[CONF_BRIDGEID] = bridgeid
|
||||||
|
|
||||||
self.deconz_config = {
|
self.deconz_config = {
|
||||||
|
|
|
@ -126,6 +126,9 @@ class EsphomeClimateDevice(EsphomeEntity, ClimateDevice):
|
||||||
features |= SUPPORT_PRESET_MODE
|
features |= SUPPORT_PRESET_MODE
|
||||||
return features
|
return features
|
||||||
|
|
||||||
|
# https://github.com/PyCQA/pylint/issues/3150 for all @esphome_state_property
|
||||||
|
# pylint: disable=invalid-overridden-method
|
||||||
|
|
||||||
@esphome_state_property
|
@esphome_state_property
|
||||||
def hvac_mode(self) -> Optional[str]:
|
def hvac_mode(self) -> Optional[str]:
|
||||||
"""Return current operation ie. heat, cool, idle."""
|
"""Return current operation ie. heat, cool, idle."""
|
||||||
|
|
|
@ -44,11 +44,12 @@ class EsphomeFlowHandler(config_entries.ConfigFlow):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def _name(self):
|
def _name(self):
|
||||||
|
# pylint: disable=no-member # https://github.com/PyCQA/pylint/issues/3167
|
||||||
return self.context.get("name")
|
return self.context.get("name")
|
||||||
|
|
||||||
@_name.setter
|
@_name.setter
|
||||||
def _name(self, value):
|
def _name(self, value):
|
||||||
# pylint: disable=unsupported-assignment-operation
|
# pylint: disable=no-member # https://github.com/PyCQA/pylint/issues/3167
|
||||||
self.context["name"] = value
|
self.context["name"] = value
|
||||||
self.context["title_placeholders"] = {"name": self._name}
|
self.context["title_placeholders"] = {"name": self._name}
|
||||||
|
|
||||||
|
|
|
@ -70,6 +70,9 @@ class EsphomeCover(EsphomeEntity, CoverDevice):
|
||||||
def _state(self) -> Optional[CoverState]:
|
def _state(self) -> Optional[CoverState]:
|
||||||
return super()._state
|
return super()._state
|
||||||
|
|
||||||
|
# https://github.com/PyCQA/pylint/issues/3150 for all @esphome_state_property
|
||||||
|
# pylint: disable=invalid-overridden-method
|
||||||
|
|
||||||
@esphome_state_property
|
@esphome_state_property
|
||||||
def is_closed(self) -> Optional[bool]:
|
def is_closed(self) -> Optional[bool]:
|
||||||
"""Return if the cover is closed or not."""
|
"""Return if the cover is closed or not."""
|
||||||
|
|
|
@ -92,6 +92,9 @@ class EsphomeFan(EsphomeEntity, FanEntity):
|
||||||
key=self._static_info.key, oscillating=oscillating
|
key=self._static_info.key, oscillating=oscillating
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# https://github.com/PyCQA/pylint/issues/3150 for all @esphome_state_property
|
||||||
|
# pylint: disable=invalid-overridden-method
|
||||||
|
|
||||||
@esphome_state_property
|
@esphome_state_property
|
||||||
def is_on(self) -> Optional[bool]:
|
def is_on(self) -> Optional[bool]:
|
||||||
"""Return true if the entity is on."""
|
"""Return true if the entity is on."""
|
||||||
|
|
|
@ -61,6 +61,9 @@ class EsphomeLight(EsphomeEntity, Light):
|
||||||
def _state(self) -> Optional[LightState]:
|
def _state(self) -> Optional[LightState]:
|
||||||
return super()._state
|
return super()._state
|
||||||
|
|
||||||
|
# https://github.com/PyCQA/pylint/issues/3150 for all @esphome_state_property
|
||||||
|
# pylint: disable=invalid-overridden-method
|
||||||
|
|
||||||
@esphome_state_property
|
@esphome_state_property
|
||||||
def is_on(self) -> Optional[bool]:
|
def is_on(self) -> Optional[bool]:
|
||||||
"""Return true if the switch is on."""
|
"""Return true if the switch is on."""
|
||||||
|
|
|
@ -37,6 +37,10 @@ async def async_setup_entry(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
# https://github.com/PyCQA/pylint/issues/3150 for all @esphome_state_property
|
||||||
|
# pylint: disable=invalid-overridden-method
|
||||||
|
|
||||||
|
|
||||||
class EsphomeSensor(EsphomeEntity):
|
class EsphomeSensor(EsphomeEntity):
|
||||||
"""A sensor implementation for esphome."""
|
"""A sensor implementation for esphome."""
|
||||||
|
|
||||||
|
|
|
@ -49,6 +49,8 @@ class EsphomeSwitch(EsphomeEntity, SwitchDevice):
|
||||||
"""Return true if we do optimistic updates."""
|
"""Return true if we do optimistic updates."""
|
||||||
return self._static_info.assumed_state
|
return self._static_info.assumed_state
|
||||||
|
|
||||||
|
# https://github.com/PyCQA/pylint/issues/3150 for @esphome_state_property
|
||||||
|
# pylint: disable=invalid-overridden-method
|
||||||
@esphome_state_property
|
@esphome_state_property
|
||||||
def is_on(self) -> Optional[bool]:
|
def is_on(self) -> Optional[bool]:
|
||||||
"""Return true if the switch is on."""
|
"""Return true if the switch is on."""
|
||||||
|
|
|
@ -122,7 +122,7 @@ class HomekitControllerFlowHandler(config_entries.ConfigFlow):
|
||||||
|
|
||||||
_LOGGER.debug("Discovered device %s (%s - %s)", name, model, hkid)
|
_LOGGER.debug("Discovered device %s (%s - %s)", name, model, hkid)
|
||||||
|
|
||||||
# pylint: disable=unsupported-assignment-operation
|
# pylint: disable=no-member # https://github.com/PyCQA/pylint/issues/3167
|
||||||
self.context["hkid"] = hkid
|
self.context["hkid"] = hkid
|
||||||
self.context["title_placeholders"] = {"name": name}
|
self.context["title_placeholders"] = {"name": name}
|
||||||
|
|
||||||
|
|
|
@ -50,6 +50,8 @@ class HueFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
VERSION = 1
|
VERSION = 1
|
||||||
CONNECTION_CLASS = config_entries.CONN_CLASS_LOCAL_POLL
|
CONNECTION_CLASS = config_entries.CONN_CLASS_LOCAL_POLL
|
||||||
|
|
||||||
|
# pylint: disable=no-member # https://github.com/PyCQA/pylint/issues/3167
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
"""Initialize the Hue flow."""
|
"""Initialize the Hue flow."""
|
||||||
self.host = None
|
self.host = None
|
||||||
|
|
|
@ -776,7 +776,9 @@ class MQTT:
|
||||||
self._mqttc.on_message = self._mqtt_on_message
|
self._mqttc.on_message = self._mqtt_on_message
|
||||||
|
|
||||||
if will_message is not None:
|
if will_message is not None:
|
||||||
self._mqttc.will_set(*attr.astuple(will_message))
|
self._mqttc.will_set( # pylint: disable=no-value-for-parameter
|
||||||
|
*attr.astuple(will_message)
|
||||||
|
)
|
||||||
|
|
||||||
async def async_publish(
|
async def async_publish(
|
||||||
self, topic: str, payload: PublishPayloadType, qos: int, retain: bool
|
self, topic: str, payload: PublishPayloadType, qos: int, retain: bool
|
||||||
|
@ -909,7 +911,11 @@ class MQTT:
|
||||||
self.hass.add_job(self._async_perform_subscription, topic, max_qos)
|
self.hass.add_job(self._async_perform_subscription, topic, max_qos)
|
||||||
|
|
||||||
if self.birth_message:
|
if self.birth_message:
|
||||||
self.hass.add_job(self.async_publish(*attr.astuple(self.birth_message)))
|
self.hass.add_job(
|
||||||
|
self.async_publish( # pylint: disable=no-value-for-parameter
|
||||||
|
*attr.astuple(self.birth_message)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
def _mqtt_on_message(self, _mqttc, _userdata, msg) -> None:
|
def _mqtt_on_message(self, _mqttc, _userdata, msg) -> None:
|
||||||
"""Message received callback."""
|
"""Message received callback."""
|
||||||
|
|
|
@ -264,7 +264,7 @@ class OnkyoDevice(MediaPlayerDevice):
|
||||||
if source in self._source_mapping:
|
if source in self._source_mapping:
|
||||||
self._current_source = self._source_mapping[source]
|
self._current_source = self._source_mapping[source]
|
||||||
break
|
break
|
||||||
self._current_source = "_".join([i for i in current_source_tuples[1]])
|
self._current_source = "_".join(current_source_tuples[1])
|
||||||
if preset_raw and self._current_source.lower() == "radio":
|
if preset_raw and self._current_source.lower() == "radio":
|
||||||
self._attributes[ATTR_PRESET] = preset_raw[1]
|
self._attributes[ATTR_PRESET] = preset_raw[1]
|
||||||
elif ATTR_PRESET in self._attributes:
|
elif ATTR_PRESET in self._attributes:
|
||||||
|
@ -413,7 +413,7 @@ class OnkyoDeviceZone(OnkyoDevice):
|
||||||
if source in self._source_mapping:
|
if source in self._source_mapping:
|
||||||
self._current_source = self._source_mapping[source]
|
self._current_source = self._source_mapping[source]
|
||||||
break
|
break
|
||||||
self._current_source = "_".join([i for i in current_source_tuples[1]])
|
self._current_source = "_".join(current_source_tuples[1])
|
||||||
self._muted = bool(mute_raw[1] == "on")
|
self._muted = bool(mute_raw[1] == "on")
|
||||||
if preset_raw and self._current_source.lower() == "radio":
|
if preset_raw and self._current_source.lower() == "radio":
|
||||||
self._attributes[ATTR_PRESET] = preset_raw[1]
|
self._attributes[ATTR_PRESET] = preset_raw[1]
|
||||||
|
|
|
@ -157,7 +157,7 @@ class RMVDepartureSensor(Entity):
|
||||||
"""Return the state attributes."""
|
"""Return the state attributes."""
|
||||||
try:
|
try:
|
||||||
return {
|
return {
|
||||||
"next_departures": [val for val in self.data.departures[1:]],
|
"next_departures": self.data.departures[1:],
|
||||||
"direction": self.data.departures[0].get("direction"),
|
"direction": self.data.departures[0].get("direction"),
|
||||||
"line": self.data.departures[0].get("line"),
|
"line": self.data.departures[0].get("line"),
|
||||||
"minutes": self.data.departures[0].get("minutes"),
|
"minutes": self.data.departures[0].get("minutes"),
|
||||||
|
|
|
@ -49,6 +49,7 @@ class SabnzbdSensor(Entity):
|
||||||
"""Return the state of the sensor."""
|
"""Return the state of the sensor."""
|
||||||
return self._state
|
return self._state
|
||||||
|
|
||||||
|
@property
|
||||||
def should_poll(self):
|
def should_poll(self):
|
||||||
"""Don't poll. Will be updated by dispatcher signal."""
|
"""Don't poll. Will be updated by dispatcher signal."""
|
||||||
return False
|
return False
|
||||||
|
|
|
@ -105,6 +105,7 @@ class SynologyCamera(Camera):
|
||||||
"""Return true if the device is recording."""
|
"""Return true if the device is recording."""
|
||||||
return self._camera.is_recording
|
return self._camera.is_recording
|
||||||
|
|
||||||
|
@property
|
||||||
def should_poll(self):
|
def should_poll(self):
|
||||||
"""Update the recording state periodically."""
|
"""Update the recording state periodically."""
|
||||||
return True
|
return True
|
||||||
|
|
|
@ -102,7 +102,7 @@ class TplinkDeviceScanner(DeviceScanner):
|
||||||
|
|
||||||
self.success_init = self._update_info()
|
self.success_init = self._update_info()
|
||||||
except requests.exceptions.RequestException:
|
except requests.exceptions.RequestException:
|
||||||
_LOGGER.debug("RequestException in %s", __class__.__name__)
|
_LOGGER.debug("RequestException in %s", self.__class__.__name__)
|
||||||
|
|
||||||
def scan_devices(self):
|
def scan_devices(self):
|
||||||
"""Scan for new devices and return a list with found device IDs."""
|
"""Scan for new devices and return a list with found device IDs."""
|
||||||
|
@ -150,7 +150,7 @@ class Tplink1DeviceScanner(DeviceScanner):
|
||||||
try:
|
try:
|
||||||
self.success_init = self._update_info()
|
self.success_init = self._update_info()
|
||||||
except requests.exceptions.RequestException:
|
except requests.exceptions.RequestException:
|
||||||
_LOGGER.debug("RequestException in %s", __class__.__name__)
|
_LOGGER.debug("RequestException in %s", self.__class__.__name__)
|
||||||
|
|
||||||
def scan_devices(self):
|
def scan_devices(self):
|
||||||
"""Scan for new devices and return a list with found device IDs."""
|
"""Scan for new devices and return a list with found device IDs."""
|
||||||
|
|
|
@ -83,7 +83,7 @@ class FlowHandler(config_entries.ConfigFlow):
|
||||||
"""Handle zeroconf discovery."""
|
"""Handle zeroconf discovery."""
|
||||||
host = user_input["host"]
|
host = user_input["host"]
|
||||||
|
|
||||||
# pylint: disable=unsupported-assignment-operation
|
# pylint: disable=no-member # https://github.com/PyCQA/pylint/issues/3167
|
||||||
self.context["host"] = host
|
self.context["host"] = host
|
||||||
|
|
||||||
if any(host == flow["context"]["host"] for flow in self._async_in_progress()):
|
if any(host == flow["context"]["host"] for flow in self._async_in_progress()):
|
||||||
|
|
|
@ -164,7 +164,6 @@ class PerSecondUPnPIGDSensor(UpnpSensor):
|
||||||
"""Get unit we are measuring in."""
|
"""Get unit we are measuring in."""
|
||||||
raise NotImplementedError()
|
raise NotImplementedError()
|
||||||
|
|
||||||
@property
|
|
||||||
def _async_fetch_value(self):
|
def _async_fetch_value(self):
|
||||||
"""Fetch a value from the IGD."""
|
"""Fetch a value from the IGD."""
|
||||||
raise NotImplementedError()
|
raise NotImplementedError()
|
||||||
|
|
|
@ -6,7 +6,7 @@ import logging
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components import group
|
from homeassistant.components import group
|
||||||
from homeassistant.const import (
|
from homeassistant.const import ( # noqa: F401 # STATE_PAUSED/IDLE are API
|
||||||
ATTR_BATTERY_LEVEL,
|
ATTR_BATTERY_LEVEL,
|
||||||
ATTR_COMMAND,
|
ATTR_COMMAND,
|
||||||
SERVICE_TOGGLE,
|
SERVICE_TOGGLE,
|
||||||
|
@ -68,8 +68,6 @@ VACUUM_SEND_COMMAND_SERVICE_SCHEMA = ENTITY_SERVICE_SCHEMA.extend(
|
||||||
|
|
||||||
STATE_CLEANING = "cleaning"
|
STATE_CLEANING = "cleaning"
|
||||||
STATE_DOCKED = "docked"
|
STATE_DOCKED = "docked"
|
||||||
STATE_IDLE = STATE_IDLE
|
|
||||||
STATE_PAUSED = STATE_PAUSED
|
|
||||||
STATE_RETURNING = "returning"
|
STATE_RETURNING = "returning"
|
||||||
STATE_ERROR = "error"
|
STATE_ERROR = "error"
|
||||||
|
|
||||||
|
|
|
@ -252,7 +252,7 @@ class ValloxServiceHandler:
|
||||||
async def async_handle(self, service):
|
async def async_handle(self, service):
|
||||||
"""Dispatch a service call."""
|
"""Dispatch a service call."""
|
||||||
method = SERVICE_TO_METHOD.get(service.service)
|
method = SERVICE_TO_METHOD.get(service.service)
|
||||||
params = {key: value for key, value in service.data.items()}
|
params = service.data.copy()
|
||||||
|
|
||||||
if not hasattr(self, method["method"]):
|
if not hasattr(self, method["method"]):
|
||||||
_LOGGER.error("Service not implemented: %s", method["method"])
|
_LOGGER.error("Service not implemented: %s", method["method"])
|
||||||
|
|
|
@ -283,10 +283,6 @@ class WinkThermostat(WinkDevice, ClimateDevice):
|
||||||
target_temp_high = target_temp
|
target_temp_high = target_temp
|
||||||
if self.hvac_mode == HVAC_MODE_HEAT:
|
if self.hvac_mode == HVAC_MODE_HEAT:
|
||||||
target_temp_low = target_temp
|
target_temp_low = target_temp
|
||||||
if target_temp_low is not None:
|
|
||||||
target_temp_low = target_temp_low
|
|
||||||
if target_temp_high is not None:
|
|
||||||
target_temp_high = target_temp_high
|
|
||||||
self.wink.set_temperature(target_temp_low, target_temp_high)
|
self.wink.set_temperature(target_temp_low, target_temp_high)
|
||||||
|
|
||||||
def set_hvac_mode(self, hvac_mode):
|
def set_hvac_mode(self, hvac_mode):
|
||||||
|
|
|
@ -348,7 +348,6 @@ class ZHADevice(LogMixin):
|
||||||
zdo_task = None
|
zdo_task = None
|
||||||
for channel in channels:
|
for channel in channels:
|
||||||
if channel.name == CHANNEL_ZDO:
|
if channel.name == CHANNEL_ZDO:
|
||||||
# pylint: disable=E1111
|
|
||||||
if zdo_task is None: # We only want to do this once
|
if zdo_task is None: # We only want to do this once
|
||||||
zdo_task = self._async_create_task(
|
zdo_task = self._async_create_task(
|
||||||
semaphore, channel, task_name, *args
|
semaphore, channel, task_name, *args
|
||||||
|
@ -373,8 +372,7 @@ class ZHADevice(LogMixin):
|
||||||
@callback
|
@callback
|
||||||
def async_unsub_dispatcher(self):
|
def async_unsub_dispatcher(self):
|
||||||
"""Unsubscribe the dispatcher."""
|
"""Unsubscribe the dispatcher."""
|
||||||
if self._unsub:
|
self._unsub()
|
||||||
self._unsub()
|
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def async_update_last_seen(self, last_seen):
|
def async_update_last_seen(self, last_seen):
|
||||||
|
|
|
@ -43,7 +43,7 @@ SPEED_LIST = [
|
||||||
SPEED_SMART,
|
SPEED_SMART,
|
||||||
]
|
]
|
||||||
|
|
||||||
VALUE_TO_SPEED = {i: speed for i, speed in enumerate(SPEED_LIST)}
|
VALUE_TO_SPEED = dict(enumerate(SPEED_LIST))
|
||||||
SPEED_TO_VALUE = {speed: i for i, speed in enumerate(SPEED_LIST)}
|
SPEED_TO_VALUE = {speed: i for i, speed in enumerate(SPEED_LIST)}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ _LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
STATE_LIST = [STATE_UNLOCKED, STATE_LOCKED, STATE_UNLOCKED]
|
STATE_LIST = [STATE_UNLOCKED, STATE_LOCKED, STATE_UNLOCKED]
|
||||||
|
|
||||||
VALUE_TO_STATE = {i: state for i, state in enumerate(STATE_LIST)}
|
VALUE_TO_STATE = dict(enumerate(STATE_LIST))
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
|
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
|
||||||
|
|
|
@ -186,7 +186,9 @@ class HomeAssistant:
|
||||||
self.data: dict = {}
|
self.data: dict = {}
|
||||||
self.state = CoreState.not_running
|
self.state = CoreState.not_running
|
||||||
self.exit_code = 0
|
self.exit_code = 0
|
||||||
self.config_entries: Optional[ConfigEntries] = None
|
self.config_entries: Optional[
|
||||||
|
ConfigEntries # pylint: disable=used-before-assignment
|
||||||
|
] = None
|
||||||
# If not None, use to signal end-of-loop
|
# If not None, use to signal end-of-loop
|
||||||
self._stopped: Optional[asyncio.Event] = None
|
self._stopped: Optional[asyncio.Event] = None
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ class DiscoveryFlowHandler(config_entries.ConfigFlow):
|
||||||
if user_input is None:
|
if user_input is None:
|
||||||
return self.async_show_form(step_id="confirm")
|
return self.async_show_form(step_id="confirm")
|
||||||
|
|
||||||
if (
|
if ( # pylint: disable=no-member # https://github.com/PyCQA/pylint/issues/3167
|
||||||
self.context
|
self.context
|
||||||
and self.context.get("source") != config_entries.SOURCE_DISCOVERY
|
and self.context.get("source") != config_entries.SOURCE_DISCOVERY
|
||||||
):
|
):
|
||||||
|
|
|
@ -167,8 +167,8 @@ COLORS = {
|
||||||
class XYPoint:
|
class XYPoint:
|
||||||
"""Represents a CIE 1931 XY coordinate pair."""
|
"""Represents a CIE 1931 XY coordinate pair."""
|
||||||
|
|
||||||
x = attr.ib(type=float)
|
x = attr.ib(type=float) # pylint: disable=invalid-name
|
||||||
y = attr.ib(type=float)
|
y = attr.ib(type=float) # pylint: disable=invalid-name
|
||||||
|
|
||||||
|
|
||||||
@attr.s()
|
@attr.s()
|
||||||
|
|
|
@ -220,7 +220,7 @@ def get_age(date: dt.datetime) -> str:
|
||||||
def parse_time_expression(parameter: Any, min_value: int, max_value: int) -> List[int]:
|
def parse_time_expression(parameter: Any, min_value: int, max_value: int) -> List[int]:
|
||||||
"""Parse the time expression part and return a list of times to match."""
|
"""Parse the time expression part and return a list of times to match."""
|
||||||
if parameter is None or parameter == MATCH_ALL:
|
if parameter is None or parameter == MATCH_ALL:
|
||||||
res = [x for x in range(min_value, max_value + 1)]
|
res = list(range(min_value, max_value + 1))
|
||||||
elif isinstance(parameter, str) and parameter.startswith("/"):
|
elif isinstance(parameter, str) and parameter.startswith("/"):
|
||||||
parameter = int(parameter[1:])
|
parameter = int(parameter[1:])
|
||||||
res = [x for x in range(min_value, max_value + 1) if x % parameter == 0]
|
res = [x for x in range(min_value, max_value + 1) if x % parameter == 0]
|
||||||
|
|
6
pylintrc
6
pylintrc
|
@ -2,7 +2,7 @@
|
||||||
ignore=tests
|
ignore=tests
|
||||||
|
|
||||||
[BASIC]
|
[BASIC]
|
||||||
good-names=i,j,k,ex,Run,_,fp
|
good-names=id,i,j,k,ex,Run,_,fp
|
||||||
|
|
||||||
[MESSAGES CONTROL]
|
[MESSAGES CONTROL]
|
||||||
# Reasons disabled:
|
# Reasons disabled:
|
||||||
|
@ -18,8 +18,8 @@ good-names=i,j,k,ex,Run,_,fp
|
||||||
# too-few-* - same as too-many-*
|
# too-few-* - same as too-many-*
|
||||||
# abstract-method - with intro of async there are always methods missing
|
# abstract-method - with intro of async there are always methods missing
|
||||||
# inconsistent-return-statements - doesn't handle raise
|
# inconsistent-return-statements - doesn't handle raise
|
||||||
# not-an-iterable - https://github.com/PyCQA/pylint/issues/2311
|
|
||||||
# unnecessary-pass - readability for functions which only contain pass
|
# unnecessary-pass - readability for functions which only contain pass
|
||||||
|
# import-outside-toplevel - TODO
|
||||||
disable=
|
disable=
|
||||||
format,
|
format,
|
||||||
abstract-class-little-used,
|
abstract-class-little-used,
|
||||||
|
@ -27,9 +27,9 @@ disable=
|
||||||
cyclic-import,
|
cyclic-import,
|
||||||
duplicate-code,
|
duplicate-code,
|
||||||
global-statement,
|
global-statement,
|
||||||
|
import-outside-toplevel,
|
||||||
inconsistent-return-statements,
|
inconsistent-return-statements,
|
||||||
locally-disabled,
|
locally-disabled,
|
||||||
not-an-iterable,
|
|
||||||
not-context-manager,
|
not-context-manager,
|
||||||
redefined-variable-type,
|
redefined-variable-type,
|
||||||
too-few-public-methods,
|
too-few-public-methods,
|
||||||
|
|
|
@ -12,8 +12,8 @@ mock-open==1.3.1
|
||||||
mypy==0.730
|
mypy==0.730
|
||||||
pre-commit==1.18.3
|
pre-commit==1.18.3
|
||||||
pydocstyle==4.0.1
|
pydocstyle==4.0.1
|
||||||
pylint==2.3.1
|
pylint==2.4.2
|
||||||
astroid==2.2.5
|
astroid==2.3.1
|
||||||
pytest-aiohttp==0.3.0
|
pytest-aiohttp==0.3.0
|
||||||
pytest-cov==2.7.1
|
pytest-cov==2.7.1
|
||||||
pytest-sugar==0.9.2
|
pytest-sugar==0.9.2
|
||||||
|
|
|
@ -13,8 +13,8 @@ mock-open==1.3.1
|
||||||
mypy==0.730
|
mypy==0.730
|
||||||
pre-commit==1.18.3
|
pre-commit==1.18.3
|
||||||
pydocstyle==4.0.1
|
pydocstyle==4.0.1
|
||||||
pylint==2.3.1
|
pylint==2.4.2
|
||||||
astroid==2.2.5
|
astroid==2.3.1
|
||||||
pytest-aiohttp==0.3.0
|
pytest-aiohttp==0.3.0
|
||||||
pytest-cov==2.7.1
|
pytest-cov==2.7.1
|
||||||
pytest-sugar==0.9.2
|
pytest-sugar==0.9.2
|
||||||
|
|
Loading…
Reference in New Issue