Use PEP 695 for decorator typing (3) (#117640)

This commit is contained in:
Marc Mueller
2024-05-17 16:27:32 +02:00
committed by GitHub
parent 34bd291615
commit 25d1ca747b
14 changed files with 31 additions and 76 deletions

View File

@@ -12,7 +12,7 @@ from functools import partial, wraps
import logging
from random import randint
import time
from typing import TYPE_CHECKING, Any, Concatenate, Generic, ParamSpec, TypeVar
from typing import TYPE_CHECKING, Any, Concatenate, Generic, TypeVar
from homeassistant.const import (
EVENT_CORE_CONFIG_UPDATE,
@@ -93,7 +93,6 @@ RANDOM_MICROSECOND_MIN = 50000
RANDOM_MICROSECOND_MAX = 500000
_TypedDictT = TypeVar("_TypedDictT", bound=Mapping[str, Any])
_P = ParamSpec("_P")
@dataclass(slots=True, frozen=True)
@@ -168,7 +167,7 @@ class TrackTemplateResult:
result: Any
def threaded_listener_factory(
def threaded_listener_factory[**_P](
async_factory: Callable[Concatenate[HomeAssistant, _P], Any],
) -> Callable[Concatenate[HomeAssistant, _P], CALLBACK_TYPE]:
"""Convert an async event helper to a threaded one."""