Update Union typing (zha) [Py310] (#86453)
parent
6582ee3591
commit
00e5f23249
|
@ -2,12 +2,12 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Callable
|
||||
from typing import Any, TypeVar, Union
|
||||
from typing import Any, TypeVar
|
||||
|
||||
_TypeT = TypeVar("_TypeT", bound=type[Any])
|
||||
|
||||
|
||||
class DictRegistry(dict[Union[int, str], _TypeT]):
|
||||
class DictRegistry(dict[int | str, _TypeT]):
|
||||
"""Dict Registry of items."""
|
||||
|
||||
def register(self, name: int | str) -> Callable[[_TypeT], _TypeT]:
|
||||
|
@ -21,7 +21,7 @@ class DictRegistry(dict[Union[int, str], _TypeT]):
|
|||
return decorator
|
||||
|
||||
|
||||
class SetRegistry(set[Union[int, str]]):
|
||||
class SetRegistry(set[int | str]):
|
||||
"""Set Registry of items."""
|
||||
|
||||
def register(self, name: int | str) -> Callable[[_TypeT], _TypeT]:
|
||||
|
|
|
@ -11,7 +11,7 @@ import logging
|
|||
import re
|
||||
import time
|
||||
import traceback
|
||||
from typing import TYPE_CHECKING, Any, NamedTuple, Union
|
||||
from typing import TYPE_CHECKING, Any, NamedTuple
|
||||
|
||||
from zigpy.application import ControllerApplication
|
||||
from zigpy.config import CONF_DEVICE
|
||||
|
@ -91,7 +91,7 @@ if TYPE_CHECKING:
|
|||
from ..entity import ZhaEntity
|
||||
from .channels.base import ZigbeeChannel
|
||||
|
||||
_LogFilterType = Union[Filter, Callable[[LogRecord], int]]
|
||||
_LogFilterType = Filter | Callable[[LogRecord], int]
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
"""Test ZHA device switch."""
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
import time
|
||||
from unittest import mock
|
||||
from unittest.mock import patch
|
||||
|
@ -224,6 +225,7 @@ async def test_check_available_no_basic_channel(
|
|||
hass, device_without_basic_channel, zha_device_restored, caplog
|
||||
):
|
||||
"""Check device availability for a device without basic cluster."""
|
||||
caplog.set_level(logging.DEBUG, logger="homeassistant.components.zha")
|
||||
|
||||
zha_device = await zha_device_restored(device_without_basic_channel)
|
||||
await async_enable_traffic(hass, [zha_device])
|
||||
|
|
Loading…
Reference in New Issue