Merge Python 2 and 3 versions of itsdangerous (#2564)

This commit is contained in:
Sebastian Rittau
2018-11-20 17:55:16 +01:00
committed by GitHub
parent 7685462672
commit 82c59a7fc2
3 changed files with 153 additions and 317 deletions

View File

@@ -1,155 +0,0 @@
from datetime import datetime
from itertools import izip
from typing import Any, Callable, IO, MutableMapping, Optional, Text, Tuple, Union
PY2 = ... # type: bool
text_type = unicode
int_to_byte = chr
number_types = (int, long, float)
_serializer = Any # must be an object that has "dumps" and "loads" attributes (e.g. the json module)
bytes_like = Union[bytearray, str]
class _CompactJSON:
def loads(self, payload: Text) -> Any: ...
def dumps(self, obj: Any) -> Text: ...
compact_json = _CompactJSON
EPOCH = ... # type: int
def want_bytes(s: str, encoding: str = ..., errors: str = ...) -> bytes: ...
def is_text_serializer(serializer: Any) -> bool: ...
def constant_time_compare(val1: bytes_like, val2: bytes_like) -> bool: ...
class BadData(Exception):
message = ... # type: str
def __init__(self, message: str) -> None: ...
class BadPayload(BadData):
original_error = ... # type: Optional[Exception]
def __init__(self, message: str, original_error: Optional[Exception] = ...) -> None: ...
class BadSignature(BadData):
payload = ... # type: Optional[Any]
def __init__(self, message: str, payload: Optional[Any] = ...) -> None: ...
class BadTimeSignature(BadSignature):
date_signed = ... # type: Optional[int]
def __init__(self, message, payload: Optional[Any] = ..., date_signed: Optional[int] = ...) -> None: ...
class BadHeader(BadSignature):
header = ... # type: Any
original_error = ... # type: Any
def __init__(self, message, payload: Optional[Any] = ..., header: Optional[Any] = ..., original_error: Optional[Any] = ...) -> None: ...
class SignatureExpired(BadTimeSignature): ...
def base64_encode(string: bytes_like) -> bytes: ...
def base64_decode(string: bytes_like) -> bytes: ...
def int_to_bytes(num: int) -> bytes: ...
def bytes_to_int(bytestr: bytes_like) -> bytes: ...
class SigningAlgorithm:
def get_signature(self, key: bytes_like, value: bytes_like) -> bytes: ...
def verify_signature(self, key: bytes_like, value: bytes_like, sig: bytes_like) -> bool: ...
class NoneAlgorithm(SigningAlgorithm):
def get_signature(self, key: bytes_like, value: bytes_like) -> str: ...
class HMACAlgorithm(SigningAlgorithm):
default_digest_method = ... # type: Callable
digest_method = ... # type: Callable
def __init__(self, digest_method: Optional[Callable] = ...) -> None: ...
def get_signature(self, key: bytes_like, value: bytes_like) -> bytes: ...
class Signer:
default_digest_method = ... # type: Callable
default_key_derivation = ... # type: str
secret_key = ... # type: bytes_like
sep = ... # type: str
salt = ... # type: bytes_like
key_derivation = ... # type: str
digest_method = ... # type: Callable
algorithm = ... # type: SigningAlgorithm
def __init__(self, secret_key: bytes_like, salt: Optional[bytes_like] = ..., sep: Optional[str] = ...,
key_derivation: Optional[str] = ...,
digest_method: Optional[Callable] = ...,
algorithm: Optional[SigningAlgorithm] = ...) -> None: ...
def derive_key(self) -> bytes: ...
def get_signature(self, value: bytes_like) -> bytes: ...
def sign(self, value: bytes_like) -> bytes: ...
def verify_signature(self, value: bytes_like, sig: bytes_like) -> bool: ...
def unsign(self, signed_value: str) -> str: ...
def validate(self, signed_value: str) -> bool: ...
class TimestampSigner(Signer):
def get_timestamp(self) -> int: ...
def timestamp_to_datetime(self, ts: int) -> datetime: ...
def sign(self, value: bytes_like) -> bytes: ...
def unsign(self, value: str, max_age: Optional[int] = ..., return_timestamp: bool = ...) -> Any: ...
def validate(self, signed_value: str, max_age: Optional[int] = ...) -> bool: ...
class Serializer:
default_serializer = ... # type: _serializer
default_signer = ... # type: Callable[..., Signer]
secret_key = ... # type: Any
salt = ... # type: bytes_like
serializer = ... # type: _serializer
is_text_serializer = ... # type: bool
signer = ... # type: Signer
signer_kwargs = ... # type: MutableMapping
def __init__(self, secret_key: bytes_like, salt: Optional[bytes_like] = ..., serializer: Optional[_serializer] = ...,
signer: Optional[Callable[..., Signer]] = ..., signer_kwargs: Optional[MutableMapping] = ...) -> None: ...
def load_payload(self, payload: Any, serializer: Optional[_serializer] = ...) -> Any: ...
def dump_payload(self, *args, **kwargs) -> str: ...
def make_signer(self, salt: Optional[bytes_like] = ...) -> Signer: ...
def dumps(self, obj: Any, salt: Optional[bytes_like] = ...) -> str: ...
def dump(self, obj: Any, f: IO[str], salt: Optional[bytes_like] = ...) -> None: ...
def loads(self, s: str, salt: Optional[bytes_like] = ...) -> Any: ...
def load(self, f: IO[str], salt: Optional[bytes_like] = ...): ...
def loads_unsafe(self, s, salt: Optional[bytes_like] = ...) -> Tuple[bool, Any]: ...
def load_unsafe(self, f: IO[str], *args, **kwargs) -> Tuple[bool, Any]: ...
class TimedSerializer(Serializer):
default_signer = ... # type: Callable[..., TimestampSigner]
def loads(self, s: str, salt: Optional[bytes_like] = ..., max_age: Optional[int] = ...,
return_timestamp: bool = ...) -> Any: ...
def loads_unsafe(self, s: str, salt: Optional[bytes_like] = ..., max_age: Optional[int] = ...) -> Tuple[bool, Any]: ...
class JSONWebSignatureSerializer(Serializer):
jws_algorithms = ... # type: MutableMapping[str, SigningAlgorithm]
default_algorithm = ... # type: str
default_serializer = ... # type: Any
algorithm_name = ... # type: str
algorithm = ... # type: Any
def __init__(self, secret_key: bytes_like, salt: Optional[bytes_like] = ..., serializer: Optional[_serializer] = ...,
signer: Optional[Callable[..., Signer]] = ..., signer_kwargs: Optional[MutableMapping] = ...,
algorithm_name: Optional[str] = ...) -> None: ...
def load_payload(self, payload: Any, serializer: Optional[_serializer] = ..., return_header: bool = ...) -> Any: ...
def dump_payload(self, *args, **kwargs) -> bytes: ...
def make_algorithm(self, algorithm_name: str) -> SigningAlgorithm: ...
def make_signer(self, salt: Optional[bytes_like] = ..., algorithm_name: Optional[str] = ...) -> Signer: ...
def make_header(self, header_fields: Optional[MutableMapping]) -> MutableMapping: ...
def dumps(self, obj: Any, salt: Optional[bytes_like] = ..., header_fields: Optional[MutableMapping] = ...) -> str: ...
def loads(self, s: str, salt: Optional[bytes_like] = ..., return_header: bool = ...) -> Any: ...
def loads_unsafe(self, s, salt: Optional[bytes_like] = ..., return_header: bool = ...) -> Tuple[bool, Any]: ...
class TimedJSONWebSignatureSerializer(JSONWebSignatureSerializer):
DEFAULT_EXPIRES_IN = ... # type: int
expires_in = ... # type: int
def __init__(self, secret_key: bytes_like, expires_in: Optional[int] = ..., **kwargs) -> None: ...
def make_header(self, header_fields: Optional[MutableMapping]) -> MutableMapping: ...
def loads(self, s: str, salt: Optional[bytes_like] = ..., return_header: bool = ...) -> Any: ...
def get_issue_date(self, header: MutableMapping) -> Optional[datetime]: ...
def now(self) -> int: ...
class URLSafeSerializerMixin:
def load_payload(self, payload: Any, serializer: Optional[Any] = ..., return_header: bool = ..., **kwargs) \
-> Any: ... # FIXME: This is invalid but works around https://github.com/pallets/itsdangerous/issues/74
def dump_payload(self, *args, **kwargs) -> str: ...
class URLSafeSerializer(URLSafeSerializerMixin, Serializer):
default_serializer = ... # type: Any
class URLSafeTimedSerializer(URLSafeSerializerMixin, TimedSerializer):
default_serializer = ... # type: Any

153
third_party/2and3/itsdangerous.pyi vendored Normal file
View File

@@ -0,0 +1,153 @@
from datetime import datetime
from typing import Any, Callable, IO, Mapping, MutableMapping, Optional, Tuple, Union, Text, Generator
_serializer = Any # must be an object that has "dumps" and "loads" attributes (e.g. the json module)
def want_bytes(s: Union[Text, bytes], encoding: Text = ..., errors: Text = ...) -> bytes: ...
class BadData(Exception):
message = ... # type: str
def __init__(self, message: str) -> None: ...
class BadPayload(BadData):
original_error = ... # type: Optional[Exception]
def __init__(self, message: str, original_error: Optional[Exception] = ...) -> None: ...
class BadSignature(BadData):
payload = ... # type: Optional[Any]
def __init__(self, message: str, payload: Optional[Any] = ...) -> None: ...
class BadTimeSignature(BadSignature):
date_signed = ... # type: Optional[int]
def __init__(self, message: str, payload: Optional[Any] = ..., date_signed: Optional[int] = ...) -> None: ...
class BadHeader(BadSignature):
header = ... # type: Any
original_error = ... # type: Any
def __init__(self, message, payload: Optional[Any] = ..., header: Optional[Any] = ..., original_error: Optional[Any] = ...) -> None: ...
class SignatureExpired(BadTimeSignature): ...
def base64_encode(string: Union[Text, bytes]) -> bytes: ...
def base64_decode(string: Union[Text, bytes]) -> bytes: ...
class SigningAlgorithm(object):
def get_signature(self, key: bytes, value: bytes) -> bytes: ...
def verify_signature(self, key: bytes, value: bytes, sig: bytes) -> bool: ...
class NoneAlgorithm(SigningAlgorithm):
def get_signature(self, key: bytes, value: bytes) -> bytes: ...
class HMACAlgorithm(SigningAlgorithm):
default_digest_method = ... # type: Callable
digest_method = ... # type: Callable
def __init__(self, digest_method: Optional[Callable] = ...) -> None: ...
def get_signature(self, key: bytes, value: bytes) -> bytes: ...
class Signer(object):
default_digest_method: Callable = ...
default_key_derivation: str = ...
secret_key: bytes
sep: bytes
salt: Union[Text, bytes]
key_derivation: str
digest_method: Callable
algorithm: SigningAlgorithm
def __init__(self,
secret_key: Union[Text, bytes],
salt: Optional[Union[Text, bytes]] = ...,
sep: Optional[Union[Text, bytes]] = ...,
key_derivation: Optional[str] = ...,
digest_method: Optional[Callable] = ...,
algorithm: Optional[SigningAlgorithm] = ...) -> None: ...
def derive_key(self) -> bytes: ...
def get_signature(self, value: Union[Text, bytes]) -> bytes: ...
def sign(self, value: Union[Text, bytes]) -> bytes: ...
def verify_signature(self, value: bytes, sig: Union[Text, bytes]) -> bool: ...
def unsign(self, signed_value: Union[Text, bytes]) -> bytes: ...
def validate(self, signed_value: Union[Text, bytes]) -> bool: ...
class TimestampSigner(Signer):
def get_timestamp(self) -> int: ...
def timestamp_to_datetime(self, ts: float) -> datetime: ...
def sign(self, value: Union[Text, bytes]) -> bytes: ...
def unsign(self, value: Union[Text, bytes], max_age: Optional[int] = ...,
return_timestamp: bool = ...) -> Any: ... # morally -> Union[bytes, Tuple[bytes, datetime]]
def validate(self, signed_value: Union[Text, bytes], max_age: Optional[int] = ...) -> bool: ...
class Serializer(object):
default_serializer: _serializer = ...
default_signer: Callable[..., Signer] = ...
secret_key: bytes
salt: bytes
serializer: _serializer
is_text_serializer: bool
signer: Callable[..., Signer]
signer_kwargs: MutableMapping[str, Any]
def __init__(self, secret_key: Union[Text, bytes], salt: Optional[Union[Text, bytes]] = ...,
serializer: Optional[_serializer] = ..., signer: Optional[Callable[..., Signer]] = ...,
signer_kwargs: Optional[MutableMapping[str, Any]] = ...) -> None: ...
def load_payload(self, payload: bytes, serializer: Optional[_serializer] = ...) -> Any: ...
def dump_payload(self, obj: Any) -> bytes: ...
def make_signer(self, salt: Optional[Union[Text, bytes]] = ...) -> Signer: ...
def iter_unsigners(self, salt: Optional[Union[Text, bytes]] = ...) -> Generator[Any, None, None]: ...
def dumps(self, obj: Any, salt: Optional[Union[Text, bytes]] = ...) -> Any: ... # morally -> Union[str, bytes]
def dump(self, obj: Any, f: IO[Any], salt: Optional[Union[Text, bytes]] = ...) -> None: ...
def loads(self, s: Union[Text, bytes], salt: Optional[Union[Text, bytes]] = ...) -> Any: ...
def load(self, f: IO[Any], salt: Optional[Union[Text, bytes]] = ...): ...
def loads_unsafe(self, s: Union[Text, bytes], salt: Optional[Union[Text, bytes]] = ...) -> Tuple[bool, Optional[Any]]: ...
def load_unsafe(self, f: IO[Any], salt: Optional[Union[Text, bytes]] = ...) -> Tuple[bool, Optional[Any]]: ...
class TimedSerializer(Serializer):
def loads(self, s: Union[Text, bytes], salt: Optional[Union[Text, bytes]] = ..., max_age: Optional[int] = ...,
return_timestamp: bool = ...) -> Any: ... # morally -> Union[Any, Tuple[Any, datetime]]
def loads_unsafe(self, s: Union[Text, bytes], salt: Optional[Union[Text, bytes]] = ...,
max_age: Optional[int] = ...) -> Tuple[bool, Any]: ...
class JSONWebSignatureSerializer(Serializer):
jws_algorithms: MutableMapping[Text, SigningAlgorithm] = ...
default_algorithm: Text = ...
default_serializer: Any = ...
algorithm_name: Text
algorithm: SigningAlgorithm
def __init__(self, secret_key: Union[Text, bytes], salt: Optional[Union[Text, bytes]] = ...,
serializer: Optional[_serializer] = ..., signer: Optional[Callable[..., Signer]] = ...,
signer_kwargs: Optional[MutableMapping[str, Any]] = ..., algorithm_name: Optional[Text] = ...) -> None: ...
def load_payload(self, payload: Union[Text, bytes], serializer: Optional[_serializer] = ...,
return_header: bool = ...) -> Any: ... # morally -> Union[Any, Tuple[Any, MutableMapping[str, Any]]]
def dump_payload(self, header: Mapping[str, Any], obj: Any) -> bytes: ... # type: ignore
def make_algorithm(self, algorithm_name: Text) -> SigningAlgorithm: ...
def make_signer(self, salt: Optional[Union[Text, bytes]] = ..., algorithm: SigningAlgorithm = ...) -> Signer: ...
def make_header(self, header_fields: Optional[Mapping[str, Any]]) -> MutableMapping[str, Any]: ...
def dumps(self, obj: Any, salt: Optional[Union[Text, bytes]] = ...,
header_fields: Optional[Mapping[str, Any]] = ...) -> str: ...
def loads(self, s: Union[Text, bytes], salt: Optional[Union[Text, bytes]] = ...,
return_header: bool = ...) -> Any: ... # morally -> Union[Any, Tuple[Any, MutableMapping[str, Any]]]
def loads_unsafe(self, s: Union[Text, bytes], salt: Optional[Union[Text, bytes]] = ...,
return_header: bool = ...) -> Tuple[bool, Any]: ...
class TimedJSONWebSignatureSerializer(JSONWebSignatureSerializer):
DEFAULT_EXPIRES_IN: int = ...
expires_in: int
def __init__(self, secret_key: Union[Text, bytes], expires_in: Optional[int] = ..., salt: Optional[Union[Text, bytes]] = ...,
serializer: Optional[_serializer] = ..., signer: Optional[Callable[..., Signer]] = ...,
signer_kwargs: Optional[MutableMapping[str, Any]] = ..., algorithm_name: Optional[Text] = ...) -> None: ...
def make_header(self, header_fields: Optional[Mapping[str, Any]]) -> MutableMapping[str, Any]: ...
def loads(self, s: Union[Text, bytes], salt: Optional[Union[Text, bytes]] = ...,
return_header: bool = ...) -> Any: ... # morally -> Union[Any, Tuple[Any, MutableMapping[str, Any]]]
def get_issue_date(self, header: Mapping[str, Any]) -> Optional[datetime]: ...
def now(self) -> int: ...
class _URLSafeSerializerMixin(object):
default_serializer: _serializer = ...
def load_payload(self, payload: bytes, serializer: Optional[_serializer] = ...) -> Any: ...
def dump_payload(self, obj: Any) -> bytes: ...
class URLSafeSerializer(_URLSafeSerializerMixin, Serializer): ...
class URLSafeTimedSerializer(_URLSafeSerializerMixin, TimedSerializer): ...

View File

@@ -1,162 +0,0 @@
from datetime import datetime
from typing import Any, Callable, IO, MutableMapping, Optional, Text, Tuple, TypeVar, Union
PY2: bool
text_type = str
int_to_byte = Callable[[int], bytes]
number_types = (int, float)
izip = zip
_bytes_like = Union[bytearray, bytes]
_str_like = Union[str, bytes]
_can_become_bytes = Union[str, bytes, bytearray]
_comparable_bytes = TypeVar('_comparable_bytes', str, _bytes_like)
_serializer = Any # must be an object that has "dumps" and "loads" attributes (e.g. the json module)
class _CompactJSON:
def loads(self, payload: Text) -> Any: ...
def dumps(self, obj: Any) -> Text: ...
compact_json = _CompactJSON
EPOCH = ... # type: int
def want_bytes(s: _can_become_bytes, encoding: str = ..., errors: str = ...) -> bytes: ...
def is_text_serializer(serializer: _serializer) -> bool: ...
def constant_time_compare(val1: _comparable_bytes, val2: _comparable_bytes) -> bool: ...
class BadData(Exception):
message = ... # type: str
def __init__(self, message: str) -> None: ...
class BadPayload(BadData):
original_error = ... # type: Optional[Exception]
def __init__(self, message: str, original_error: Optional[Exception] = ...) -> None: ...
class BadSignature(BadData):
payload = ... # type: Optional[Any]
def __init__(self, message: str, payload: Optional[Any] = ...) -> None: ...
class BadTimeSignature(BadSignature):
date_signed = ... # type: Optional[int]
def __init__(self, message: str, payload: Optional[Any] = ..., date_signed: Optional[int] = ...) -> None: ...
class BadHeader(BadSignature):
header = ... # type: Any
original_error = ... # type: Any
def __init__(self, message, payload: Optional[Any] = ..., header: Optional[Any] = ...,
original_error: Optional[Any] = ...) -> None: ...
class SignatureExpired(BadTimeSignature): ...
def base64_encode(string: _can_become_bytes) -> bytes: ...
def base64_decode(string: _can_become_bytes) -> bytes: ...
def int_to_bytes(num: int) -> bytes: ...
def bytes_to_int(bytestr: _can_become_bytes) -> bytes: ...
class SigningAlgorithm:
def get_signature(self, key: _bytes_like, value: _bytes_like) -> bytes: ...
def verify_signature(self, key: _bytes_like, value: _bytes_like, sig: _can_become_bytes) -> bool: ...
class NoneAlgorithm(SigningAlgorithm):
def get_signature(self, key: _bytes_like, value: _bytes_like) -> bytes: ...
class HMACAlgorithm(SigningAlgorithm):
default_digest_method = ... # type: Callable
digest_method = ... # type: Callable
def __init__(self, digest_method: Optional[Callable] = ...) -> None: ...
def get_signature(self, key: _bytes_like, value: _bytes_like) -> bytes: ...
class Signer:
default_digest_method = ... # type: Callable
default_key_derivation = ... # type: str
secret_key = ... # type: _can_become_bytes
sep = ... # type: _can_become_bytes
salt = ... # type: _can_become_bytes
key_derivation = ... # type: str
digest_method = ... # type: Callable
algorithm = ... # type: SigningAlgorithm
def __init__(self, secret_key: _can_become_bytes, salt: Optional[_can_become_bytes] = ...,
sep: Optional[_can_become_bytes] = ...,
key_derivation: Optional[str] = ...,
digest_method: Optional[Callable] = ...,
algorithm: Optional[SigningAlgorithm] = ...) -> None: ...
def derive_key(self) -> bytes: ...
def get_signature(self, value: _bytes_like) -> bytes: ...
def sign(self, value: _bytes_like) -> bytes: ...
def verify_signature(self, value: _bytes_like, sig: _can_become_bytes) -> bool: ...
def unsign(self, signed_value: _bytes_like) -> bytes: ...
def validate(self, signed_value: _can_become_bytes) -> bool: ...
class TimestampSigner(Signer):
def get_timestamp(self) -> int: ...
def timestamp_to_datetime(self, ts: int) -> datetime: ...
def sign(self, value: _bytes_like) -> bytes: ...
def unsign(self, value: _can_become_bytes, max_age: Optional[int] = ..., return_timestamp: bool = ...) -> Any: ...
def validate(self, signed_value: _can_become_bytes, max_age: Optional[int] = ...) -> bool: ...
class Serializer:
default_serializer = ... # type: _serializer
default_signer = ... # type: Callable[..., Signer]
secret_key = ... # type: Any
salt = ... # type: _can_become_bytes
serializer = ... # type: _serializer
is_text_serializer = ... # type: bool
signer = ... # type: Signer
signer_kwargs = ... # type: MutableMapping
def __init__(self, secret_key: _can_become_bytes, salt: Optional[_can_become_bytes] = ...,
serializer: Optional[_serializer] = ..., signer: Optional[Callable[..., Signer]] = ...,
signer_kwargs: Optional[MutableMapping] = ...) -> None: ...
def load_payload(self, payload: Any, serializer: Optional[_serializer] = ...) -> Any: ...
def dump_payload(self, *args, **kwargs) -> bytes: ...
def make_signer(self, salt: Optional[_can_become_bytes] = ...) -> Signer: ...
def dumps(self, obj: Any, salt: Optional[_can_become_bytes] = ...) -> _str_like: ...
def dump(self, obj: Any, f: IO, salt: Optional[_can_become_bytes] = ...) -> None: ...
def loads(self, s: _can_become_bytes, salt: Optional[_can_become_bytes] = ...) -> Any: ...
def load(self, f: IO, salt: Optional[_can_become_bytes] = ...): ...
def loads_unsafe(self, s: _can_become_bytes, salt: Optional[_can_become_bytes] = ...) -> Tuple[bool, Any]: ...
def load_unsafe(self, f: IO, *args, **kwargs) -> Tuple[bool, Any]: ...
class TimedSerializer(Serializer):
default_signer = ... # type: Callable[..., TimestampSigner]
def loads(self, s: _can_become_bytes, salt: Optional[_can_become_bytes] = ..., max_age: Optional[int] = ...,
return_timestamp: bool = ...) -> Any: ...
def loads_unsafe(self, s: _can_become_bytes, salt: Optional[_can_become_bytes] = ...,
max_age: Optional[int] = ...) -> Tuple[bool, Any]: ...
class JSONWebSignatureSerializer(Serializer):
jws_algorithms = ... # type: MutableMapping[str, SigningAlgorithm]
default_algorithm = ... # type: str
default_serializer = ... # type: Any
algorithm_name = ... # type: str
algorithm = ... # type: Any
def __init__(self, secret_key: _can_become_bytes, salt: Optional[_can_become_bytes] = ...,
serializer: Optional[_serializer] = ..., signer: Optional[Callable[..., Signer]] = ...,
signer_kwargs: Optional[MutableMapping] = ..., algorithm_name: Optional[str] = ...) -> None: ...
def load_payload(self, payload: Any, serializer: Optional[_serializer] = ..., return_header: bool = ...) -> Any: ...
def dump_payload(self, *args, **kwargs) -> bytes: ...
def make_algorithm(self, algorithm_name: str) -> SigningAlgorithm: ...
def make_signer(self, salt: Optional[_can_become_bytes] = ..., algorithm_name: Optional[str] = ...) -> Signer: ...
def make_header(self, header_fields: Optional[MutableMapping]) -> MutableMapping: ...
def dumps(self, obj: Any, salt: Optional[_can_become_bytes] = ..., header_fields: Optional[MutableMapping] = ...) -> str: ...
def loads(self, s: _can_become_bytes, salt: Optional[_can_become_bytes] = ..., return_header: bool = ...) -> Any: ...
def loads_unsafe(self, s: _can_become_bytes, salt: Optional[_can_become_bytes] = ...,
return_header: bool = ...) -> Tuple[bool, Any]: ...
class TimedJSONWebSignatureSerializer(JSONWebSignatureSerializer):
DEFAULT_EXPIRES_IN = ... # type: int
expires_in = ... # type: int
def __init__(self, secret_key: _can_become_bytes, expires_in: Optional[int] = ..., **kwargs) -> None: ...
def make_header(self, header_fields: Optional[MutableMapping]) -> MutableMapping: ...
def loads(self, s: _can_become_bytes, salt: Optional[_can_become_bytes] = ..., return_header: bool = ...) -> Any: ...
def get_issue_date(self, header: MutableMapping) -> Optional[datetime]: ...
def now(self) -> int: ...
class URLSafeSerializerMixin:
def load_payload(self, payload: Any, serializer: Any = ..., **kwargs) -> Any: ...
def dump_payload(self, *args, **kwargs) -> bytes: ...
class URLSafeSerializer(URLSafeSerializerMixin, Serializer):
default_serializer = ... # type: Any
class URLSafeTimedSerializer(URLSafeSerializerMixin, TimedSerializer):
default_serializer = ... # type: Any