Misc stub fixes (#181)

This commit is contained in:
Jukka Lehtosalo
2016-05-05 00:54:57 +01:00
committed by Guido van Rossum
parent c21d8a41d5
commit 292447bd62
10 changed files with 52 additions and 33 deletions

View File

@@ -1,6 +1,6 @@
# Stubs for operator
from typing import Any, Callable
from typing import Any, Callable, overload, Tuple
def __abs__(a: Any) -> Any: ...
def __add__(a: Any, b: Any) -> Any: ...
@@ -114,14 +114,22 @@ def truediv(a: Any, b: Any) -> Any: ...
def truth(x: Any) -> bool: ...
def xor(a: Any, b: Any) -> Any: ...
# Unsupported feature: "If more than one attribute is requested,
# returns a tuple of attributes."
# Unsupported: more than 3 attributes.
# Unsupported: on Python 2 the parameter type should be `basestring`.
def attrgetter(attr: str) -> Callable[[Any], Any]: ...
@overload
def attrgetter(attr1: str) -> Callable[[Any], Any]: ...
@overload
def attrgetter(attr1: str, attr2: str) -> Callable[[Any], Tuple[Any, Any]]: ...
@overload
def attrgetter(attr1: str, attr2: str, attr3: str) -> Callable[[Any], Tuple[Any, Any, Any]]: ...
# Unsupported feature: "If multiple items are specified, returns a
# tuple of lookup values."
def itemgetter(item: Any) -> Callable[[Any], Any]: ...
# Unsupported: more than 3 items.
@overload
def itemgetter(item1: Any) -> Callable[[Any], Any]: ...
@overload
def itemgetter(item1: Any, item2: Any) -> Callable[[Any], Tuple[Any, Any]]: ...
@overload
def itemgetter(item1: Any, item2: Any, item3: Any) -> Callable[[Any], Tuple[Any, Any, Any]]: ...
# Unsupported: on Python 2 the parameter type should be `basestring`.
def methodcaller(name: str, *args, **kwargs) -> Callable[[Any], Any]: ...