Add default values for third-party stubs beginning with 'P' (#9957)

This commit is contained in:
Alex Waygood
2023-03-27 18:58:53 +01:00
committed by GitHub
parent 20f9b3685d
commit 6fd7e36e80
248 changed files with 2181 additions and 2133 deletions

View File

@@ -116,18 +116,18 @@ class Session: ...
class Connection:
def __getattr__(self, name: str) -> Any: ... # takes attributes from `self._socket`
def __init__(self, context: Context, socket: socket.socket | None = ...) -> None: ...
def __init__(self, context: Context, socket: socket.socket | None = None) -> None: ...
def get_context(self) -> Context: ...
def set_context(self, context: Context) -> None: ...
def get_servername(self) -> bytes | None: ...
def set_tlsext_host_name(self, name: bytes) -> None: ...
def pending(self) -> int: ...
def send(self, buf: ReadableBuffer | str, flags: int = ...) -> int: ...
def send(self, buf: ReadableBuffer | str, flags: int = 0) -> int: ...
write = send
def sendall(self, buf: ReadableBuffer | str, flags: int = ...) -> int: ...
def recv(self, bufsiz: int, flags: int | None = ...) -> bytes: ...
def sendall(self, buf: ReadableBuffer | str, flags: int = 0) -> int: ...
def recv(self, bufsiz: int, flags: int | None = None) -> bytes: ...
read = recv
def recv_into(self, buffer: MutableSequence[int], nbytes: int | None = ..., flags: int | None = ...) -> int: ...
def recv_into(self, buffer: MutableSequence[int], nbytes: int | None = None, flags: int | None = None) -> int: ...
def connect(self, addr: str | bytes | Sequence[str | int]) -> None: ...
def connect_ex(self, addr: _Address | bytes) -> int: ...
def accept(self) -> tuple[Connection, _RetAddress]: ...
@@ -162,7 +162,7 @@ class Connection:
def client_random(self) -> bytes | None: ...
def master_key(self) -> bytes | None: ...
def export_keying_material(
self, label: Incomplete, olen: Incomplete, context: Incomplete = ...
self, label: Incomplete, olen: Incomplete, context: Incomplete = None
) -> Incomplete: ... # TODO: type, see RFC-5705
def get_app_data(self) -> Any: ...
def set_app_data(self, data: Any) -> None: ...
@@ -182,13 +182,13 @@ _T = TypeVar("_T")
class Context:
def __getattr__(self, name: str) -> Incomplete: ...
def __init__(self, method: int) -> None: ...
def load_verify_locations(self, cafile: str | None, capath: str | None = ...) -> None: ...
def load_verify_locations(self, cafile: str | None, capath: str | None = None) -> None: ...
def set_options(self, options: int) -> None: ...
def set_verify(self, mode: int, callback: Callable[[Connection, X509, int, int, int], bool] | None = ...) -> None: ...
def set_verify(self, mode: int, callback: Callable[[Connection, X509, int, int, int], bool] | None = None) -> None: ...
def set_min_proto_version(self, version: int) -> None: ...
def set_max_proto_version(self, version: int) -> None: ...
def use_certificate_chain_file(self, certfile: str | bytes) -> None: ...
def use_certificate_file(self, certfile: str | bytes, filetype: int = ...) -> None: ...
def use_certificate_file(self, certfile: str | bytes, filetype: int = 1) -> None: ...
def use_certificate(self, cert: X509) -> None: ...
def use_privatekey_file(self, keyfile: str | bytes, filetype: int | None = ...) -> None: ...
def use_privatekey(self, pkey: PKey) -> None: ...
@@ -197,7 +197,7 @@ class Context:
def set_keylog_callback(self, callback: Callable[[Connection, bytes], object]) -> None: ...
def set_alpn_protos(self, protos: Sequence[bytes]) -> None: ...
def set_alpn_select_callback(self, callback: Callable[[Connection, list[bytes]], bytes]) -> None: ...
def set_ocsp_server_callback(self, callback: Callable[[Connection, _T | None], bytes], data: _T | None = ...) -> None: ...
def set_ocsp_server_callback(self, callback: Callable[[Connection, _T | None], bytes], data: _T | None = None) -> None: ...
def set_ocsp_client_callback(
self, callback: Callable[[Connection, bytes, _T | None], bool], data: _T | None = ...
self, callback: Callable[[Connection, bytes, _T | None], bool], data: _T | None = None
) -> None: ...

View File

@@ -98,7 +98,7 @@ class X509Req:
class X509Extension:
def __init__(
self, type_name: bytes, critical: bool, value: bytes, subject: X509 | None = ..., issuer: X509 | None = ...
self, type_name: bytes, critical: bool, value: bytes, subject: X509 | None = None, issuer: X509 | None = None
) -> None: ...
def get_critical(self) -> bool: ...
def get_data(self) -> bytes: ...
@@ -117,7 +117,7 @@ class Revoked:
class CRL:
def __init__(self) -> None: ...
def add_revoked(self, revoked: Revoked) -> None: ...
def export(self, cert: X509, key: PKey, type: int = ..., days: int = ..., digest: bytes = ...) -> bytes: ...
def export(self, cert: X509, key: PKey, type: int = 1, days: int = 100, digest: bytes = ...) -> bytes: ...
@classmethod
def from_cryptography(cls, crypto_crl: CertificateRevocationList) -> CRL: ...
def get_issuer(self) -> X509Name: ...
@@ -132,12 +132,12 @@ class X509Store:
def __init__(self) -> None: ...
def add_cert(self, cert: X509) -> None: ...
def add_crl(self, crl: CRL) -> None: ...
def load_locations(self, cafile: StrOrBytesPath, capath: StrOrBytesPath | None = ...) -> None: ...
def load_locations(self, cafile: StrOrBytesPath, capath: StrOrBytesPath | None = None) -> None: ...
def set_flags(self, flags: int) -> None: ...
def set_time(self, vfy_time: datetime) -> None: ...
class X509StoreContext:
def __init__(self, store: X509Store, certificate: X509, chain: Sequence[X509] | None = ...) -> None: ...
def __init__(self, store: X509Store, certificate: X509, chain: Sequence[X509] | None = None) -> None: ...
def get_verified_chain(self) -> list[X509]: ...
def set_store(self, store: X509Store) -> None: ...
def verify_certificate(self) -> None: ...
@@ -170,7 +170,7 @@ class PKCS7:
class PKCS12:
def __init__(self) -> None: ...
def export(self, passphrase: bytes | None = ..., iter: int = ..., maciter: int = ...) -> bytes: ...
def export(self, passphrase: bytes | None = None, iter: int = 2048, maciter: int = 1) -> bytes: ...
def get_ca_certificates(self) -> tuple[X509, ...]: ...
def get_certificate(self) -> X509: ...
def get_friendlyname(self) -> bytes | None: ...
@@ -195,14 +195,14 @@ def load_certificate(type: int, buffer: bytes) -> X509: ...
def dump_certificate_request(type: int, req: X509Req) -> bytes: ...
def load_certificate_request(type: int, buffer: bytes) -> X509Req: ...
def dump_privatekey(
type: int, pkey: PKey, cipher: str | None = ..., passphrase: bytes | Callable[[], bytes] | None = ...
type: int, pkey: PKey, cipher: str | None = None, passphrase: bytes | Callable[[], bytes] | None = None
) -> bytes: ...
def load_privatekey(type: int, buffer: str | bytes, passphrase: bytes | Callable[[], bytes] | None = ...) -> PKey: ...
def load_privatekey(type: int, buffer: str | bytes, passphrase: bytes | Callable[[], bytes] | None = None) -> PKey: ...
def dump_publickey(type: int, pkey: PKey) -> bytes: ...
def load_publickey(type: int, buffer: str | bytes) -> PKey: ...
def dump_crl(type: int, crl: CRL) -> bytes: ...
def load_crl(type: int, buffer: str | bytes) -> CRL: ...
def load_pkcs7_data(type: int, buffer: str | bytes) -> PKCS7: ...
def load_pkcs12(buffer: str | bytes, passphrase: bytes | None = ...) -> PKCS12: ...
def load_pkcs12(buffer: str | bytes, passphrase: bytes | None = None) -> PKCS12: ...
def sign(pkey: PKey, data: str | bytes, digest: str) -> bytes: ...
def verify(cert: X509, signature: bytes, data: str | bytes, digest: str) -> None: ...