mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 18:57:06 +00:00
Use PEP 695 for decorator typing with type aliases in zha (#124235)
This commit is contained in:
parent
33814d1180
commit
e3e48ff9b7
@ -14,7 +14,7 @@ import logging
|
||||
import re
|
||||
import time
|
||||
from types import MappingProxyType
|
||||
from typing import TYPE_CHECKING, Any, Concatenate, NamedTuple, ParamSpec, TypeVar, cast
|
||||
from typing import TYPE_CHECKING, Any, Concatenate, NamedTuple, cast
|
||||
from zoneinfo import ZoneInfo
|
||||
|
||||
import voluptuous as vol
|
||||
@ -172,9 +172,6 @@ if TYPE_CHECKING:
|
||||
|
||||
_LogFilterType = Filter | Callable[[LogRecord], bool]
|
||||
|
||||
_P = ParamSpec("_P")
|
||||
_EntityT = TypeVar("_EntityT", bound="ZHAEntity")
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
DEBUG_COMP_BELLOWS = "bellows"
|
||||
@ -1277,7 +1274,7 @@ def create_zha_config(hass: HomeAssistant, ha_zha_data: HAZHAData) -> ZHAData:
|
||||
)
|
||||
|
||||
|
||||
def convert_zha_error_to_ha_error(
|
||||
def convert_zha_error_to_ha_error[**_P, _EntityT: ZHAEntity](
|
||||
func: Callable[Concatenate[_EntityT, _P], Awaitable[None]],
|
||||
) -> Callable[Concatenate[_EntityT, _P], Coroutine[Any, Any, None]]:
|
||||
"""Decorate ZHA commands and re-raises ZHAException as HomeAssistantError."""
|
||||
|
Loading…
x
Reference in New Issue
Block a user