Use PEP 695 for decorator typing (1) (#117638)

This commit is contained in:
Marc Mueller 2024-05-17 16:27:02 +02:00 committed by GitHub
parent 067c9e63e9
commit 34bd291615
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 33 additions and 90 deletions

View file

@ -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."""