From e3e48ff9b7f4d5c3426373678ffb60cffa59d900 Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Fri, 6 Sep 2024 16:52:03 +0200 Subject: [PATCH] Use PEP 695 for decorator typing with type aliases in zha (#124235) --- homeassistant/components/zha/helpers.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/homeassistant/components/zha/helpers.py b/homeassistant/components/zha/helpers.py index f70c8a9cb3e..56e7d481f2c 100644 --- a/homeassistant/components/zha/helpers.py +++ b/homeassistant/components/zha/helpers.py @@ -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."""