Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/itsdangerous/__init__.py: 85%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

26 statements  

1from __future__ import annotations 

2 

3import typing as t 

4 

5from .encoding import base64_decode as base64_decode 

6from .encoding import base64_encode as base64_encode 

7from .encoding import want_bytes as want_bytes 

8from .exc import BadData as BadData 

9from .exc import BadHeader as BadHeader 

10from .exc import BadPayload as BadPayload 

11from .exc import BadSignature as BadSignature 

12from .exc import BadTimeSignature as BadTimeSignature 

13from .exc import SignatureExpired as SignatureExpired 

14from .serializer import Serializer as Serializer 

15from .signer import HMACAlgorithm as HMACAlgorithm 

16from .signer import NoneAlgorithm as NoneAlgorithm 

17from .signer import Signer as Signer 

18from .timed import TimedSerializer as TimedSerializer 

19from .timed import TimestampSigner as TimestampSigner 

20from .url_safe import URLSafeSerializer as URLSafeSerializer 

21from .url_safe import URLSafeTimedSerializer as URLSafeTimedSerializer 

22 

23 

24def __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)