Format: text/x-python
⬇ Download File (1.4 KB)
   1  from __future__ import annotations
   2  
   3  import typing as t
   4  
   5  from .encoding import base64_decode as base64_decode
   6  from .encoding import base64_encode as base64_encode
   7  from .encoding import want_bytes as want_bytes
   8  from .exc import BadData as BadData
   9  from .exc import BadHeader as BadHeader
  10  from .exc import BadPayload as BadPayload
  11  from .exc import BadSignature as BadSignature
  12  from .exc import BadTimeSignature as BadTimeSignature
  13  from .exc import SignatureExpired as SignatureExpired
  14  from .serializer import Serializer as Serializer
  15  from .signer import HMACAlgorithm as HMACAlgorithm
  16  from .signer import NoneAlgorithm as NoneAlgorithm
  17  from .signer import Signer as Signer
  18  from .timed import TimedSerializer as TimedSerializer
  19  from .timed import TimestampSigner as TimestampSigner
  20  from .url_safe import URLSafeSerializer as URLSafeSerializer
  21  from .url_safe import URLSafeTimedSerializer as URLSafeTimedSerializer
  22  
  23  
  24  def __getattr__(name: str) -> t.Any:
  25      if name == "__version__":
  26          import importlib.metadata
  27          import warnings
  28  
  29          warnings.warn(
  30              "The '__version__' attribute is deprecated and will be removed in"
  31              " ItsDangerous 2.3. Use feature detection or"
  32              " 'importlib.metadata.version(\"itsdangerous\")' instead.",
  33              DeprecationWarning,
  34              stacklevel=2,
  35          )
  36          return importlib.metadata.version("itsdangerous")
  37  
  38      raise AttributeError(name)
  39