diff --git a/stdlib/2/itertools.pyi b/stdlib/2/itertools.pyi index 1d5b4ee84..97e69f802 100644 --- a/stdlib/2/itertools.pyi +++ b/stdlib/2/itertools.pyi @@ -10,7 +10,11 @@ _S = TypeVar('_S') def count(start: int = ..., step: int = ...) -> Iterator[int]: ... # more general types? -def cycle(iterable: Iterable[_T]) -> Iterator[_T]: ... + +class cycle(Iterator[_T], Generic[_T]): + def __init__(self, iterable: Iterable[_T]) -> None: ... + def next(self) -> _T: ... + def __iter__(self) -> Iterator[_T]: ... def repeat(object: _T, times: int = ...) -> Iterator[_T]: ... diff --git a/stdlib/3/itertools.pyi b/stdlib/3/itertools.pyi index 78149e2f4..b5f75fe1c 100644 --- a/stdlib/3/itertools.pyi +++ b/stdlib/3/itertools.pyi @@ -13,7 +13,11 @@ Predicate = Callable[[_T], object] def count(start: _N = ..., step: _N = ...) -> Iterator[_N]: ... # more general types? -def cycle(iterable: Iterable[_T]) -> Iterator[_T]: ... + +class cycle(Iterator[_T], Generic[_T]): + def __init__(self, iterable: Iterable[_T]) -> None: ... + def __next__(self) -> _T: ... + def __iter__(self) -> Iterator[_T]: ... @overload def repeat(object: _T) -> Iterator[_T]: ...