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)

This commit is contained in:
George King
2018-02-05 13:50:40 -05:00
committed by Jelle Zijlstra
parent fa98de6d57
commit 1533602779

View File

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