Set Registry name parameter to Hashable type (#51203)
This commit is contained in:
parent
0fbdce5ca6
commit
187374c11e
1 changed files with 2 additions and 1 deletions
|
@ -1,4 +1,5 @@
|
|||
"""Decorator utility functions."""
|
||||
from collections.abc import Hashable
|
||||
from typing import Callable, TypeVar
|
||||
|
||||
CALLABLE_T = TypeVar("CALLABLE_T", bound=Callable) # pylint: disable=invalid-name
|
||||
|
@ -7,7 +8,7 @@ CALLABLE_T = TypeVar("CALLABLE_T", bound=Callable) # pylint: disable=invalid-na
|
|||
class Registry(dict):
|
||||
"""Registry of items."""
|
||||
|
||||
def register(self, name: str) -> Callable[[CALLABLE_T], CALLABLE_T]:
|
||||
def register(self, name: Hashable) -> Callable[[CALLABLE_T], CALLABLE_T]:
|
||||
"""Return decorator to register item with a specific name."""
|
||||
|
||||
def decorator(func: CALLABLE_T) -> CALLABLE_T:
|
||||
|
|
Loading…
Add table
Reference in a new issue