Implement itertools.chain.from_iterable().

This commit is contained in:
Guido van Rossum
2016-04-07 14:48:26 -07:00
parent 56abd1e54b
commit 17e74036f5
2 changed files with 14 additions and 6 deletions

View File

@@ -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]: ...