Add more defaults to the stdlib (#9606)

Continuing work towards #8988.

The first five commits were created using stubdefaulter on various Python versions; the following commits were all created manually by me to fix various problems. The main things this adds that weren't present in #9501 are:

- Defaults in Windows-only modules and Windows-only branches (because I'm running a Windows machine)
- Defaults in non-py311 branches
- Defaults for float parameters
- Defaults for overloads
This commit is contained in:
Alex Waygood
2023-01-29 01:51:23 +00:00
committed by GitHub
parent 25e02db42c
commit 33a62ae42d
150 changed files with 2761 additions and 2704 deletions

View File

@@ -324,7 +324,7 @@ class SSLSocket(socket.socket):
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: ...
def sendto(self, data: ReadableBuffer, flags_or_addr: socket._Address, addr: None = None) -> int: ...
@overload
def sendto(self, data: ReadableBuffer, flags_or_addr: int, addr: socket._Address) -> int: ...
def shutdown(self, how: int) -> None: ...
@@ -332,7 +332,7 @@ class SSLSocket(socket.socket):
def write(self, data: ReadableBuffer) -> int: ...
def do_handshake(self, block: bool = False) -> None: ... # block is undocumented
@overload
def getpeercert(self, binary_form: Literal[False] = ...) -> _PeerCertRetDictType | None: ...
def getpeercert(self, binary_form: Literal[False] = False) -> _PeerCertRetDictType | None: ...
@overload
def getpeercert(self, binary_form: Literal[True]) -> bytes | None: ...
@overload
@@ -393,11 +393,11 @@ class SSLContext:
cadata: str | ReadableBuffer | None = None,
) -> None: ...
@overload
def get_ca_certs(self, binary_form: Literal[False] = ...) -> list[_PeerCertRetDictType]: ...
def get_ca_certs(self, binary_form: Literal[False] = False) -> list[_PeerCertRetDictType]: ...
@overload
def get_ca_certs(self, binary_form: Literal[True]) -> list[bytes]: ...
@overload
def get_ca_certs(self, binary_form: bool = ...) -> Any: ...
def get_ca_certs(self, binary_form: bool = False) -> Any: ...
def get_ciphers(self) -> list[_Cipher]: ...
def set_default_verify_paths(self) -> None: ...
def set_ciphers(self, __cipherlist: str) -> None: ...
@@ -438,7 +438,7 @@ class SSLObject:
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: ...
def getpeercert(self, binary_form: Literal[False] = False) -> _PeerCertRetDictType | None: ...
@overload
def getpeercert(self, binary_form: Literal[True]) -> bytes | None: ...
@overload