From 9b545a01ab95d4f15dc25dd1e40d7be33a4fbfa6 Mon Sep 17 00:00:00 2001 From: Alun Champion Date: Tue, 12 Feb 2019 04:59:37 -0600 Subject: [PATCH] Added `Optional[]` around the `itertools.groupby()` `key` attribute to allow `None` to pass the type (#2790) Fixes #2788 --- stdlib/2/itertools.pyi | 2 +- stdlib/3/itertools.pyi | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/stdlib/2/itertools.pyi b/stdlib/2/itertools.pyi index a37468d81..e7a44f293 100644 --- a/stdlib/2/itertools.pyi +++ b/stdlib/2/itertools.pyi @@ -35,7 +35,7 @@ def ifilterfalse(predicate: Optional[Callable[[_T], Any]], def groupby(iterable: Iterable[_T]) -> Iterator[Tuple[_T, Iterator[_T]]]: ... @overload def groupby(iterable: Iterable[_T], - key: Callable[[_T], _S]) -> Iterator[Tuple[_S, Iterator[_T]]]: ... + key: Optional[Callable[[_T], _S]]) -> Iterator[Tuple[_S, Iterator[_T]]]: ... @overload def islice(iterable: Iterable[_T], stop: Optional[int]) -> Iterator[_T]: ... diff --git a/stdlib/3/itertools.pyi b/stdlib/3/itertools.pyi index 2b56406e8..c990f4a06 100644 --- a/stdlib/3/itertools.pyi +++ b/stdlib/3/itertools.pyi @@ -38,7 +38,7 @@ def filterfalse(predicate: Optional[Predicate[_T]], def groupby(iterable: Iterable[_T]) -> Iterator[Tuple[_T, Iterator[_T]]]: ... @overload def groupby(iterable: Iterable[_T], - key: Callable[[_T], _S]) -> Iterator[Tuple[_S, Iterator[_T]]]: ... + key: Optional[Callable[[_T], _S]]) -> Iterator[Tuple[_S, Iterator[_T]]]: ... @overload def islice(iterable: Iterable[_T], stop: Optional[int]) -> Iterator[_T]: ...