Upgrade pylint to 2.12.1 (#60375)

This commit is contained in:
Marc Mueller 2021-11-26 00:13:27 +01:00 committed by GitHub
parent dab2b17a17
commit 25f8d4a189
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 36 additions and 32 deletions

View file

@ -211,7 +211,7 @@ class Alert(ToggleEntity):
) )
@property @property
def state(self): def state(self): # pylint: disable=overridden-final-method
"""Return the alert status.""" """Return the alert status."""
if self._firing: if self._firing:
if self._ack: if self._ack:

View file

@ -39,7 +39,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
class BloomSkySensor(BinarySensorEntity): class BloomSkySensor(BinarySensorEntity):
"""Representation of a single binary sensor in a BloomSky device.""" """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.""" """Initialize a BloomSky binary sensor."""
self._bloomsky = bs self._bloomsky = bs
self._device_id = device["DeviceID"] self._device_id = device["DeviceID"]

View file

@ -79,7 +79,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
class BloomSkySensor(SensorEntity): class BloomSkySensor(SensorEntity):
"""Representation of a single sensor in a BloomSky device.""" """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.""" """Initialize a BloomSky sensor."""
self._bloomsky = bs self._bloomsky = bs
self._device_id = device["DeviceID"] self._device_id = device["DeviceID"]

View file

@ -103,7 +103,7 @@ class DemoLight(LightEntity):
state, state,
available=False, available=False,
brightness=180, brightness=180,
ct=None, ct=None, # pylint: disable=invalid-name
effect_list=None, effect_list=None,
effect=None, effect=None,
hs_color=None, hs_color=None,

View file

