diff --git a/homeassistant/components/alert/__init__.py b/homeassistant/components/alert/__init__.py index e72a1bcffa4..e5ee7ee6911 100644 --- a/homeassistant/components/alert/__init__.py +++ b/homeassistant/components/alert/__init__.py @@ -211,7 +211,7 @@ class Alert(ToggleEntity): ) @property - def state(self): + def state(self): # pylint: disable=overridden-final-method """Return the alert status.""" if self._firing: if self._ack: diff --git a/homeassistant/components/bloomsky/binary_sensor.py b/homeassistant/components/bloomsky/binary_sensor.py index 858c39c4db9..2ef4586f537 100644 --- a/homeassistant/components/bloomsky/binary_sensor.py +++ b/homeassistant/components/bloomsky/binary_sensor.py @@ -39,7 +39,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): class BloomSkySensor(BinarySensorEntity): """Representation of a single binary sensor in a BloomSky device.""" - def __init__(self, bs, device, sensor_name): + def __init__(self, bs, device, sensor_name): # pylint: disable=invalid-name """Initialize a BloomSky binary sensor.""" self._bloomsky = bs self._device_id = device["DeviceID"] diff --git a/homeassistant/components/bloomsky/sensor.py b/homeassistant/components/bloomsky/sensor.py index 288a1767c7e..9a14145d1d8 100644 --- a/homeassistant/components/bloomsky/sensor.py +++ b/homeassistant/components/bloomsky/sensor.py @@ -79,7 +79,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): class BloomSkySensor(SensorEntity): """Representation of a single sensor in a BloomSky device.""" - def __init__(self, bs, device, sensor_name): + def __init__(self, bs, device, sensor_name): # pylint: disable=invalid-name """Initialize a BloomSky sensor.""" self._bloomsky = bs self._device_id = device["DeviceID"] diff --git a/homeassistant/components/demo/light.py b/homeassistant/components/demo/light.py index 29e7e1395ee..d14f7ffba0e 100644 --- a/homeassistant/components/demo/light.py +++ b/homeassistant/components/demo/light.py @@ -103,7 +103,7 @@ class DemoLight(LightEntity): state, available=False, brightness=180, - ct=None, + ct=None, # pylint: disable=invalid-name effect_list=None, effect=None, hs_color=None, diff --git a/homeassistant/components/devolo_home_network/config_flow.py b/homeassistant/components/devolo_home_network/config_flow.py index c3e91a6ec65..05d88aa1045 100644 --- a/homeassistant/components/devolo_home_network/config_flow.py +++ b/homeassistant/components/devolo_home_network/config_flow.py @@ -83,7 +83,6 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): await self.async_set_unique_id(discovery_info[zeroconf.ATTR_PROPERTIES]["SN"]) self._abort_if_unique_id_configured() - # pylint: disable=no-member # https://github.com/PyCQA/pylint/issues/3167 self.context[CONF_HOST] = discovery_info[zeroconf.ATTR_HOST] self.context["title_placeholders"] = { PRODUCT: discovery_info[zeroconf.ATTR_PROPERTIES]["Product"], diff --git a/homeassistant/components/dhcp/__init__.py b/homeassistant/components/dhcp/__init__.py index a45de7b0c16..65f1759b54e 100644 --- a/homeassistant/components/dhcp/__init__.py +++ b/homeassistant/components/dhcp/__init__.py @@ -62,7 +62,7 @@ _LOGGER = logging.getLogger(__name__) class DhcpServiceInfo(BaseServiceInfo): """Prepared info from dhcp entries.""" - ip: str # pylint: disable=invalid-name + ip: str hostname: str macaddress: str diff --git a/homeassistant/components/digital_ocean/binary_sensor.py b/homeassistant/components/digital_ocean/binary_sensor.py index 172c50d20b2..af74e1ffb13 100644 --- a/homeassistant/components/digital_ocean/binary_sensor.py +++ b/homeassistant/components/digital_ocean/binary_sensor.py @@ -54,7 +54,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): class DigitalOceanBinarySensor(BinarySensorEntity): """Representation of a Digital Ocean droplet sensor.""" - def __init__(self, do, droplet_id): + def __init__(self, do, droplet_id): # pylint: disable=invalid-name """Initialize a new Digital Ocean sensor.""" self._digital_ocean = do self._droplet_id = droplet_id diff --git a/homeassistant/components/digital_ocean/switch.py b/homeassistant/components/digital_ocean/switch.py index b323d5be5b4..3ba60c4c457 100644 --- a/homeassistant/components/digital_ocean/switch.py +++ b/homeassistant/components/digital_ocean/switch.py @@ -51,7 +51,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): class DigitalOceanSwitch(SwitchEntity): """Representation of a Digital Ocean droplet switch.""" - def __init__(self, do, droplet_id): + def __init__(self, do, droplet_id): # pylint: disable=invalid-name """Initialize a new Digital Ocean sensor.""" self._digital_ocean = do self._droplet_id = droplet_id diff --git a/homeassistant/components/linode/binary_sensor.py b/homeassistant/components/linode/binary_sensor.py index 4f602f5b81a..9e482283042 100644 --- a/homeassistant/components/linode/binary_sensor.py +++ b/homeassistant/components/linode/binary_sensor.py @@ -51,7 +51,7 @@ class LinodeBinarySensor(BinarySensorEntity): _attr_device_class = DEVICE_CLASS_MOVING - def __init__(self, li, node_id): + def __init__(self, li, node_id): # pylint: disable=invalid-name """Initialize a new Linode sensor.""" self._linode = li self._node_id = node_id diff --git a/homeassistant/components/linode/switch.py b/homeassistant/components/linode/switch.py index a2a31ae62a8..cd2efe9c4da 100644 --- a/homeassistant/components/linode/switch.py +++ b/homeassistant/components/linode/switch.py @@ -46,7 +46,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): class LinodeSwitch(SwitchEntity): """Representation of a Linode Node switch.""" - def __init__(self, li, node_id): + def __init__(self, li, node_id): # pylint: disable=invalid-name """Initialize a new Linode sensor.""" self._linode = li self._node_id = node_id diff --git a/homeassistant/components/litejet/light.py b/homeassistant/components/litejet/light.py index 172e46c441a..742cc341754 100644 --- a/homeassistant/components/litejet/light.py +++ b/homeassistant/components/litejet/light.py @@ -34,7 +34,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities): class LiteJetLight(LightEntity): """Representation of a single LiteJet light.""" - def __init__(self, config_entry, lj, i, name): + def __init__(self, config_entry, lj, i, name): # pylint: disable=invalid-name """Initialize a LiteJet light.""" self._config_entry = config_entry self._lj = lj diff --git a/homeassistant/components/litejet/scene.py b/homeassistant/components/litejet/scene.py index 2f2ab244e1e..8b285d58ef1 100644 --- a/homeassistant/components/litejet/scene.py +++ b/homeassistant/components/litejet/scene.py @@ -26,7 +26,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities): class LiteJetScene(Scene): """Representation of a single LiteJet scene.""" - def __init__(self, entry_id, lj, i, name): + def __init__(self, entry_id, lj, i, name): # pylint: disable=invalid-name """Initialize the scene.""" self._entry_id = entry_id self._lj = lj diff --git a/homeassistant/components/litejet/switch.py b/homeassistant/components/litejet/switch.py index 343d8393f1c..0feabfbf864 100644 --- a/homeassistant/components/litejet/switch.py +++ b/homeassistant/components/litejet/switch.py @@ -28,7 +28,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities): class LiteJetSwitch(SwitchEntity): """Representation of a single LiteJet switch.""" - def __init__(self, entry_id, lj, i, name): + def __init__(self, entry_id, lj, i, name): # pylint: disable=invalid-name """Initialize a LiteJet switch.""" self._entry_id = entry_id self._lj = lj diff --git a/homeassistant/components/london_air/sensor.py b/homeassistant/components/london_air/sensor.py index 4c9e7a4c4fb..fb522054c5f 100644 --- a/homeassistant/components/london_air/sensor.py +++ b/homeassistant/components/london_air/sensor.py @@ -94,10 +94,10 @@ class AirSensor(SensorEntity): ICON = "mdi:cloud-outline" - def __init__(self, name, APIdata): + def __init__(self, name, api_data): """Initialize the sensor.""" self._name = name - self._api_data = APIdata + self._api_data = api_data self._site_data = None self._state = None self._updated = None diff --git a/homeassistant/components/pushbullet/notify.py b/homeassistant/components/pushbullet/notify.py index a64517d2f48..6f851f8000e 100644 --- a/homeassistant/components/pushbullet/notify.py +++ b/homeassistant/components/pushbullet/notify.py @@ -41,7 +41,7 @@ def get_service(hass, config, discovery_info=None): class PushBulletNotificationService(BaseNotificationService): """Implement the notification service for Pushbullet.""" - def __init__(self, pb): + def __init__(self, pb): # pylint: disable=invalid-name """Initialize the service.""" self.pushbullet = pb self.pbtargets = {} diff --git a/homeassistant/components/pushbullet/sensor.py b/homeassistant/components/pushbullet/sensor.py index f7c946a91d9..e58296e56fe 100644 --- a/homeassistant/components/pushbullet/sensor.py +++ b/homeassistant/components/pushbullet/sensor.py @@ -95,7 +95,11 @@ def setup_platform(hass, config, add_entities, discovery_info=None): class PushBulletNotificationSensor(SensorEntity): """Representation of a Pushbullet Sensor.""" - def __init__(self, pb, description: SensorEntityDescription): + def __init__( + self, + pb, # pylint: disable=invalid-name + description: SensorEntityDescription, + ): """Initialize the Pushbullet sensor.""" self.entity_description = description self.pushbullet = pb @@ -118,10 +122,10 @@ class PushBulletNotificationSensor(SensorEntity): class PushBulletNotificationProvider: """Provider for an account, leading to one or more sensors.""" - def __init__(self, pb): + def __init__(self, pushbullet): """Start to retrieve pushes from the given Pushbullet instance.""" - self.pushbullet = pb + self.pushbullet = pushbullet self._data = None self.listener = None self.thread = threading.Thread(target=self.retrieve_pushes) diff --git a/homeassistant/components/serial_pm/sensor.py b/homeassistant/components/serial_pm/sensor.py index 9332f268308..bffb052f653 100644 --- a/homeassistant/components/serial_pm/sensor.py +++ b/homeassistant/components/serial_pm/sensor.py @@ -58,12 +58,12 @@ def setup_platform(hass, config, add_entities, discovery_info=None): class ParticulateMatterSensor(SensorEntity): """Representation of an Particulate matter sensor.""" - def __init__(self, pmDataCollector, name, pmname): + def __init__(self, pm_data_collector, name, pmname): """Initialize a new PM sensor.""" self._name = name self._pmname = pmname self._state = None - self._collector = pmDataCollector + self._collector = pm_data_collector @property def name(self): diff --git a/homeassistant/components/spotify/media_player.py b/homeassistant/components/spotify/media_player.py index efb5e0f6b4a..7f4865c21aa 100644 --- a/homeassistant/components/spotify/media_player.py +++ b/homeassistant/components/spotify/media_player.py @@ -234,7 +234,7 @@ class SpotifyMediaPlayer(MediaPlayerEntity): self, session: OAuth2Session, spotify: Spotify, - me: dict, + me: dict, # pylint: disable=invalid-name user_id: str, name: str, ) -> None: diff --git a/homeassistant/components/xiaomi_miio/binary_sensor.py b/homeassistant/components/xiaomi_miio/binary_sensor.py index ef172bbbbc5..26fa82b7df2 100644 --- a/homeassistant/components/xiaomi_miio/binary_sensor.py +++ b/homeassistant/components/xiaomi_miio/binary_sensor.py @@ -1,9 +1,9 @@ """Support for Xiaomi Miio binary sensors.""" from __future__ import annotations +from collections.abc import Callable from dataclasses import dataclass import logging -from typing import Callable from homeassistant.components.binary_sensor import ( DEVICE_CLASS_CONNECTIVITY, diff --git a/homeassistant/components/zabbix/sensor.py b/homeassistant/components/zabbix/sensor.py index 1b3cf40eedd..36207842285 100644 --- a/homeassistant/components/zabbix/sensor.py +++ b/homeassistant/components/zabbix/sensor.py @@ -79,10 +79,10 @@ def setup_platform(hass, config, add_entities, discovery_info=None): class ZabbixTriggerCountSensor(SensorEntity): """Get the active trigger count for all Zabbix monitored hosts.""" - def __init__(self, zApi, name="Zabbix"): + def __init__(self, zapi, name="Zabbix"): """Initialize Zabbix sensor.""" self._name = name - self._zapi = zApi + self._zapi = zapi self._state = None self._attributes = {} @@ -121,9 +121,9 @@ class ZabbixTriggerCountSensor(SensorEntity): class ZabbixSingleHostTriggerCountSensor(ZabbixTriggerCountSensor): """Get the active trigger count for a single Zabbix monitored host.""" - def __init__(self, zApi, hostid, name=None): + def __init__(self, zapi, hostid, name=None): """Initialize Zabbix sensor.""" - super().__init__(zApi, name) + super().__init__(zapi, name) self._hostid = hostid if not name: self._name = self._zapi.host.get(hostids=self._hostid, output="extend")[0][ @@ -145,9 +145,9 @@ class ZabbixSingleHostTriggerCountSensor(ZabbixTriggerCountSensor): class ZabbixMultipleHostTriggerCountSensor(ZabbixTriggerCountSensor): """Get the active trigger count for specified Zabbix monitored hosts.""" - def __init__(self, zApi, hostids, name=None): + def __init__(self, zapi, hostids, name=None): """Initialize Zabbix sensor.""" - super().__init__(zApi, name) + super().__init__(zapi, name) self._hostids = hostids if not name: host_names = self._zapi.host.get(hostids=self._hostids, output="extend") diff --git a/homeassistant/components/zwave/__init__.py b/homeassistant/components/zwave/__init__.py index b5a77c82050..ef3ab223248 100644 --- a/homeassistant/components/zwave/__init__.py +++ b/homeassistant/components/zwave/__init__.py @@ -56,7 +56,7 @@ from .const import ( DOMAIN, ) from .discovery_schemas import DISCOVERY_SCHEMAS -from .migration import ( # noqa: F401 pylint: disable=unused-import +from .migration import ( # noqa: F401 async_add_migration_entity_value, async_get_migration_data, async_is_ozw_migrated, diff --git a/homeassistant/components/zwave_js/discovery_data_template.py b/homeassistant/components/zwave_js/discovery_data_template.py index 77dd6de6ce3..3c5ef220ae9 100644 --- a/homeassistant/components/zwave_js/discovery_data_template.py +++ b/homeassistant/components/zwave_js/discovery_data_template.py @@ -444,7 +444,6 @@ class FanSpeedDataTemplate: Empty lists are not permissible. """ - # pylint: disable=no-self-use raise NotImplementedError diff --git a/pyproject.toml b/pyproject.toml index 32c87227940..d5be195d2b2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -54,6 +54,7 @@ good-names = [ "k", "Run", "T", + "ip", ] [tool.pylint."MESSAGES CONTROL"] @@ -113,6 +114,7 @@ score = false ignored-classes = [ "_CountingAttr", # for attrs ] +mixin-class-rgx = ".*[Mm]ix[Ii]n" [tool.pylint.FORMAT] expected-line-ending-format = "LF" diff --git a/requirements_test.txt b/requirements_test.txt index 7f7e36ac8d9..4e08d5b320f 100644 --- a/requirements_test.txt +++ b/requirements_test.txt @@ -14,7 +14,7 @@ jsonpickle==1.4.1 mock-open==1.4.0 mypy==0.910 pre-commit==2.15.0 -pylint==2.11.1 +pylint==2.12.1 pipdeptree==2.2.0 pylint-strict-informational==0.1 pytest-aiohttp==0.3.0