[stdlib] Add more default values (#14632)

This commit is contained in:
Semyon Moroz
2025-08-24 15:56:42 +00:00
committed by GitHub
parent e8ba06f710
commit 91e2ed0953
16 changed files with 158 additions and 152 deletions
+13 -13
View File
@@ -10,7 +10,7 @@ from asyncio.transports import BaseTransport, DatagramTransport, ReadTransport,
from collections.abc import Callable, Iterable, Sequence
from concurrent.futures import Executor, ThreadPoolExecutor
from contextvars import Context
from socket import AddressFamily, SocketKind, _Address, _RetAddress, socket
from socket import AddressFamily, AddressInfo, SocketKind, _Address, _RetAddress, socket
from typing import IO, Any, Literal, TypeVar, overload
from typing_extensions import TypeAlias, TypeVarTuple, Unpack
@@ -235,8 +235,8 @@ class BaseEventLoop(AbstractEventLoop):
host: str | Sequence[str] | None = None,
port: int = ...,
*,
family: int = ...,
flags: int = ...,
family: int = 0,
flags: int = 1,
sock: None = None,
backlog: int = 100,
ssl: _SSLContext = None,
@@ -254,8 +254,8 @@ class BaseEventLoop(AbstractEventLoop):
host: None = None,
port: None = None,
*,
family: int = ...,
flags: int = ...,
family: int = 0,
flags: int = 1,
sock: socket = ...,
backlog: int = 100,
ssl: _SSLContext = None,
@@ -274,8 +274,8 @@ class BaseEventLoop(AbstractEventLoop):
host: str | Sequence[str] | None = None,
port: int = ...,
*,
family: int = ...,
flags: int = ...,
family: int = AddressFamily.AF_UNSPEC,
flags: int = AddressInfo.AI_PASSIVE,
sock: None = None,
backlog: int = 100,
ssl: _SSLContext = None,
@@ -292,8 +292,8 @@ class BaseEventLoop(AbstractEventLoop):
host: None = None,
port: None = None,
*,
family: int = ...,
flags: int = ...,
family: int = AddressFamily.AF_UNSPEC,
flags: int = AddressInfo.AI_PASSIVE,
sock: socket = ...,
backlog: int = 100,
ssl: _SSLContext = None,
@@ -311,8 +311,8 @@ class BaseEventLoop(AbstractEventLoop):
host: str | Sequence[str] | None = None,
port: int = ...,
*,
family: int = ...,
flags: int = ...,
family: int = AddressFamily.AF_UNSPEC,
flags: int = AddressInfo.AI_PASSIVE,
sock: None = None,
backlog: int = 100,
ssl: _SSLContext = None,
@@ -328,8 +328,8 @@ class BaseEventLoop(AbstractEventLoop):
host: None = None,
port: None = None,
*,
family: int = ...,
flags: int = ...,
family: int = AddressFamily.AF_UNSPEC,
flags: int = AddressInfo.AI_PASSIVE,
sock: socket = ...,
backlog: int = 100,
ssl: _SSLContext = None,
+14 -14
View File
@@ -11,7 +11,7 @@ from abc import ABCMeta, abstractmethod
from collections.abc import Callable, Sequence
from concurrent.futures import Executor
from contextvars import Context
from socket import AddressFamily, SocketKind, _Address, _RetAddress, socket
from socket import AddressFamily, AddressInfo, SocketKind, _Address, _RetAddress, socket
from typing import IO, Any, Literal, Protocol, TypeVar, overload, type_check_only
from typing_extensions import Self, TypeAlias, TypeVarTuple, Unpack, deprecated
@@ -289,8 +289,8 @@ class AbstractEventLoop:
host: str | Sequence[str] | None = None,
port: int = ...,
*,
family: int = ...,
flags: int = ...,
family: int = AddressFamily.AF_UNSPEC,
flags: int = AddressInfo.AI_PASSIVE,
sock: None = None,
backlog: int = 100,
ssl: _SSLContext = None,
@@ -309,8 +309,8 @@ class AbstractEventLoop:
host: None = None,
port: None = None,
*,
family: int = ...,
flags: int = ...,
family: int = AddressFamily.AF_UNSPEC,
flags: int = AddressInfo.AI_PASSIVE,
sock: socket = ...,
backlog: int = 100,
ssl: _SSLContext = None,
@@ -330,8 +330,8 @@ class AbstractEventLoop:
host: str | Sequence[str] | None = None,
port: int = ...,
*,
family: int = ...,
flags: int = ...,
family: int = AddressFamily.AF_UNSPEC,
flags: int = AddressInfo.AI_PASSIVE,
sock: None = None,
backlog: int = 100,
ssl: _SSLContext = None,
@@ -349,8 +349,8 @@ class AbstractEventLoop:
host: None = None,
port: None = None,
*,
family: int = ...,
flags: int = ...,
family: int = AddressFamily.AF_UNSPEC,
flags: int = AddressInfo.AI_PASSIVE,
sock: socket = ...,
backlog: int = 100,
ssl: _SSLContext = None,
@@ -369,8 +369,8 @@ class AbstractEventLoop:
host: str | Sequence[str] | None = None,
port: int = ...,
*,
family: int = ...,
flags: int = ...,
family: int = AddressFamily.AF_UNSPEC,
flags: int = AddressInfo.AI_PASSIVE,
sock: None = None,
backlog: int = 100,
ssl: _SSLContext = None,
@@ -387,8 +387,8 @@ class AbstractEventLoop:
host: None = None,
port: None = None,
*,
family: int = ...,
flags: int = ...,
family: int = AddressFamily.AF_UNSPEC,
flags: int = AddressInfo.AI_PASSIVE,
sock: socket = ...,
backlog: int = 100,
ssl: _SSLContext = None,
@@ -536,7 +536,7 @@ class AbstractEventLoop:
bufsize: Literal[0] = 0,
encoding: None = None,
errors: None = None,
text: Literal[False] | None = ...,
text: Literal[False] | None = None,
**kwargs: Any,
) -> tuple[SubprocessTransport, _ProtocolT]: ...
@abstractmethod
+4 -4
View File
@@ -34,7 +34,7 @@ if sys.version_info >= (3, 10):
port: int | str | None = None,
*,
limit: int = 65536,
ssl_handshake_timeout: float | None = ...,
ssl_handshake_timeout: float | None = None,
**kwds: Any,
) -> tuple[StreamReader, StreamWriter]: ...
async def start_server(
@@ -43,7 +43,7 @@ if sys.version_info >= (3, 10):
port: int | str | None = None,
*,
limit: int = 65536,
ssl_handshake_timeout: float | None = ...,
ssl_handshake_timeout: float | None = None,
**kwds: Any,
) -> Server: ...
@@ -54,7 +54,7 @@ else:
*,
loop: events.AbstractEventLoop | None = None,
limit: int = 65536,
ssl_handshake_timeout: float | None = ...,
ssl_handshake_timeout: float | None = None,
**kwds: Any,
) -> tuple[StreamReader, StreamWriter]: ...
async def start_server(
@@ -64,7 +64,7 @@ else:
*,
loop: events.AbstractEventLoop | None = None,
limit: int = 65536,
ssl_handshake_timeout: float | None = ...,
ssl_handshake_timeout: float | None = None,
**kwds: Any,
) -> Server: ...
+6 -6
View File
@@ -60,7 +60,7 @@ if sys.version_info >= (3, 11):
creationflags: int = 0,
restore_signals: bool = True,
start_new_session: bool = False,
pass_fds: Collection[int] = ...,
pass_fds: Collection[int] = (),
group: None | str | int = None,
extra_groups: None | Collection[str | int] = None,
user: None | str | int = None,
@@ -92,7 +92,7 @@ if sys.version_info >= (3, 11):
creationflags: int = 0,
restore_signals: bool = True,
start_new_session: bool = False,
pass_fds: Collection[int] = ...,
pass_fds: Collection[int] = (),
group: None | str | int = None,
extra_groups: None | Collection[str | int] = None,
user: None | str | int = None,
@@ -126,7 +126,7 @@ elif sys.version_info >= (3, 10):
creationflags: int = 0,
restore_signals: bool = True,
start_new_session: bool = False,
pass_fds: Collection[int] = ...,
pass_fds: Collection[int] = (),
group: None | str | int = None,
extra_groups: None | Collection[str | int] = None,
user: None | str | int = None,
@@ -157,7 +157,7 @@ elif sys.version_info >= (3, 10):
creationflags: int = 0,
restore_signals: bool = True,
start_new_session: bool = False,
pass_fds: Collection[int] = ...,
pass_fds: Collection[int] = (),
group: None | str | int = None,
extra_groups: None | Collection[str | int] = None,
user: None | str | int = None,
@@ -191,7 +191,7 @@ else: # >= 3.9
creationflags: int = 0,
restore_signals: bool = True,
start_new_session: bool = False,
pass_fds: Collection[int] = ...,
pass_fds: Collection[int] = (),
group: None | str | int = None,
extra_groups: None | Collection[str | int] = None,
user: None | str | int = None,
@@ -222,7 +222,7 @@ else: # >= 3.9
creationflags: int = 0,
restore_signals: bool = True,
start_new_session: bool = False,
pass_fds: Collection[int] = ...,
pass_fds: Collection[int] = (),
group: None | str | int = None,
extra_groups: None | Collection[str | int] = None,
user: None | str | int = None,
+17 -12
View File
@@ -63,7 +63,7 @@ class TransportSocket:
@deprecated("Removed in Python 3.11")
def makefile(self) -> BinaryIO: ...
@deprecated("Rmoved in Python 3.11")
def sendfile(self, file: BinaryIO, offset: int = ..., count: int | None = ...) -> int: ...
def sendfile(self, file: BinaryIO, offset: int = 0, count: int | None = None) -> int: ...
@deprecated("Removed in Python 3.11")
def close(self) -> None: ...
@deprecated("Removed in Python 3.11")
@@ -71,17 +71,22 @@ class TransportSocket:
if sys.platform == "linux":
@deprecated("Removed in Python 3.11")
def sendmsg_afalg(
self, msg: Iterable[ReadableBuffer] = ..., *, op: int, iv: Any = ..., assoclen: int = ..., flags: int = ...
self, msg: Iterable[ReadableBuffer] = ..., *, op: int, iv: Any = ..., assoclen: int = ..., flags: int = 0
) -> int: ...
else:
@deprecated("Removed in Python 3.11.")
def sendmsg_afalg(
self, msg: Iterable[ReadableBuffer] = ..., *, op: int, iv: Any = ..., assoclen: int = ..., flags: int = ...
self, msg: Iterable[ReadableBuffer] = ..., *, op: int, iv: Any = ..., assoclen: int = ..., flags: int = 0
) -> NoReturn: ...
@deprecated("Removed in Python 3.11.")
def sendmsg(
self, buffers: Iterable[ReadableBuffer], ancdata: Iterable[_CMSG] = ..., flags: int = ..., address: _Address = ..., /
self,
buffers: Iterable[ReadableBuffer],
ancdata: Iterable[_CMSG] = ...,
flags: int = 0,
address: _Address | None = None,
/,
) -> int: ...
@overload
@deprecated("Removed in Python 3.11.")
@@ -90,9 +95,9 @@ class TransportSocket:
@deprecated("Removed in Python 3.11.")
def sendto(self, data: ReadableBuffer, flags: int, address: _Address) -> int: ...
@deprecated("Removed in Python 3.11.")
def send(self, data: ReadableBuffer, flags: int = ...) -> int: ...
def send(self, data: ReadableBuffer, flags: int = 0) -> int: ...
@deprecated("Removed in Python 3.11.")
def sendall(self, data: ReadableBuffer, flags: int = ...) -> None: ...
def sendall(self, data: ReadableBuffer, flags: int = 0) -> None: ...
@deprecated("Removed in Python 3.11.")
def set_inheritable(self, inheritable: bool) -> None: ...
if sys.platform == "win32":
@@ -103,19 +108,19 @@ class TransportSocket:
def share(self, process_id: int) -> NoReturn: ...
@deprecated("Removed in Python 3.11.")
def recv_into(self, buffer: _WriteBuffer, nbytes: int = ..., flags: int = ...) -> int: ...
def recv_into(self, buffer: _WriteBuffer, nbytes: int = 0, flags: int = 0) -> int: ...
@deprecated("Removed in Python 3.11.")
def recvfrom_into(self, buffer: _WriteBuffer, nbytes: int = ..., flags: int = ...) -> tuple[int, _RetAddress]: ...
def recvfrom_into(self, buffer: _WriteBuffer, nbytes: int = 0, flags: int = 0) -> tuple[int, _RetAddress]: ...
@deprecated("Removed in Python 3.11.")
def recvmsg_into(
self, buffers: Iterable[_WriteBuffer], ancbufsize: int = ..., flags: int = ..., /
self, buffers: Iterable[_WriteBuffer], ancbufsize: int = 0, flags: int = 0, /
) -> tuple[int, list[_CMSG], int, Any]: ...
@deprecated("Removed in Python 3.11.")
def recvmsg(self, bufsize: int, ancbufsize: int = ..., flags: int = ..., /) -> tuple[bytes, list[_CMSG], int, Any]: ...
def recvmsg(self, bufsize: int, ancbufsize: int = 0, flags: int = 0, /) -> tuple[bytes, list[_CMSG], int, Any]: ...
@deprecated("Removed in Python 3.11.")
def recvfrom(self, bufsize: int, flags: int = ...) -> tuple[bytes, _RetAddress]: ...
def recvfrom(self, bufsize: int, flags: int = 0) -> tuple[bytes, _RetAddress]: ...
@deprecated("Removed in Python 3.11.")
def recv(self, bufsize: int, flags: int = ...) -> bytes: ...
def recv(self, bufsize: int, flags: int = 0) -> bytes: ...
@deprecated("Removed in Python 3.11.")
def __enter__(self) -> socket.socket: ...
@deprecated("Removed in Python 3.11.")
+3 -3
View File
@@ -34,9 +34,9 @@ if sys.platform == "win32":
def __new__(
cls,
args: subprocess._CMD,
stdin: subprocess._FILE | None = ...,
stdout: subprocess._FILE | None = ...,
stderr: subprocess._FILE | None = ...,
stdin: subprocess._FILE | None = None,
stdout: subprocess._FILE | None = None,
stderr: subprocess._FILE | None = None,
**kwds: Any,
) -> Self: ...
def __init__(