Update mypy to 1.0.0 (#87586)
parent
ff6e597a63
commit
4fbb14ecc7
|
@ -30,7 +30,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||
_LOGGER.debug("Using station_id: %d", station_id)
|
||||
|
||||
# We used to use int as config_entry unique_id, convert this to str.
|
||||
if isinstance(entry.unique_id, int): # type: ignore[unreachable]
|
||||
if isinstance(entry.unique_id, int):
|
||||
hass.config_entries.async_update_entry(entry, unique_id=str(station_id)) # type: ignore[unreachable]
|
||||
|
||||
# We used to use int in device_entry identifiers, convert this to str.
|
||||
|
|
|
@ -4,14 +4,14 @@ from __future__ import annotations
|
|||
import asyncio
|
||||
from collections.abc import Callable
|
||||
import logging
|
||||
from typing import Any, NamedTuple, Optional
|
||||
from typing import Any, NamedTuple
|
||||
|
||||
from homeassistant.core import CALLBACK_TYPE, HomeAssistant, callback
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
NoParamCallback = Optional[Callable[[], Any]]
|
||||
ActivityCallback = Optional[Callable[[tuple], Any]]
|
||||
NoParamCallback = Callable[[], Any] | None
|
||||
ActivityCallback = Callable[[tuple], Any] | None
|
||||
|
||||
|
||||
class HarmonyCallback(NamedTuple):
|
||||
|
|
|
@ -10,7 +10,7 @@ import logging
|
|||
from operator import attrgetter
|
||||
import ssl
|
||||
import time
|
||||
from typing import TYPE_CHECKING, Any, Union, cast
|
||||
from typing import TYPE_CHECKING, Any, cast
|
||||
import uuid
|
||||
|
||||
import attr
|
||||
|
@ -151,9 +151,9 @@ AsyncDeprecatedMessageCallbackType = Callable[
|
|||
[str, ReceivePayloadType, int], Coroutine[Any, Any, None]
|
||||
]
|
||||
DeprecatedMessageCallbackType = Callable[[str, ReceivePayloadType, int], None]
|
||||
DeprecatedMessageCallbackTypes = Union[
|
||||
AsyncDeprecatedMessageCallbackType, DeprecatedMessageCallbackType
|
||||
]
|
||||
DeprecatedMessageCallbackTypes = (
|
||||
AsyncDeprecatedMessageCallbackType | DeprecatedMessageCallbackType
|
||||
)
|
||||
|
||||
|
||||
# Support for a deprecated callback type will be removed from HA core 2023.2.0
|
||||
|
|
|
@ -388,7 +388,7 @@ class SamsungTVWSBaseBridge(SamsungTVBridge, Generic[_RemoteT, _CommandT]):
|
|||
"""Tells if the TV is on."""
|
||||
LOGGER.debug("Checking if TV %s is on using websocket", self.host)
|
||||
if remote := await self._async_get_remote():
|
||||
return remote.is_alive() # type: ignore[no-any-return]
|
||||
return remote.is_alive()
|
||||
return False
|
||||
|
||||
async def _async_send_commands(self, commands: list[_CommandT]) -> None:
|
||||
|
@ -399,7 +399,7 @@ class SamsungTVWSBaseBridge(SamsungTVBridge, Generic[_RemoteT, _CommandT]):
|
|||
for _ in range(retry_count + 1):
|
||||
try:
|
||||
if remote := await self._async_get_remote():
|
||||
await remote.send_commands(commands)
|
||||
await remote.send_commands(commands) # type: ignore[arg-type]
|
||||
break
|
||||
except (
|
||||
BrokenPipeError,
|
||||
|
@ -416,7 +416,7 @@ class SamsungTVWSBaseBridge(SamsungTVBridge, Generic[_RemoteT, _CommandT]):
|
|||
"""Create or return a remote control instance."""
|
||||
if (remote := self._remote) and remote.is_alive():
|
||||
# If we have one then try to use it
|
||||
return remote # type: ignore[no-any-return]
|
||||
return remote
|
||||
|
||||
async with self._remote_lock:
|
||||
# If we don't have one make sure we do it under the lock
|
||||
|
|
|
@ -91,7 +91,7 @@ if TYPE_CHECKING:
|
|||
from ..entity import ZhaEntity
|
||||
from .channels.base import ZigbeeChannel
|
||||
|
||||
_LogFilterType = Filter | Callable[[LogRecord], int]
|
||||
_LogFilterType = Filter | Callable[[LogRecord], bool]
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -163,9 +163,6 @@ good-names = [
|
|||
# Pylint CodeStyle plugin
|
||||
# consider-using-namedtuple-or-dataclass - too opinionated
|
||||
# consider-using-assignment-expr - decision to use := better left to devs
|
||||
# ---
|
||||
# Temporary for the Python 3.10 update, remove with mypy v1.0
|
||||
# consider-alternative-union-syntax
|
||||
disable = [
|
||||
"format",
|
||||
"abstract-method",
|
||||
|
@ -190,7 +187,6 @@ disable = [
|
|||
"consider-using-f-string",
|
||||
"consider-using-namedtuple-or-dataclass",
|
||||
"consider-using-assignment-expr",
|
||||
"consider-alternative-union-syntax",
|
||||
]
|
||||
enable = [
|
||||
#"useless-suppression", # temporarily every now and then to clean them up
|
||||
|
|
|
@ -12,7 +12,7 @@ codecov==2.1.12
|
|||
coverage==7.1.0
|
||||
freezegun==1.2.2
|
||||
mock-open==1.4.0
|
||||
mypy==0.991
|
||||
mypy==1.0.0
|
||||
pre-commit==3.0.0
|
||||
pylint==2.16.0
|
||||
pylint-per-file-ignores==1.1.0
|
||||
|
|
Loading…
Reference in New Issue