stdlib: add argument default values (#9501)

This commit is contained in:
Jelle Zijlstra
2023-01-18 00:37:34 -08:00
committed by GitHub
parent 6cb934291f
commit ddfaca3200
272 changed files with 2529 additions and 2467 deletions

View File

@@ -655,7 +655,7 @@ class _SendableFile(Protocol):
class socket(_socket.socket):
def __init__(
self, family: AddressFamily | int = ..., type: SocketKind | int = ..., proto: int = ..., fileno: int | None = ...
self, family: AddressFamily | int = -1, type: SocketKind | int = -1, proto: int = -1, fileno: int | None = None
) -> None: ...
def __enter__(self: Self) -> Self: ...
def __exit__(self, *args: Unused) -> None: ...
@@ -723,7 +723,7 @@ class socket(_socket.socket):
errors: str | None = ...,
newline: str | None = ...,
) -> TextIOWrapper: ...
def sendfile(self, file: _SendableFile, offset: int = ..., count: int | None = ...) -> int: ...
def sendfile(self, file: _SendableFile, offset: int = 0, count: int | None = None) -> int: ...
@property
def family(self) -> AddressFamily: ... # type: ignore[override]
@property
@@ -731,14 +731,14 @@ class socket(_socket.socket):
def get_inheritable(self) -> bool: ...
def set_inheritable(self, inheritable: bool) -> None: ...
def fromfd(fd: _FD, family: AddressFamily | int, type: SocketKind | int, proto: int = ...) -> socket: ...
def fromfd(fd: _FD, family: AddressFamily | int, type: SocketKind | int, proto: int = 0) -> socket: ...
if sys.platform != "win32":
if sys.version_info >= (3, 9):
def send_fds(
sock: socket, buffers: Iterable[ReadableBuffer], fds: Iterable[int], flags: Unused = ..., address: Unused = ...
sock: socket, buffers: Iterable[ReadableBuffer], fds: Iterable[int], flags: Unused = 0, address: Unused = None
) -> int: ...
def recv_fds(sock: socket, bufsize: int, maxfds: int, flags: int = ...) -> tuple[bytes, list[int], int, Any]: ...
def recv_fds(sock: socket, bufsize: int, maxfds: int, flags: int = 0) -> tuple[bytes, list[int], int, Any]: ...
if sys.platform == "win32":
def fromshare(info: bytes) -> socket: ...
@@ -748,7 +748,7 @@ if sys.platform == "win32":
else:
def socketpair(
family: int | AddressFamily | None = ..., type: SocketType | int = ..., proto: int = ...
family: int | AddressFamily | None = None, type: SocketType | int = 1, proto: int = 0
) -> tuple[socket, socket]: ...
class SocketIO(RawIOBase):
@@ -760,15 +760,15 @@ class SocketIO(RawIOBase):
@property
def mode(self) -> Literal["rb", "wb", "rwb"]: ...
def getfqdn(name: str = ...) -> str: ...
def getfqdn(name: str = "") -> str: ...
if sys.version_info >= (3, 11):
def create_connection(
address: tuple[str | None, int],
timeout: float | None = ..., # noqa: F811
source_address: _Address | None = ...,
source_address: _Address | None = None,
*,
all_errors: bool = ...,
all_errors: bool = False,
) -> socket: ...
else:
@@ -779,15 +779,10 @@ else:
if sys.version_info >= (3, 8):
def has_dualstack_ipv6() -> bool: ...
def create_server(
address: _Address, *, family: int = ..., backlog: int | None = ..., reuse_port: bool = ..., dualstack_ipv6: bool = ...
address: _Address, *, family: int = 2, backlog: int | None = None, reuse_port: bool = False, dualstack_ipv6: bool = False
) -> socket: ...
# the 5th tuple item is an address
def getaddrinfo(
host: bytes | str | None,
port: bytes | str | int | None,
family: int = ...,
type: int = ...,
proto: int = ...,
flags: int = ...,
host: bytes | str | None, port: bytes | str | int | None, family: int = 0, type: int = 0, proto: int = 0, flags: int = 0
) -> list[tuple[AddressFamily, SocketKind, int, str, tuple[str, int] | tuple[str, int, int, int]]]: ...