| 1 |
from typing import Generic, TypeVar, Callable, Any, Mapping, Self, overload |
| 2 |
|
| 3 |
_T = TypeVar("_T") |
| 4 |
|
| 5 |
class _SingleDispatchCallable(Generic[_T]): |
| 6 |
registry: Mapping[Any, Callable[..., _T]] |
| 7 |
def dispatch(self, cls: Any) -> Callable[..., _T]: ... |
| 8 |
# @fun.register(complex) |
| 9 |
# def _(arg, verbose=False): ... |
| 10 |
@overload |
| 11 |
def register(self, cls: type[Any], func: None = ...) -> Callable[[Callable[..., _T]], Callable[..., _T]]: ... |
| 12 |
# @fun.register |
| 13 |
# def _(arg: int, verbose=False): |
| 14 |
@overload |
| 15 |
def register(self, cls: Callable[..., _T], func: None = ...) -> Callable[..., _T]: ... |
| 16 |
# fun.register(int, lambda x: x) |
| 17 |
@overload |
| 18 |
def register(self, cls: type[Any], func: Callable[..., _T]) -> Callable[..., _T]: ... |
| 19 |
def _clear_cache(self) -> None: ... |
| 20 |
def __call__(__self, *args: Any, **kwargs: Any) -> _T: ... |
| 21 |
|
| 22 |
def singledispatch(func: Callable[..., _T]) -> _SingleDispatchCallable[_T]: ... |
| 23 |
|
| 24 |
def total_ordering(cls: type[_T]) -> type[_T]: ... |
| 25 |
|
| 26 |
class cached_property(Generic[_T]): |
| 27 |
func: Callable[[Any], _T] |
| 28 |
attrname: str | None |
| 29 |
def __init__(self, func: Callable[[Any], _T]) -> None: ... |
| 30 |
@overload |
| 31 |
def __get__(self, instance: None, owner: type[Any] | None = ...) -> cached_property[_T]: ... |
| 32 |
@overload |
| 33 |
def __get__(self, instance: object, owner: type[Any] | None = ...) -> _T: ... |
| 34 |
def __set_name__(self, owner: type[Any], name: str) -> None: ... |
| 35 |
def __class_getitem__(cls, item: Any) -> Any: ... |
| 36 |
|
| 37 |
class partial(Generic[_T]): |
| 38 |
def __new__(cls, __func: Callable[..., _T], *args: Any, **kwargs: Any) -> Self: ... |
| 39 |
def __call__(__self, *args: Any, **kwargs: Any) -> _T: ... |
| 40 |
|
| 41 |
def wraps(wrapped: _T) -> partial[_T]: ... |