From 7a61d6467202f813cbfb2003049d24850ec0271e Mon Sep 17 00:00:00 2001 From: George King <george.w.king@gmail.com> Date: Mon, 5 Feb 2018 13:00:53 -0500 Subject: [PATCH] filter function: make the callable of the first overload non-optional so that mypy is able to select the second overload for the case. --- stdlib/3/builtins.pyi | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/stdlib/3/builtins.pyi b/stdlib/3/builtins.pyi index d09192848379..d0eafd70e7cf 100644 --- a/stdlib/3/builtins.pyi +++ b/stdlib/3/builtins.pyi @@ -804,8 +804,7 @@ def eval(source: Union[str, bytes, CodeType], globals: Optional[Dict[str, Any]] def exec(object: Union[str, bytes, CodeType], globals: Optional[Dict[str, Any]] = ..., locals: Optional[Mapping[str, Any]] = ...) -> Any: ... def exit(code: Any = ...) -> NoReturn: ... @overload -def filter(function: Optional[Callable[[_T], Any]], - iterable: Iterable[_T]) -> Iterator[_T]: ... +def filter(function: Callable[[_T], Any], iterable: Iterable[_T]) -> Iterator[_T]: ... @overload def filter(function: None, iterable: Iterable[Optional[_T]]) -> Iterator[_T]: ... def format(o: object, format_spec: str = ...) -> str: ...