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

@@ -11,9 +11,9 @@ class Key:
def public_key(self) -> Self: ...
def to_pem(self) -> bytes: ...
def to_dict(self) -> dict[str, Any]: ...
def encrypt(self, plain_text: str | bytes, aad: bytes | None = ...) -> tuple[bytes, bytes, bytes | None]: ...
def encrypt(self, plain_text: str | bytes, aad: bytes | None = None) -> tuple[bytes, bytes, bytes | None]: ...
def decrypt(
self, cipher_text: str | bytes, iv: str | bytes | None = ..., aad: bytes | None = ..., tag: bytes | None = ...
self, cipher_text: str | bytes, iv: str | bytes | None = None, aad: bytes | None = None, tag: bytes | None = None
) -> bytes: ...
def wrap_key(self, key_data: bytes) -> bytes: ...
def unwrap_key(self, wrapped_key: bytes) -> bytes: ...

View File

@@ -38,7 +38,7 @@ class CryptographyRSAKey(Key):
def verify(self, msg, sig): ...
def is_public(self): ...
def public_key(self): ...
def to_pem(self, pem_format: str = ...): ...
def to_pem(self, pem_format: str = "PKCS8"): ...
def to_dict(self): ...
def wrap_key(self, key_data): ...
def unwrap_key(self, wrapped_key): ...
@@ -53,8 +53,10 @@ class CryptographyAESKey(Key):
MODES: Any
def __init__(self, key, algorithm) -> None: ...
def to_dict(self): ...
def encrypt(self, plain_text, aad: Incomplete | None = ...): ...
def decrypt(self, cipher_text, iv: Incomplete | None = ..., aad: Incomplete | None = ..., tag: Incomplete | None = ...): ...
def encrypt(self, plain_text, aad: Incomplete | None = None): ...
def decrypt(
self, cipher_text, iv: Incomplete | None = None, aad: Incomplete | None = None, tag: Incomplete | None = None
): ...
def wrap_key(self, key_data): ...
def unwrap_key(self, wrapped_key): ...

View File

@@ -9,7 +9,7 @@ RSA_ENCRYPTION_ASN1_OID: str
# Enable when we can use stubs from installed dependencies:
# from rsa import PublicKey
def pem_to_spki(pem, fmt: str = ...): ...
def pem_to_spki(pem, fmt: str = "PKCS8"): ...
class RSAKey(Key):
SHA256: str
@@ -21,7 +21,7 @@ class RSAKey(Key):
def verify(self, msg: bytes, sig: bytes) -> bool: ...
def is_public(self) -> bool: ...
def public_key(self) -> Self: ...
def to_pem(self, pem_format: str = ...) -> bytes: ...
def to_pem(self, pem_format: str = "PKCS8") -> bytes: ...
def to_dict(self) -> dict[str, Any]: ...
def wrap_key(self, key_data: bytes) -> bytes: ...
def unwrap_key(self, wrapped_key: bytes) -> bytes: ...

View File

@@ -7,11 +7,11 @@ def encrypt(
# Internally it's passed down to jwk.construct(), which explicitly checks for
# key as dict instance, instead of a Mapping
key: str | bytes | dict[str, Any] | Key,
encryption: str = ...,
algorithm: str = ...,
zip: str | None = ...,
cty: str | None = ...,
kid: str | None = ...,
encryption: str = "A256GCM",
algorithm: str = "dir",
zip: str | None = None,
cty: str | None = None,
kid: str | None = None,
) -> bytes: ...
def decrypt(
jwe_str: str | bytes,

View File

@@ -9,5 +9,5 @@ def register_key(algorithm: str, key_class: type[Key]) -> Literal[True]: ...
def construct(
# explicitly checks for key_data as dict instance, instead of a Mapping
key_data: str | bytes | dict[str, Any] | Key,
algorithm: str | None = ...,
algorithm: str | None = None,
) -> Key: ...

View File

@@ -8,8 +8,8 @@ def sign(
# Internally it's passed down to jwk.construct(), which explicitly checks for
# key as dict instance, instead of a Mapping
key: str | bytes | dict[str, Any] | Key,
headers: Mapping[str, Any] | None = ...,
algorithm: str = ...,
headers: Mapping[str, Any] | None = None,
algorithm: str = "HS256",
) -> str: ...
def verify(
token: str | bytes,
@@ -17,7 +17,7 @@ def verify(
# Callers of this function, like jwt.decode(), and functions called internally,
# like jws._verify_signature(), use and accept algorithms=None
algorithms: str | Container[str] | None,
verify: bool = ...,
verify: bool = True,
) -> bytes: ...
def get_unverified_header(token: str | bytes) -> dict[str, Any]: ...
def get_unverified_headers(token: str | bytes) -> dict[str, Any]: ...

View File

@@ -7,19 +7,19 @@ def encode(
claims: MutableMapping[str, Any],
# Internally it calls jws.sign() that expects a key dict instance instead of Mapping
key: str | bytes | dict[str, Any] | Key,
algorithm: str = ...,
headers: Mapping[str, Any] | None = ...,
access_token: str | None = ...,
algorithm: str = "HS256",
headers: Mapping[str, Any] | None = None,
access_token: str | None = None,
) -> str: ...
def decode(
token: str | bytes,
key: str | bytes | Mapping[str, Any] | Key,
algorithms: str | Container[str] | None = ...,
options: Mapping[str, Any] | None = ...,
audience: str | None = ...,
issuer: str | Iterable[str] | None = ...,
subject: str | None = ...,
access_token: str | None = ...,
algorithms: str | Container[str] | None = None,
options: Mapping[str, Any] | None = None,
audience: str | None = None,
issuer: str | Iterable[str] | None = None,
subject: str | None = None,
access_token: str | None = None,
) -> dict[str, Any]: ...
def get_unverified_header(token: str | bytes) -> dict[str, Any]: ...
def get_unverified_headers(token: str | bytes) -> dict[str, Any]: ...

View File

@@ -3,8 +3,8 @@ from datetime import timedelta
from hashlib import _Hash
from typing import Any
def long_to_bytes(n: int, blocksize: int | None = ...) -> bytes: ...
def long_to_base64(data: int, size: int | None = ...) -> bytes: ...
def long_to_bytes(n: int, blocksize: int | None = 0) -> bytes: ...
def long_to_base64(data: int, size: int | None = 0) -> bytes: ...
def int_arr_to_long(arr: Iterable[Any]) -> int: ...
def base64_to_long(data: str | bytes) -> int: ...
def calculate_at_hash(access_token: str, hash_alg: Callable[[bytes], _Hash]) -> str: ...