Fix signature for reduce in some files.

I believe that the signature in stdlib/3/functools.pyi is the correct model
for all versions of reduce.
This commit is contained in:
mulhern
2016-03-22 10:06:18 -04:00
parent 3ff8635d2c
commit f1d08cb420
2 changed files with 13 additions and 7 deletions

View File

@@ -3,14 +3,19 @@
# NOTE: These are incomplete!
from abc import ABCMeta, abstractmethod
from typing import Any, Callable, Generic, Dict, Iterator, Optional, Sequence, Tuple, TypeVar
from typing import Any, Callable, Generic, Dict, Iterable, Optional, Sequence, Tuple, TypeVar, overload
from collections import namedtuple
_AnyCallable = Callable[..., Any]
_T = TypeVar("_T")
def reduce(function: Callable[[_T], _T],
sequence: Iterator[_T], initial: Optional[_T] = ...) -> _T: ...
_S = TypeVar("_S")
@overload
def reduce(function: Callable[[_T, _T], _T],
sequence: Iterable[_T]) -> _T: ...
@overload
def reduce(function: Callable[[_T, _S], _T],
sequence: Iterable[_S], initial: _T) -> _T: ...
WRAPPER_ASSIGNMENTS = ... # type: Sequence[str]
WRAPPER_UPDATES = ... # type: Sequence[str]