1 # Stubs for functools (Python 2.7)
\r
3 # NOTE: These are incomplete!
\r
5 from abc import ABCMeta, abstractmethod
\r
6 from typing import Any, Callable, Generic, Dict, Iterable, Optional, Sequence, Tuple, TypeVar, overload
\r
7 from collections import namedtuple
\r
9 _AnyCallable = Callable[..., Any]
\r
14 def reduce(function: Callable[[_T, _T], _T],
\r
15 sequence: Iterable[_T]) -> _T: ...
\r
17 def reduce(function: Callable[[_T, _S], _T],
\r
18 sequence: Iterable[_S], initial: _T) -> _T: ...
\r
20 WRAPPER_ASSIGNMENTS = ... # type: Sequence[str]
\r
21 WRAPPER_UPDATES = ... # type: Sequence[str]
\r
23 def update_wrapper(wrapper: _AnyCallable, wrapped: _AnyCallable, assigned: Sequence[str] = ...,
\r
24 updated: Sequence[str] = ...) -> _AnyCallable: ...
\r
25 def wraps(wrapped: _AnyCallable, assigned: Sequence[str] = ..., updated: Sequence[str] = ...) -> Callable[[_AnyCallable], _AnyCallable]: ...
\r
26 def total_ordering(cls: type) -> type: ...
\r
27 def cmp_to_key(mycmp: Callable[[_T, _T], int]) -> Callable[[_T], Any]: ...
\r
29 class partial(Generic[_T]):
\r
30 func = ... # Callable[..., _T]
\r
31 args = ... # type: Tuple[Any, ...]
\r
32 keywords = ... # type: Dict[str, Any]
\r
33 def __init__(self, func: Callable[..., _T], *args: Any, **kwargs: Any) -> None: ...
\r
34 def __call__(self, *args: Any, **kwargs: Any) -> _T: ...
\r