import types
from typing import Any, Callable, Generic, Type, TypeVar, overload

_T = TypeVar("_T")

class _SingleDispatchCallable(Generic[_T]):
    registry: types.MappingProxyType[Any, Callable[..., _T]]
    def dispatch(self, cls: Any) -> Callable[..., _T]: ...
    # @fun.register(complex)
    # def _(arg, verbose=False): ...
    @overload
    def register(
        self, cls: Type[Any], func: None = ...
    ) -> Callable[[Callable[..., _T]], Callable[..., _T]]: ...
    # @fun.register
    # def _(arg: int, verbose=False):
    @overload
    def register(
        self, cls: Callable[..., _T], func: None = ...
    ) -> Callable[..., _T]: ...
    # fun.register(int, lambda x: x)
    @overload
    def register(
        self, cls: Type[Any], func: Callable[..., _T]
    ) -> Callable[..., _T]: ...
    def _clear_cache(self) -> None: ...
    def __call__(self, *args: Any, **kwargs: Any) -> _T: ...

def type_dispatch(func: Callable[..., _T]) -> _SingleDispatchCallable[_T]: ...
