diff --git a/stdlib/2.7/itertools.pyi b/stdlib/2.7/itertools.pyi index fe2fa9cc4..14ab5aecd 100644 --- a/stdlib/2.7/itertools.pyi +++ b/stdlib/2.7/itertools.pyi @@ -3,7 +3,7 @@ # Based on https://docs.python.org/2/library/itertools.html from typing import (Iterator, TypeVar, Iterable, overload, Any, Callable, Tuple, - Union, Sequence) + Union, Sequence, Generic) _T = TypeVar('_T') _S = TypeVar('_S') @@ -15,8 +15,12 @@ def cycle(iterable: Iterable[_T]) -> Iterator[_T]: ... def repeat(object: _T, times: int = ...) -> Iterator[_T]: ... def accumulate(iterable: Iterable[_T]) -> Iterator[_T]: ... -def chain(*iterables: Iterable[_T]) -> Iterator[_T]: ... -# TODO chain.from_Iterable + +class chain(Iterator[_T], Generic[_T]): + def __init__(self, *iterables: Iterable[_T]) -> None: ... + @staticmethod + def from_iterable(iterable: Iterable[Iterable[_T]]) -> Iterator[_T]: ... + def compress(data: Iterable[_T], selectors: Iterable[Any]) -> Iterator[_T]: ... def dropwhile(predicate: Callable[[_T], Any], iterable: Iterable[_T]) -> Iterator[_T]: ... diff --git a/stdlib/3/itertools.pyi b/stdlib/3/itertools.pyi index cb219b431..6c159e330 100644 --- a/stdlib/3/itertools.pyi +++ b/stdlib/3/itertools.pyi @@ -3,7 +3,7 @@ # Based on http://docs.python.org/3.2/library/itertools.html from typing import (Iterator, TypeVar, Iterable, overload, Any, Callable, Tuple, - Union, Sequence) + Union, Sequence, Generic) _T = TypeVar('_T') _S = TypeVar('_S') @@ -18,8 +18,12 @@ def repeat(object: _T) -> Iterator[_T]: ... def repeat(object: _T, times: int) -> Iterator[_T]: ... def accumulate(iterable: Iterable[_T]) -> Iterator[_T]: ... -def chain(*iterables: Iterable[_T]) -> Iterator[_T]: ... -# TODO chain.from_Iterable + +class chain(Iterator[_T], Generic[_T]): + def __init__(self, *iterables: Iterable[_T]) -> None: ... + @staticmethod + def from_iterable(iterable: Iterable[Iterable[_T]]) -> Iterator[_T]: ... + def compress(data: Iterable[_T], selectors: Iterable[Any]) -> Iterator[_T]: ... def dropwhile(predicate: Callable[[_T], Any], iterable: Iterable[_T]) -> Iterator[_T]: ...