Swap order of overloads to fix filter without strict optional (#779)

Related to python/mypy#2587
This commit is contained in:
David Fisher
2016-12-16 15:57:04 -08:00
committed by Guido van Rossum
parent aa6f4a07c1
commit beb9183103
2 changed files with 5 additions and 5 deletions

View File

@@ -681,11 +681,11 @@ def divmod(a: int, b: int) -> Tuple[int, int]: ...
def divmod(a: float, b: float) -> Tuple[float, float]: ...
def exit(code: int = ...) -> None: ...
@overload
def filter(function: None,
iterable: Iterable[Optional[_T]]) -> List[_T]: ...
@overload
def filter(function: Callable[[_T], Any],
iterable: Iterable[_T]) -> List[_T]: ...
@overload
def filter(function: None,
iterable: Iterable[Optional[_T]]) -> List[_T]: ...
def format(o: object, format_spec: str = '') -> str: ... # TODO unicode
def getattr(o: Any, name: unicode, default: Any = None) -> Any: ...
def hasattr(o: Any, name: unicode) -> bool: ...

View File

@@ -697,9 +697,9 @@ def exec(object: str, globals: Dict[str, Any] = None,
locals: Mapping[str, Any] = None) -> Any: ... # TODO code object as source
def exit(code: int = None) -> None: ...
@overload
def filter(function: None, iterable: Iterable[Optional[_T]]) -> Iterator[_T]: ...
@overload
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: ...
def getattr(o: Any, name: str, default: Any = ...) -> Any: ...
def globals() -> Dict[str, Any]: ...