@ -83,7 +83,6 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
await self.async_set_unique_id(discovery_info[zeroconf.ATTR_PROPERTIES]["SN"]) await self.async_set_unique_id(discovery_info[zeroconf.ATTR_PROPERTIES]["SN"])
self._abort_if_unique_id_configured() 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[CONF_HOST] = discovery_info[zeroconf.ATTR_HOST]
self.context["title_placeholders"] = { self.context["title_placeholders"] = {
PRODUCT: discovery_info[zeroconf.ATTR_PROPERTIES]["Product"], PRODUCT: discovery_info[zeroconf.ATTR_PROPERTIES]["Product"],

View file

@ -62,7 +62,7 @@ _LOGGER = logging.getLogger(__name__)
class DhcpServiceInfo(BaseServiceInfo): class DhcpServiceInfo(BaseServiceInfo):
"""Prepared info from dhcp entries.""" """Prepared info from dhcp entries."""
ip: str # pylint: disable=invalid-name ip: str
hostname: str hostname: str
macaddress: str macaddress: str

View file

@ -54,7 +54,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
class DigitalOceanBinarySensor(BinarySensorEntity): class DigitalOceanBinarySensor(BinarySensorEntity):
"""Representation of a Digital Ocean droplet sensor.""" """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.""" """Initialize a new Digital Ocean sensor."""
self._digital_ocean = do self._digital_ocean = do
self._droplet_id = droplet_id self._droplet_id = droplet_id

View file

@ -51,7 +51,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
class DigitalOceanSwitch(SwitchEntity): class DigitalOceanSwitch(SwitchEntity):
"""Representation of a Digital Ocean droplet switch.""" """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.""" """Initialize a new Digital Ocean sensor."""
self._digital_ocean = do self._digital_ocean = do
self._droplet_id = droplet_id self._droplet_id = droplet_id

View file

@ -51,7 +51,7 @@ class LinodeBinarySensor(BinarySensorEntity):
_attr_device_class = DEVICE_CLASS_MOVING _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.""" """Initialize a new Linode sensor."""
self._linode = li self._linode = li
self._node_id = node_id self._node_id = node_id

View file

@ -46,7 +46,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
class LinodeSwitch(SwitchEntity): class LinodeSwitch(SwitchEntity):
"""Representation of a Linode Node switch.""" """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.""" """Initialize a new Linode sensor."""
self._linode = li self._linode = li
self._node_id = node_id self._node_id = node_id

View file

@ -34,7 +34,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
class LiteJetLight(LightEntity): class LiteJetLight(LightEntity):
"""Representation of a single LiteJet light.""" """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.""" """Initialize a LiteJet light."""
self._config_entry = config_entry self._config_entry = config_entry
self._lj = lj self._lj = lj

View file

@ -26,7 +26,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
class LiteJetScene(Scene): class LiteJetScene(Scene):
"""Representation of a single LiteJet 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.""" """Initialize the scene."""
self._entry_id = entry_id self._entry_id = entry_id
self._lj = lj self._lj = lj

View file

@ -28,7 +28,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
class LiteJetSwitch(SwitchEntity): class LiteJetSwitch(SwitchEntity):
"""Representation of a single LiteJet switch.""" """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.""" """Initialize a LiteJet switch."""
self._entry_id = entry_id self._entry_id = entry_id
self._lj = lj self._lj = lj

View file

@ -94,10 +94,10 @@ class AirSensor(SensorEntity):
ICON = "mdi:cloud-outline" ICON = "mdi:cloud-outline"
def __init__(self, name, APIdata): def __init__(self, name, api_data):
"""Initialize the sensor.""" """Initialize the sensor."""
self._name = name self._name = name
self._api_data = APIdata self._api_data = api_data
self._site_data = None self._site_data = None
self._state = None self._state = None
self._updated = None self._updated = None

View file

@ -41,7 +41,7 @@ def get_service(hass, config, discovery_info=None):
class PushBulletNotificationService(BaseNotificationService): class PushBulletNotificationService(BaseNotificationService):
"""Implement the notification service for Pushbullet.""" """Implement the notification service for Pushbullet."""
def __init__(self, pb): def __init__(self, pb): # pylint: disable=invalid-name
"""Initialize the service.""" """Initialize the service."""
self.pushbullet = pb self.pushbullet = pb
self.pbtargets = {} self.pbtargets = {}

View file

@ -95,7 +95,11 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
class PushBulletNotificationSensor(SensorEntity): class PushBulletNotificationSensor(SensorEntity):
"""Representation of a Pushbullet Sensor.""" """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.""" """Initialize the Pushbullet sensor."""
self.entity_description = description self.entity_description = description
self.pushbullet = pb self.pushbullet = pb
@ -118,10 +122,10 @@ class PushBulletNotificationSensor(SensorEntity):
class PushBulletNotificationProvider: class PushBulletNotificationProvider:
"""Provider for an account, leading to one or more sensors.""" """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.""" """Start to retrieve pushes from the given Pushbullet instance."""
self.pushbullet = pb self.pushbullet = pushbullet
self._data = None self._data = None
self.listener = None self.listener = None
self.thread = threading.Thread(target=self.retrieve_pushes) self.thread = threading.Thread(target=self.retrieve_pushes)

View file

@ -58,12 +58,12 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
class ParticulateMatterSensor(SensorEntity): class ParticulateMatterSensor(SensorEntity):
"""Representation of an Particulate matter sensor.""" """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.""" """Initialize a new PM sensor."""
self._name = name self._name = name
self._pmname = pmname self._pmname = pmname
self._state = None self._state = None
self._collector = pmDataCollector self._collector = pm_data_collector
@property @property
def name(self): def name(self):

View file

@ -234,7 +234,7 @@ class SpotifyMediaPlayer(MediaPlayerEntity):
self, self,
session: OAuth2Session, session: OAuth2Session,
spotify: Spotify, spotify: Spotify,
me: dict, me: dict, # pylint: disable=invalid-name
user_id: str, user_id: str,
name: str, name: str,
) -> None: ) -> None:

View file

@ -1,9 +1,9 @@
"""Support for Xiaomi Miio binary sensors.""" """Support for Xiaomi Miio binary sensors."""
from __future__ import annotations from __future__ import annotations
from collections.abc import Callable
from dataclasses import dataclass from dataclasses import dataclass
import logging import logging
from typing import Callable
from homeassistant.components.binary_sensor import ( from homeassistant.components.binary_sensor import (
DEVICE_CLASS_CONNECTIVITY, DEVICE_CLASS_CONNECTIVITY,

View file

@ -79,10 +79,10 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
class ZabbixTriggerCountSensor(SensorEntity): class ZabbixTriggerCountSensor(SensorEntity):
"""Get the active trigger count for all Zabbix monitored hosts.""" """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.""" """Initialize Zabbix sensor."""
self._name = name self._name = name
self._zapi = zApi self._zapi = zapi
self._state = None self._state = None
self._attributes = {} self._attributes = {}
@ -121,9 +121,9 @@ class ZabbixTriggerCountSensor(SensorEntity):
class ZabbixSingleHostTriggerCountSensor(ZabbixTriggerCountSensor): class ZabbixSingleHostTriggerCountSensor(ZabbixTriggerCountSensor):
"""Get the active trigger count for a single Zabbix monitored host.""" """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.""" """Initialize Zabbix sensor."""
super().__init__(zApi, name) super().__init__(zapi, name)
self._hostid = hostid self._hostid = hostid
if not name: if not name:
self._name = self._zapi.host.get(hostids=self._hostid, output="extend")[0][ self._name = self._zapi.host.get(hostids=self._hostid, output="extend")[0][
@ -145,9 +145,9 @@ class ZabbixSingleHostTriggerCountSensor(ZabbixTriggerCountSensor):
class ZabbixMultipleHostTriggerCountSensor(ZabbixTriggerCountSensor): class ZabbixMultipleHostTriggerCountSensor(ZabbixTriggerCountSensor):
"""Get the active trigger count for specified Zabbix monitored hosts.""" """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.""" """Initialize Zabbix sensor."""
super().__init__(zApi, name) super().__init__(zapi, name)
self._hostids = hostids self._hostids = hostids
if not name: if not name:
host_names = self._zapi.host.get(hostids=self._hostids, output="extend") host_names = self._zapi.host.get(hostids=self._hostids, output="extend")

View file

@ -56,7 +56,7 @@ from .const import (
DOMAIN, DOMAIN,
) )
from .discovery_schemas import DISCOVERY_SCHEMAS 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_add_migration_entity_value,
async_get_migration_data, async_get_migration_data,
async_is_ozw_migrated, async_is_ozw_migrated,

View file

@ -444,7 +444,6 @@ class FanSpeedDataTemplate:
Empty lists are not permissible. Empty lists are not permissible.
""" """
# pylint: disable=no-self-use
raise NotImplementedError raise NotImplementedError

View file

@ -54,6 +54,7 @@ good-names = [
"k", "k",
"Run", "Run",
"T", "T",
"ip",
] ]
[tool.pylint."MESSAGES CONTROL"] [tool.pylint."MESSAGES CONTROL"]
@ -113,6 +114,7 @@ score = false
ignored-classes = [ ignored-classes = [
"_CountingAttr", # for attrs "_CountingAttr", # for attrs
] ]
mixin-class-rgx = ".*[Mm]ix[Ii]n"
[tool.pylint.FORMAT] [tool.pylint.FORMAT]
expected-line-ending-format = "LF" expected-line-ending-format = "LF"

View file

@ -14,7 +14,7 @@ jsonpickle==1.4.1
mock-open==1.4.0 mock-open==1.4.0
mypy==0.910 mypy==0.910
pre-commit==2.15.0 pre-commit==2.15.0
pylint==2.11.1 pylint==2.12.1
pipdeptree==2.2.0 pipdeptree==2.2.0
pylint-strict-informational==0.1 pylint-strict-informational==0.1
pytest-aiohttp==0.3.0 pytest-aiohttp==0.3.0