From 2d8ff30e7a856c5102252e3db4a74950eca24697 Mon Sep 17 00:00:00 2001 From: Yegor Roganov Date: Sun, 16 Oct 2016 00:14:36 +0300 Subject: [PATCH] Improve `itertools.islice` type (#610) `stop` parameter to `islice` can be `None`, which is important when checking with --strict-optional --- stdlib/2.7/itertools.pyi | 4 ++-- stdlib/3/itertools.pyi | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/stdlib/2.7/itertools.pyi b/stdlib/2.7/itertools.pyi index 97623cb6c..2d275e720 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, Generic) + Union, Sequence, Generic, Optional) _T = TypeVar('_T') _S = TypeVar('_S') @@ -40,7 +40,7 @@ def groupby(iterable: Iterable[_T], @overload def islice(iterable: Iterable[_T], stop: int) -> Iterator[_T]: ... @overload -def islice(iterable: Iterable[_T], start: int, stop: int, +def islice(iterable: Iterable[_T], start: int, stop: Optional[int], step: int = ...) -> Iterator[_T]: ... _T1 = TypeVar('_T1') diff --git a/stdlib/3/itertools.pyi b/stdlib/3/itertools.pyi index e24bf7709..54324700b 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, Generic) + Union, Sequence, Generic, Optional) _T = TypeVar('_T') _S = TypeVar('_S') @@ -41,7 +41,7 @@ def groupby(iterable: Iterable[_T], @overload def islice(iterable: Iterable[_T], stop: int) -> Iterator[_T]: ... @overload -def islice(iterable: Iterable[_T], start: int, stop: int, +def islice(iterable: Iterable[_T], start: int, stop: Optional[int], step: int = ...) -> Iterator[_T]: ... def starmap(func: Any, iterable: Iterable[Any]) -> Iterator[Any]: ...