Make itertools.cycle a type (#3732)

This commit is contained in:
Mark
2020-02-09 06:34:41 -06:00
committed by GitHub
parent ba3679e433
commit 39008d51c1
2 changed files with 10 additions and 2 deletions

View File

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

View File

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