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

@@ -46,36 +46,36 @@ CertificateError = SSLCertVerificationError
def wrap_socket(
sock: socket.socket,
keyfile: StrOrBytesPath | None = ...,
certfile: StrOrBytesPath | None = ...,
server_side: bool = ...,
cert_reqs: int = ...,
ssl_version: int = ...,
ca_certs: str | None = ...,
do_handshake_on_connect: bool = ...,
suppress_ragged_eofs: bool = ...,
ciphers: str | None = ...,
keyfile: StrOrBytesPath | None = None,
certfile: StrOrBytesPath | None = None,
server_side: bool = False,
cert_reqs: int = 0,
ssl_version: int = 2,
ca_certs: str | None = None,
do_handshake_on_connect: bool = True,
suppress_ragged_eofs: bool = True,
ciphers: str | None = None,
) -> SSLSocket: ...
def create_default_context(
purpose: Purpose = ...,
*,
cafile: StrOrBytesPath | None = ...,
capath: StrOrBytesPath | None = ...,
cadata: str | ReadableBuffer | None = ...,
cafile: StrOrBytesPath | None = None,
capath: StrOrBytesPath | None = None,
cadata: str | ReadableBuffer | None = None,
) -> SSLContext: ...
if sys.version_info >= (3, 10):
def _create_unverified_context(
protocol: int | None = None,
*,
cert_reqs: int = ...,
check_hostname: bool = ...,
cert_reqs: int = 0,
check_hostname: bool = False,
purpose: Purpose = ...,
certfile: StrOrBytesPath | None = ...,
keyfile: StrOrBytesPath | None = ...,
cafile: StrOrBytesPath | None = ...,
capath: StrOrBytesPath | None = ...,
cadata: str | ReadableBuffer | None = ...,
certfile: StrOrBytesPath | None = None,
keyfile: StrOrBytesPath | None = None,
cafile: StrOrBytesPath | None = None,
capath: StrOrBytesPath | None = None,
cadata: str | ReadableBuffer | None = None,
) -> SSLContext: ...
else:
@@ -107,7 +107,7 @@ def cert_time_to_seconds(cert_time: str) -> int: ...
if sys.version_info >= (3, 10):
def get_server_certificate(
addr: tuple[str, int], ssl_version: int = ..., ca_certs: str | None = ..., timeout: float = ...
addr: tuple[str, int], ssl_version: int = 16, ca_certs: str | None = None, timeout: float = ...
) -> str: ...
else:
@@ -315,22 +315,22 @@ class SSLSocket(socket.socket):
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
def connect(self, addr: socket._Address) -> None: ...
def connect_ex(self, addr: socket._Address) -> int: ...
def recv(self, buflen: int = ..., flags: int = ...) -> bytes: ...
def recv_into(self, buffer: WriteableBuffer, nbytes: int | None = ..., flags: int = ...) -> int: ...
def recvfrom(self, buflen: int = ..., flags: int = ...) -> tuple[bytes, socket._RetAddress]: ...
def recv(self, buflen: int = 1024, flags: int = 0) -> bytes: ...
def recv_into(self, buffer: WriteableBuffer, nbytes: int | None = None, flags: int = 0) -> int: ...
def recvfrom(self, buflen: int = 1024, flags: int = 0) -> tuple[bytes, socket._RetAddress]: ...
def recvfrom_into(
self, buffer: WriteableBuffer, nbytes: int | None = ..., flags: int = ...
self, buffer: WriteableBuffer, nbytes: int | None = None, flags: int = 0
) -> tuple[int, socket._RetAddress]: ...
def send(self, data: ReadableBuffer, flags: int = ...) -> int: ...
def sendall(self, data: ReadableBuffer, flags: int = ...) -> None: ...
def send(self, data: ReadableBuffer, flags: int = 0) -> int: ...
def sendall(self, data: ReadableBuffer, flags: int = 0) -> None: ...
@overload
def sendto(self, data: ReadableBuffer, flags_or_addr: socket._Address, addr: None = ...) -> int: ...
@overload
def sendto(self, data: ReadableBuffer, flags_or_addr: int, addr: socket._Address) -> int: ...
def shutdown(self, how: int) -> None: ...
def read(self, len: int = ..., buffer: bytearray | None = ...) -> bytes: ...
def read(self, len: int = 1024, buffer: bytearray | None = None) -> bytes: ...
def write(self, data: ReadableBuffer) -> int: ...
def do_handshake(self, block: bool = ...) -> None: ... # block is undocumented
def do_handshake(self, block: bool = False) -> None: ... # block is undocumented
@overload
def getpeercert(self, binary_form: Literal[False] = ...) -> _PeerCertRetDictType | None: ...
@overload
@@ -340,7 +340,7 @@ class SSLSocket(socket.socket):
def cipher(self) -> tuple[str, str, int] | None: ...
def shared_ciphers(self) -> list[tuple[str, str, int]] | None: ...
def compression(self) -> str | None: ...
def get_channel_binding(self, cb_type: str = ...) -> bytes | None: ...
def get_channel_binding(self, cb_type: str = "tls-unique") -> bytes | None: ...
def selected_alpn_protocol(self) -> str | None: ...
def selected_npn_protocol(self) -> str | None: ...
def accept(self) -> tuple[SSLSocket, socket._RetAddress]: ...
@@ -381,11 +381,14 @@ class SSLContext:
def __new__(cls: type[Self], protocol: int = ..., *args: Any, **kwargs: Any) -> Self: ...
def cert_store_stats(self) -> dict[str, int]: ...
def load_cert_chain(
self, certfile: StrOrBytesPath, keyfile: StrOrBytesPath | None = ..., password: _PasswordType | None = ...
self, certfile: StrOrBytesPath, keyfile: StrOrBytesPath | None = None, password: _PasswordType | None = None
) -> None: ...
def load_default_certs(self, purpose: Purpose = ...) -> None: ...
def load_verify_locations(
self, cafile: StrOrBytesPath | None = ..., capath: StrOrBytesPath | None = ..., cadata: str | ReadableBuffer | None = ...
self,
cafile: StrOrBytesPath | None = None,
capath: StrOrBytesPath | None = None,
cadata: str | ReadableBuffer | None = None,
) -> None: ...
@overload
def get_ca_certs(self, binary_form: Literal[False] = ...) -> list[_PeerCertRetDictType]: ...
@@ -404,19 +407,19 @@ class SSLContext:
def wrap_socket(
self,
sock: socket.socket,
server_side: bool = ...,
do_handshake_on_connect: bool = ...,
suppress_ragged_eofs: bool = ...,
server_hostname: str | None = ...,
session: SSLSession | None = ...,
server_side: bool = False,
do_handshake_on_connect: bool = True,
suppress_ragged_eofs: bool = True,
server_hostname: str | None = None,
session: SSLSession | None = None,
) -> SSLSocket: ...
def wrap_bio(
self,
incoming: MemoryBIO,
outgoing: MemoryBIO,
server_side: bool = ...,
server_hostname: str | None = ...,
session: SSLSession | None = ...,
server_side: bool = False,
server_hostname: str | None = None,
session: SSLSession | None = None,
) -> SSLObject: ...
def session_stats(self) -> dict[str, int]: ...
@@ -430,7 +433,7 @@ class SSLObject:
@property
def session_reused(self) -> bool: ...
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
def read(self, len: int = ..., buffer: bytearray | None = ...) -> bytes: ...
def read(self, len: int = 1024, buffer: bytearray | None = None) -> bytes: ...
def write(self, data: ReadableBuffer) -> int: ...
@overload
def getpeercert(self, binary_form: Literal[False] = ...) -> _PeerCertRetDictType | None: ...
@@ -447,7 +450,7 @@ class SSLObject:
def do_handshake(self) -> None: ...
def unwrap(self) -> None: ...
def version(self) -> str | None: ...
def get_channel_binding(self, cb_type: str = ...) -> bytes | None: ...
def get_channel_binding(self, cb_type: str = "tls-unique") -> bytes | None: ...
if sys.version_info >= (3, 8):
def verify_client_post_handshake(self) -> None: ...