Use PEP 695 for class annotations (4) (#117778)

This commit is contained in:
Marc Mueller 2024-05-20 10:44:52 +02:00 committed by GitHub
parent eedce95bc9
commit 8f0fb4db3e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 29 additions and 56 deletions

View file

@ -3,13 +3,10 @@
from __future__ import annotations
from collections.abc import Callable, Hashable
from typing import Any, TypeVar
_KT = TypeVar("_KT", bound=Hashable)
_VT = TypeVar("_VT", bound=Callable[..., Any])
from typing import Any
class Registry(dict[_KT, _VT]):
class Registry[_KT: Hashable, _VT: Callable[..., Any]](dict[_KT, _VT]):
"""Registry of items."""
def register(self, name: _KT) -> Callable[[_VT], _VT]: