Skip to content

Commit

Permalink
Upgrade pylint to 2.12.1 (home-assistant#60375)
Browse files Browse the repository at this point in the history
  • Loading branch information
cdce8p authored Nov 25, 2021
1 parent dab2b17 commit 25f8d4a
Show file tree
Hide file tree
Showing 24 changed files with 36 additions and 32 deletions.
2 changes: 1 addition & 1 deletion homeassistant/components/alert/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ def __init__(
)

@property
def state(self):
def state(self): # pylint: disable=overridden-final-method
"""Return the alert status."""
if self._firing:
if self._ack:
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/bloomsky/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/bloomsky/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/demo/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def __init__(
state,
available=False,
brightness=180,
ct=None,
ct=None, # pylint: disable=invalid-name
effect_list=None,
effect=None,
hs_color=None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ async def async_step_zeroconf(
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"],
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/dhcp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
class DhcpServiceInfo(BaseServiceInfo):
"""Prepared info from dhcp entries."""

ip: str # pylint: disable=invalid-name
ip: str
hostname: str
macaddress: str

Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/digital_ocean/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/digital_ocean/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/linode/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/linode/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/litejet/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def get_entities(system):
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
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/litejet/scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def get_entities(system):
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
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/litejet/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def get_entities(system):
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
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/london_air/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/pushbullet/notify.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}
Expand Down
10 changes: 7 additions & 3 deletions homeassistant/components/pushbullet/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -118,10 +122,10 @@ def update(self):
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)
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/serial_pm/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/spotify/media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ def __init__(
self,
session: OAuth2Session,
spotify: Spotify,
me: dict,
me: dict, # pylint: disable=invalid-name
user_id: str,
name: str,
) -> None:
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/xiaomi_miio/binary_sensor.py
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
12 changes: 6 additions & 6 deletions homeassistant/components/zabbix/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}

Expand Down Expand Up @@ -121,9 +121,9 @@ def extra_state_attributes(self):
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][
Expand All @@ -145,9 +145,9 @@ def _call_zabbix_api(self):
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")
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/zwave/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,6 @@ def get_speed_config(self, resolved_data: dict[str, Any]) -> list[int] | None:
Empty lists are not permissible.
"""
# pylint: disable=no-self-use
raise NotImplementedError


Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ good-names = [
"k",
"Run",
"T",
"ip",
]

[tool.pylint."MESSAGES CONTROL"]
Expand Down Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion requirements_test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 25f8d4a

Please sign in to comment.