Use PEP 695 for function annotations with scoping (#117787)

This commit is contained in:
Marc Mueller 2024-05-20 12:43:39 +02:00 committed by GitHub
parent f50973c76c
commit 7998f874c0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 14 additions and 23 deletions

View file

@ -6,16 +6,13 @@ from collections.abc import Awaitable, Callable, Coroutine
from functools import wraps
from http import HTTPStatus
import logging
from typing import Any, Concatenate, ParamSpec, TypeVar
from typing import Any, Concatenate
from aiohttp import web
import voluptuous as vol
from .view import HomeAssistantView
_HassViewT = TypeVar("_HassViewT", bound=HomeAssistantView)
_P = ParamSpec("_P")
_LOGGER = logging.getLogger(__name__)
@ -36,7 +33,7 @@ class RequestDataValidator:
self._schema = schema
self._allow_empty = allow_empty
def __call__(
def __call__[_HassViewT: HomeAssistantView, **_P](
self,
method: Callable[
Concatenate[_HassViewT, web.Request, dict[str, Any], _P],