Skip to content

Commit 1533602

Browse files
gwkJelleZijlstra
authored andcommitted
filter function: make the callable of the first overload non-optional so that mypy is able to select the second overload for the case. (#1855)
1 parent fa98de6 commit 1533602

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

stdlib/3/builtins.pyi

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -804,8 +804,7 @@ def eval(source: Union[str, bytes, CodeType], globals: Optional[Dict[str, Any]]
804804
def exec(object: Union[str, bytes, CodeType], globals: Optional[Dict[str, Any]] = ..., locals: Optional[Mapping[str, Any]] = ...) -> Any: ...
805805
def exit(code: Any = ...) -> NoReturn: ...
806806
@overload
807-
def filter(function: Optional[Callable[[_T], Any]],
808-
iterable: Iterable[_T]) -> Iterator[_T]: ...
807+
def filter(function: Callable[[_T], Any], iterable: Iterable[_T]) -> Iterator[_T]: ...
809808
@overload
810809
def filter(function: None, iterable: Iterable[Optional[_T]]) -> Iterator[_T]: ...
811810
def format(o: object, format_spec: str = ...) -> str: ...

0 commit comments

Comments
 (0)