mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 05:24:52 +08:00
socket.create_connection source_address can be bytes or bytearray too (#2370)
* socket.create_connection source_address can be bytes or bytearray too * Sync applicable socket.create_connection changes to socket.getaddrinfo
This commit is contained in:
committed by
Jelle Zijlstra
parent
850d16a668
commit
066d8becf9
@@ -6,7 +6,7 @@
|
||||
# see: http://nullege.com/codes/search/socket
|
||||
# adapted for Python 2.7 by Michal Pokorny
|
||||
import sys
|
||||
from typing import Any, Iterable, Tuple, List, Optional, Union, overload, TypeVar
|
||||
from typing import Any, Iterable, Tuple, List, Optional, Union, overload, TypeVar, Text
|
||||
|
||||
_WriteBuffer = Union[bytearray, memoryview]
|
||||
|
||||
@@ -579,13 +579,13 @@ class socket:
|
||||
# ----- functions -----
|
||||
def create_connection(address: Tuple[Optional[str], int],
|
||||
timeout: float = ...,
|
||||
source_address: Tuple[str, int] = ...) -> socket: ...
|
||||
source_address: Tuple[Union[bytearray, bytes, Text], 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 = ...,
|
||||
host: Optional[Union[bytearray, bytes, Text]], port: Union[str, int, None], family: int = ...,
|
||||
socktype: int = ..., proto: int = ...,
|
||||
flags: int = ...) -> List[Tuple[int, int, int, str, Tuple[Any, ...]]]:
|
||||
...
|
||||
|
||||
Reference in New Issue
Block a user