mirror of
https://github.com/home-assistant/core.git
synced 2025-04-24 01:08:12 +00:00
Set Registry name parameter to Hashable type (#51203)
This commit is contained in:
parent
0fbdce5ca6
commit
187374c11e
@ -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…
x
Reference in New Issue
Block a user