From 9ab5976585a787c8f1f02fa2521c951dd3c21f43 Mon Sep 17 00:00:00 2001 From: Matthias Kramm Date: Wed, 30 Sep 2015 12:22:30 -0700 Subject: [PATCH] merge builtins/2.7/functools.pyi into stdlib/ --- builtins/2.7/functools.pyi | 12 ------------ stdlib/2.7/functools.pyi | 12 +++++++++--- 2 files changed, 9 insertions(+), 15 deletions(-) delete mode 100644 builtins/2.7/functools.pyi diff --git a/builtins/2.7/functools.pyi b/builtins/2.7/functools.pyi deleted file mode 100644 index d47086b11..000000000 --- a/builtins/2.7/functools.pyi +++ /dev/null @@ -1,12 +0,0 @@ -from typing import Any, Callable - -_T = TypeVar("T") -def reduce(function: Callable[[_T], _T], - sequence: Iterator[_T], initial=Optional[_T]) -> _T: ... - -class partial(object): - func = ... # Callable[..., Any] - args = ... # type: Tuple[Any] - keywords = ... # type: Dict[str, Any] - def __init__(self, func: Callable[..., Any], *args, **kwargs) -> None: ... - def __call__(self, *args, **kwargs) -> Any: ... diff --git a/stdlib/2.7/functools.pyi b/stdlib/2.7/functools.pyi index 146518fe4..10dd25caf 100644 --- a/stdlib/2.7/functools.pyi +++ b/stdlib/2.7/functools.pyi @@ -8,7 +8,9 @@ from collections import namedtuple _AnyCallable = Callable[..., Any] -def reduce(function, iterable, initializer=None): ... +_T = TypeVar("T") +def reduce(function: Callable[[_T], _T], + sequence: Iterator[_T], initial=Optional[_T]) -> _T: ... WRAPPER_ASSIGNMENTS = ... # type: Sequence[str] WRAPPER_UPDATES = ... # type: Sequence[str] @@ -19,5 +21,9 @@ def wraps(wrapped: _AnyCallable, assigned: Sequence[str] = ..., updated: Sequenc def total_ordering(cls: type) -> type: ... def cmp_to_key(mycmp): ... -# TODO: give a more specific return type for partial (a callable object with some attributes). -def partial(func: _AnyCallable, *args, **keywords) -> Any: ... +class partial(object): + func = ... # Callable[..., Any] + args = ... # type: Tuple[Any] + keywords = ... # type: Dict[str, Any] + def __init__(self, func: Callable[..., Any], *args, **kwargs) -> None: ... + def __call__(self, *args, **kwargs) -> Any: ...