Use PEP 695 for class annotations (4) (#117778)
This commit is contained in:
parent
eedce95bc9
commit
8f0fb4db3e
11 changed files with 29 additions and 56 deletions
|
@ -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]:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue