mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 20:54:28 +08:00
Consistently use '= ...' for optional parameters.
This commit is contained in:
@@ -276,8 +276,8 @@ class socket:
|
||||
type = 0
|
||||
proto = 0
|
||||
|
||||
def __init__(self, family: int = AF_INET, type: int = SOCK_STREAM,
|
||||
proto: int = 0, fileno: int = None) -> None: ...
|
||||
def __init__(self, family: int = ..., type: int = ...,
|
||||
proto: int = ..., fileno: int = ...) -> None: ...
|
||||
|
||||
# --- methods ---
|
||||
# second tuple item is an address
|
||||
@@ -317,26 +317,26 @@ class socket:
|
||||
option: Tuple[int, int, int]) -> None: ...
|
||||
def listen(self, backlog: int) -> None: ...
|
||||
# TODO the return value may be BinaryIO or TextIO, depending on mode
|
||||
def makefile(self, mode: str = 'r', buffering: int = None,
|
||||
encoding: str = None, errors: str = None,
|
||||
newline: str = None) -> Any:
|
||||
def makefile(self, mode: str = ..., buffering: int = ...,
|
||||
encoding: str = ..., errors: str = ...,
|
||||
newline: str = ...) -> Any:
|
||||
...
|
||||
def recv(self, bufsize: int, flags: int = 0) -> bytes: ...
|
||||
def recv(self, bufsize: int, flags: int = ...) -> bytes: ...
|
||||
|
||||
# return type is an address
|
||||
def recvfrom(self, bufsize: int, flags: int = 0) -> Any: ...
|
||||
def recvfrom(self, bufsize: int, flags: int = ...) -> Any: ...
|
||||
def recvfrom_into(self, buffer: bytes, nbytes: int,
|
||||
flags: int = 0) -> Any: ...
|
||||
flags: int = ...) -> Any: ...
|
||||
def recv_into(self, buffer: bytes, nbytes: int,
|
||||
flags: int = 0) -> Any: ...
|
||||
def send(self, data: bytes, flags=0) -> int: ...
|
||||
def sendall(self, data: bytes, flags=0) -> Any:
|
||||
flags: int = ...) -> Any: ...
|
||||
def send(self, data: bytes, flags=...) -> int: ...
|
||||
def sendall(self, data: bytes, flags=...) -> Any:
|
||||
... # return type: None on success
|
||||
|
||||
@overload
|
||||
def sendto(self, data: bytes, address: tuple, flags: int = 0) -> int: ...
|
||||
def sendto(self, data: bytes, address: tuple, flags: int = ...) -> int: ...
|
||||
@overload
|
||||
def sendto(self, data: bytes, address: str, flags: int = 0) -> int: ...
|
||||
def sendto(self, data: bytes, address: str, flags: int = ...) -> int: ...
|
||||
|
||||
def setblocking(self, flag: bool) -> None: ...
|
||||
# TODO None valid for the value argument
|
||||
@@ -352,28 +352,28 @@ class socket:
|
||||
|
||||
# ----- functions -----
|
||||
def create_connection(address: Tuple[str, int],
|
||||
timeout: float = _GLOBAL_DEFAULT_TIMEOUT,
|
||||
source_address: Tuple[str, int] = None) -> socket: ...
|
||||
timeout: float = ...,
|
||||
source_address: Tuple[str, int] = ...) -> socket: ...
|
||||
|
||||
# the 5th tuple item is an address
|
||||
def getaddrinfo(
|
||||
host: str, port: int, family: int = 0, type: int = 0, proto: int = 0,
|
||||
flags: int = 0) -> List[Tuple[int, int, int, str, tuple]]:
|
||||
host: str, port: int, family: int = ..., type: int = ..., proto: int = ...,
|
||||
flags: int = ...) -> List[Tuple[int, int, int, str, tuple]]:
|
||||
...
|
||||
|
||||
def getfqdn(name: str = '') -> str: ...
|
||||
def getfqdn(name: str = ...) -> str: ...
|
||||
def gethostbyname(hostname: str) -> str: ...
|
||||
def gethostbyname_ex(hostname: str) -> Tuple[str, List[str], List[str]]: ...
|
||||
def gethostname() -> str: ...
|
||||
def gethostbyaddr(ip_address: str) -> Tuple[str, List[str], List[str]]: ...
|
||||
def getnameinfo(sockaddr: tuple, flags: int) -> Tuple[str, int]: ...
|
||||
def getprotobyname(protocolname: str) -> int: ...
|
||||
def getservbyname(servicename: str, protocolname: str = None) -> int: ...
|
||||
def getservbyport(port: int, protocolname: str = None) -> str: ...
|
||||
def socketpair(family: int = AF_INET,
|
||||
type: int = SOCK_STREAM,
|
||||
proto: int = 0) -> Tuple[socket, socket]: ...
|
||||
def fromfd(fd: int, family: int, type: int, proto: int = 0) -> socket: ...
|
||||
def getservbyname(servicename: str, protocolname: str = ...) -> int: ...
|
||||
def getservbyport(port: int, protocolname: str = ...) -> str: ...
|
||||
def socketpair(family: int = ...,
|
||||
type: int = ...,
|
||||
proto: int = ...) -> Tuple[socket, socket]: ...
|
||||
def fromfd(fd: int, family: int, type: int, proto: int = ...) -> socket: ...
|
||||
def ntohl(x: int) -> int: ... # param & ret val are 32-bit ints
|
||||
def ntohs(x: int) -> int: ... # param & ret val are 16-bit ints
|
||||
def htonl(x: int) -> int: ... # param & ret val are 32-bit ints
|
||||
|
||||
Reference in New Issue
Block a user