Use PEP 695 for decorator typing (1) (#117638)
This commit is contained in:
parent
067c9e63e9
commit
34bd291615
16 changed files with 33 additions and 90 deletions
|
@ -7,7 +7,7 @@ from collections.abc import Callable, Coroutine
|
|||
from http import HTTPStatus
|
||||
import logging
|
||||
import os
|
||||
from typing import Any, ParamSpec
|
||||
from typing import Any
|
||||
|
||||
import aiohttp
|
||||
from yarl import URL
|
||||
|
@ -24,8 +24,6 @@ from homeassistant.loader import bind_hass
|
|||
|
||||
from .const import ATTR_DISCOVERY, ATTR_MESSAGE, ATTR_RESULT, DOMAIN, X_HASS_SOURCE
|
||||
|
||||
_P = ParamSpec("_P")
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
@ -33,7 +31,7 @@ class HassioAPIError(RuntimeError):
|
|||
"""Return if a API trow a error."""
|
||||
|
||||
|
||||
def _api_bool(
|
||||
def _api_bool[**_P](
|
||||
funct: Callable[_P, Coroutine[Any, Any, dict[str, Any]]],
|
||||
) -> Callable[_P, Coroutine[Any, Any, bool]]:
|
||||
"""Return a boolean."""
|
||||
|
@ -49,7 +47,7 @@ def _api_bool(
|
|||
return _wrapper
|
||||
|
||||
|
||||
def api_data(
|
||||
def api_data[**_P](
|
||||
funct: Callable[_P, Coroutine[Any, Any, dict[str, Any]]],
|
||||
) -> Callable[_P, Coroutine[Any, Any, Any]]:
|
||||
"""Return data of an api."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue