massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / coc-python-data / languageServer.0.5.59 / Typeshed / stdlib / 3 / functools.pyi
1 import sys\r
2 from typing import Any, Callable, Generic, Dict, Iterable, Mapping, Optional, Sequence, Tuple, Type, TypeVar, NamedTuple, Union, overload\r
3 \r
4 _AnyCallable = Callable[..., Any]\r
5 \r
6 _T = TypeVar("_T")\r
7 _S = TypeVar("_S")\r
8 @overload\r
9 def reduce(function: Callable[[_T, _S], _T],\r
10            sequence: Iterable[_S], initial: _T) -> _T: ...\r
11 @overload\r
12 def reduce(function: Callable[[_T, _T], _T],\r
13            sequence: Iterable[_T]) -> _T: ...\r
14 \r
15 \r
16 class _CacheInfo(NamedTuple('CacheInfo', [\r
17     ('hits', int),\r
18     ('misses', int),\r
19     ('maxsize', int),\r
20     ('currsize', int)\r
21 ])): ...\r
22 \r
23 class _lru_cache_wrapper(Generic[_T]):\r
24     __wrapped__ = ...  # type: Callable[..., _T]\r
25     def __call__(self, *args: Any, **kwargs: Any) -> _T: ...\r
26     def cache_info(self) -> _CacheInfo: ...\r
27     def cache_clear(self) -> None: ...\r
28 \r
29 class lru_cache():\r
30     def __init__(self, maxsize: Optional[int] = ..., typed: bool = ...) -> None: ...\r
31     def __call__(self, f: Callable[..., _T]) -> _lru_cache_wrapper[_T]: ...\r
32 \r
33 \r
34 WRAPPER_ASSIGNMENTS = ...  # type: Sequence[str]\r
35 WRAPPER_UPDATES = ...  # type: Sequence[str]\r
36 \r
37 def update_wrapper(wrapper: _AnyCallable, wrapped: _AnyCallable, assigned: Sequence[str] = ...,\r
38                    updated: Sequence[str] = ...) -> _AnyCallable: ...\r
39 def wraps(wrapped: _AnyCallable, assigned: Sequence[str] = ..., updated: Sequence[str] = ...) -> Callable[[_AnyCallable], _AnyCallable]: ...\r
40 def total_ordering(cls: type) -> type: ...\r
41 def cmp_to_key(mycmp: Callable[[_T, _T], int]) -> Callable[[_T], Any]: ...\r
42 \r
43 class partial(Generic[_T]):\r
44     func = ...  # type: Callable[..., _T]\r
45     args = ...  # type: Tuple[Any, ...]\r
46     keywords = ...  # type: Dict[str, Any]\r
47     def __init__(self, func: Callable[..., _T], *args: Any, **kwargs: Any) -> None: ...\r
48     def __call__(self, *args: Any, **kwargs: Any) -> _T: ...\r
49 \r
50 # With protocols, this could change into a generic protocol that defines __get__ and returns _T\r
51 _Descriptor = Any\r
52 \r
53 class partialmethod(Generic[_T]):\r
54     func: Union[Callable[..., _T], _Descriptor]\r
55     args: Tuple[Any, ...]\r
56     keywords: Dict[str, Any]\r
57 \r
58     @overload\r
59     def __init__(self, func: Callable[..., _T], *args: Any, **keywords: Any) -> None: ...\r
60     @overload\r
61     def __init__(self, func: _Descriptor, *args: Any, **keywords: Any) -> None: ...\r
62     def __get__(self, obj: Any, cls: Type[Any]) -> Callable[..., _T]: ...\r
63     @property\r
64     def __isabstractmethod__(self) -> bool: ...\r
65 \r
66 class _SingleDispatchCallable(Generic[_T]):\r
67     registry = ...  # type: Mapping[Any, Callable[..., _T]]\r
68     def dispatch(self, cls: Any) -> Callable[..., _T]: ...\r
69     @overload\r
70     def register(self, cls: Any) -> Callable[[Callable[..., _T]], Callable[..., _T]]: ...\r
71     @overload\r
72     def register(self, cls: Any, func: Callable[..., _T]) -> Callable[..., _T]: ...\r
73     def _clear_cache(self) -> None: ...\r
74     def __call__(self, *args: Any, **kwargs: Any) -> _T: ...\r
75 \r
76 def singledispatch(func: Callable[..., _T]) -> _SingleDispatchCallable[_T]: ...\r