mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Update pylint to 2.15.0 (#77408)
* Update pylint to 2.15.0 * Remove useless suppressions * Fix TypeVar name
This commit is contained in:
parent
0caf998547
commit
1210897f83
@ -46,10 +46,10 @@ from .const import (
|
|||||||
UPDATE_INTERVAL_SETTINGS,
|
UPDATE_INTERVAL_SETTINGS,
|
||||||
)
|
)
|
||||||
|
|
||||||
TCoordinatorData = TypeVar("TCoordinatorData", bound=NextDnsData)
|
CoordinatorDataT = TypeVar("CoordinatorDataT", bound=NextDnsData)
|
||||||
|
|
||||||
|
|
||||||
class NextDnsUpdateCoordinator(DataUpdateCoordinator[TCoordinatorData]):
|
class NextDnsUpdateCoordinator(DataUpdateCoordinator[CoordinatorDataT]):
|
||||||
"""Class to manage fetching NextDNS data API."""
|
"""Class to manage fetching NextDNS data API."""
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
@ -73,7 +73,7 @@ class NextDnsUpdateCoordinator(DataUpdateCoordinator[TCoordinatorData]):
|
|||||||
|
|
||||||
super().__init__(hass, _LOGGER, name=DOMAIN, update_interval=update_interval)
|
super().__init__(hass, _LOGGER, name=DOMAIN, update_interval=update_interval)
|
||||||
|
|
||||||
async def _async_update_data(self) -> TCoordinatorData:
|
async def _async_update_data(self) -> CoordinatorDataT:
|
||||||
"""Update data via internal method."""
|
"""Update data via internal method."""
|
||||||
try:
|
try:
|
||||||
async with timeout(10):
|
async with timeout(10):
|
||||||
@ -81,7 +81,7 @@ class NextDnsUpdateCoordinator(DataUpdateCoordinator[TCoordinatorData]):
|
|||||||
except (ApiError, ClientConnectorError, InvalidApiKeyError) as err:
|
except (ApiError, ClientConnectorError, InvalidApiKeyError) as err:
|
||||||
raise UpdateFailed(err) from err
|
raise UpdateFailed(err) from err
|
||||||
|
|
||||||
async def _async_update_data_internal(self) -> TCoordinatorData:
|
async def _async_update_data_internal(self) -> CoordinatorDataT:
|
||||||
"""Update data via library."""
|
"""Update data via library."""
|
||||||
raise NotImplementedError("Update method not implemented")
|
raise NotImplementedError("Update method not implemented")
|
||||||
|
|
||||||
|
@ -18,23 +18,23 @@ from homeassistant.helpers.entity import EntityCategory
|
|||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||||
|
|
||||||
from . import NextDnsConnectionUpdateCoordinator, TCoordinatorData
|
from . import CoordinatorDataT, NextDnsConnectionUpdateCoordinator
|
||||||
from .const import ATTR_CONNECTION, DOMAIN
|
from .const import ATTR_CONNECTION, DOMAIN
|
||||||
|
|
||||||
PARALLEL_UPDATES = 1
|
PARALLEL_UPDATES = 1
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class NextDnsBinarySensorRequiredKeysMixin(Generic[TCoordinatorData]):
|
class NextDnsBinarySensorRequiredKeysMixin(Generic[CoordinatorDataT]):
|
||||||
"""Mixin for required keys."""
|
"""Mixin for required keys."""
|
||||||
|
|
||||||
state: Callable[[TCoordinatorData, str], bool]
|
state: Callable[[CoordinatorDataT, str], bool]
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class NextDnsBinarySensorEntityDescription(
|
class NextDnsBinarySensorEntityDescription(
|
||||||
BinarySensorEntityDescription,
|
BinarySensorEntityDescription,
|
||||||
NextDnsBinarySensorRequiredKeysMixin[TCoordinatorData],
|
NextDnsBinarySensorRequiredKeysMixin[CoordinatorDataT],
|
||||||
):
|
):
|
||||||
"""NextDNS binary sensor entity description."""
|
"""NextDNS binary sensor entity description."""
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
|||||||
from homeassistant.helpers.typing import StateType
|
from homeassistant.helpers.typing import StateType
|
||||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||||
|
|
||||||
from . import NextDnsUpdateCoordinator, TCoordinatorData
|
from . import CoordinatorDataT, NextDnsUpdateCoordinator
|
||||||
from .const import (
|
from .const import (
|
||||||
ATTR_DNSSEC,
|
ATTR_DNSSEC,
|
||||||
ATTR_ENCRYPTION,
|
ATTR_ENCRYPTION,
|
||||||
@ -40,17 +40,17 @@ PARALLEL_UPDATES = 1
|
|||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class NextDnsSensorRequiredKeysMixin(Generic[TCoordinatorData]):
|
class NextDnsSensorRequiredKeysMixin(Generic[CoordinatorDataT]):
|
||||||
"""Class for NextDNS entity required keys."""
|
"""Class for NextDNS entity required keys."""
|
||||||
|
|
||||||
coordinator_type: str
|
coordinator_type: str
|
||||||
value: Callable[[TCoordinatorData], StateType]
|
value: Callable[[CoordinatorDataT], StateType]
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class NextDnsSensorEntityDescription(
|
class NextDnsSensorEntityDescription(
|
||||||
SensorEntityDescription,
|
SensorEntityDescription,
|
||||||
NextDnsSensorRequiredKeysMixin[TCoordinatorData],
|
NextDnsSensorRequiredKeysMixin[CoordinatorDataT],
|
||||||
):
|
):
|
||||||
"""NextDNS sensor entity description."""
|
"""NextDNS sensor entity description."""
|
||||||
|
|
||||||
@ -348,7 +348,7 @@ async def async_setup_entry(
|
|||||||
|
|
||||||
|
|
||||||
class NextDnsSensor(
|
class NextDnsSensor(
|
||||||
CoordinatorEntity[NextDnsUpdateCoordinator[TCoordinatorData]], SensorEntity
|
CoordinatorEntity[NextDnsUpdateCoordinator[CoordinatorDataT]], SensorEntity
|
||||||
):
|
):
|
||||||
"""Define an NextDNS sensor."""
|
"""Define an NextDNS sensor."""
|
||||||
|
|
||||||
@ -356,7 +356,7 @@ class NextDnsSensor(
|
|||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
coordinator: NextDnsUpdateCoordinator[TCoordinatorData],
|
coordinator: NextDnsUpdateCoordinator[CoordinatorDataT],
|
||||||
description: NextDnsSensorEntityDescription,
|
description: NextDnsSensorEntityDescription,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Initialize."""
|
"""Initialize."""
|
||||||
|
@ -18,22 +18,22 @@ from homeassistant.helpers.entity import EntityCategory
|
|||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||||
|
|
||||||
from . import NextDnsSettingsUpdateCoordinator, TCoordinatorData
|
from . import CoordinatorDataT, NextDnsSettingsUpdateCoordinator
|
||||||
from .const import ATTR_SETTINGS, DOMAIN
|
from .const import ATTR_SETTINGS, DOMAIN
|
||||||
|
|
||||||
PARALLEL_UPDATES = 1
|
PARALLEL_UPDATES = 1
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class NextDnsSwitchRequiredKeysMixin(Generic[TCoordinatorData]):
|
class NextDnsSwitchRequiredKeysMixin(Generic[CoordinatorDataT]):
|
||||||
"""Class for NextDNS entity required keys."""
|
"""Class for NextDNS entity required keys."""
|
||||||
|
|
||||||
state: Callable[[TCoordinatorData], bool]
|
state: Callable[[CoordinatorDataT], bool]
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class NextDnsSwitchEntityDescription(
|
class NextDnsSwitchEntityDescription(
|
||||||
SwitchEntityDescription, NextDnsSwitchRequiredKeysMixin[TCoordinatorData]
|
SwitchEntityDescription, NextDnsSwitchRequiredKeysMixin[CoordinatorDataT]
|
||||||
):
|
):
|
||||||
"""NextDNS switch entity description."""
|
"""NextDNS switch entity description."""
|
||||||
|
|
||||||
|
@ -3,7 +3,6 @@ from __future__ import annotations
|
|||||||
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
|
||||||
# pylint: disable=import-error
|
|
||||||
from switchmate import Switchmate
|
from switchmate import Switchmate
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
|
@ -199,8 +199,6 @@ class TupleWrapper(tuple, ResultWrapper):
|
|||||||
"""Create a new tuple class."""
|
"""Create a new tuple class."""
|
||||||
return super().__new__(cls, tuple(value))
|
return super().__new__(cls, tuple(value))
|
||||||
|
|
||||||
# pylint: disable=super-init-not-called
|
|
||||||
|
|
||||||
def __init__(self, value: tuple, *, render_result: str | None = None) -> None:
|
def __init__(self, value: tuple, *, render_result: str | None = None) -> None:
|
||||||
"""Initialize a new tuple class."""
|
"""Initialize a new tuple class."""
|
||||||
self.render_result = render_result
|
self.render_result = render_result
|
||||||
|
@ -13,7 +13,7 @@ freezegun==1.2.1
|
|||||||
mock-open==1.4.0
|
mock-open==1.4.0
|
||||||
mypy==0.971
|
mypy==0.971
|
||||||
pre-commit==2.20.0
|
pre-commit==2.20.0
|
||||||
pylint==2.14.5
|
pylint==2.15.0
|
||||||
pipdeptree==2.2.1
|
pipdeptree==2.2.1
|
||||||
pytest-aiohttp==0.3.0
|
pytest-aiohttp==0.3.0
|
||||||
pytest-cov==3.0.0
|
pytest-cov==3.0.0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user