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
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 31 additions and 76 deletions

View file

@ -5,7 +5,7 @@ from __future__ import annotations
from collections.abc import Callable, Coroutine
import logging
import math
from typing import Any, Concatenate, ParamSpec, TypeVar
from typing import Any, Concatenate
import voluptuous as vol
import yeelight
@ -67,10 +67,6 @@ from .const import (
from .device import YeelightDevice
from .entity import YeelightEntity
_YeelightBaseLightT = TypeVar("_YeelightBaseLightT", bound="YeelightBaseLight")
_R = TypeVar("_R")
_P = ParamSpec("_P")
_LOGGER = logging.getLogger(__name__)
ATTR_MINUTES = "minutes"
@ -243,7 +239,7 @@ def _parse_custom_effects(effects_config) -> dict[str, dict[str, Any]]:
return effects
def _async_cmd(
def _async_cmd[_YeelightBaseLightT: YeelightBaseLight, **_P, _R](
func: Callable[Concatenate[_YeelightBaseLightT, _P], Coroutine[Any, Any, _R]],
) -> Callable[Concatenate[_YeelightBaseLightT, _P], Coroutine[Any, Any, _R | None]]:
"""Define a wrapper to catch exceptions from the bulb."""