drop union return type from getaddrinfo (#1002)

This commit is contained in:
Jelle Zijlstra
2017-03-14 11:45:09 -07:00
committed by Guido van Rossum
parent 11350ed8cc
commit 48b1962951
3 changed files with 9 additions and 3 deletions

View File

@@ -335,10 +335,12 @@ def create_connection(address: Tuple[str, int],
source_address: Tuple[str, int] = ...) -> socket: ...
# the 5th tuple item is an address
# TODO the "Tuple[Any, ...]" should be "Union[Tuple[str, int], Tuple[str, int, int, int]]" but that triggers
# https://github.com/python/mypy/issues/2509
def getaddrinfo(
host: Optional[str], port: Union[str, int, None], family: int = ...,
socktype: int = ..., proto: int = ...,
flags: int = ...) -> List[Tuple[int, int, int, str, Union[Tuple[str, int], Tuple[str, int, int, int]]]]:
flags: int = ...) -> List[Tuple[int, int, int, str, Tuple[Any, ...]]]:
...
def getfqdn(name: str = ...) -> str: ...

View File

@@ -93,8 +93,10 @@ class AbstractEventLoop(metaclass=ABCMeta):
# Network I/O methods returning Futures.
@abstractmethod
@coroutine
# TODO the "Tuple[Any, ...]" should be "Union[Tuple[str, int], Tuple[str, int, int, int]]" but that triggers
# https://github.com/python/mypy/issues/2509
def getaddrinfo(self, host: str, port: int, *,
family: int = ..., type: int = ..., proto: int = ..., flags: int = ...) -> Generator[Any, None, List[Tuple[int, int, int, str, Union[Tuple[str, int], Tuple[str, int, int, int]]]]]: ...
family: int = ..., type: int = ..., proto: int = ..., flags: int = ...) -> Generator[Any, None, List[Tuple[int, int, int, str, Tuple[Any, ...]]]]: ...
@abstractmethod
@coroutine
def getnameinfo(self, sockaddr: tuple, flags: int = ...) -> Generator[Any, None, Tuple[str, int]]: ...

View File

@@ -331,10 +331,12 @@ def create_connection(address: Tuple[str, int],
source_address: Tuple[str, int] = ...) -> socket: ...
# the 5th tuple item is an address
# TODO the "Tuple[Any, ...]" should be "Union[Tuple[str, int], Tuple[str, int, int, int]]" but that triggers
# https://github.com/python/mypy/issues/2509
def getaddrinfo(
host: Optional[str], port: Union[str, int, None], family: int = ...,
socktype: int = ..., proto: int = ...,
flags: int = ...) -> List[Tuple[int, int, int, str, Union[Tuple[str, int], Tuple[str, int, int, int]]]]:
flags: int = ...) -> List[Tuple[int, int, int, str, Tuple[Any, ...]]]:
...
def getfqdn(name: str = ...) -> str: ...