1 """Decorator utility functions."""
3 from __future__
import annotations
5 from collections.abc
import Callable, Hashable
9 class Registry[_KT: Hashable, _VT: Callable[..., Any]](dict[_KT, _VT]):
10 """Registry of items."""
12 def register(self, name: _KT) -> Callable[[_VT], _VT]:
13 """Return decorator to register item with a specific name."""
15 def decorator(func: _VT) -> _VT:
16 """Register decorated function."""
Callable[[_VT], _VT] register(self, _KT name)