Skip to content

Commit

Permalink
Use PEP 695 for decorator typing with type aliases in zha (#124235)
Browse files Browse the repository at this point in the history
  • Loading branch information
emontnemery authored Sep 6, 2024
1 parent 33814d1 commit e3e48ff
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions homeassistant/components/zha/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
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
Expand Down Expand Up @@ -172,9 +172,6 @@

_LogFilterType = Filter | Callable[[LogRecord], bool]

_P = ParamSpec("_P")
_EntityT = TypeVar("_EntityT", bound="ZHAEntity")

_LOGGER = logging.getLogger(__name__)

DEBUG_COMP_BELLOWS = "bellows"
Expand Down Expand Up @@ -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."""
Expand Down

0 comments on commit e3e48ff

Please sign in to comment.