Skip to content

Commit ed28e49

Browse files
jacopofarjpadilla
authored andcommitted
Decode return type is dict[str, Any] (jpadilla#393)
* Use Dict instead of Mapping for return type of decode * Use str as a dictionary key
1 parent b65e1ac commit ed28e49

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

jwt/api_jwt.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from datetime import datetime, timedelta
55
try:
66
# import required by mypy to perform type checking, not used for normal execution
7-
from typing import Callable, Dict, List, Optional, Union # NOQA
7+
from typing import Any, Callable, Dict, List, Optional, Union # NOQA
88
except ImportError:
99
pass
1010

@@ -72,6 +72,7 @@ def decode(self,
7272
algorithms=None, # type: List[str]
7373
options=None, # type: Dict
7474
**kwargs):
75+
# type: (...) -> Dict[str, Any]
7576

7677
if verify and not algorithms:
7778
warnings.warn(
@@ -96,7 +97,7 @@ def decode(self,
9697
payload = json.loads(decoded.decode('utf-8'))
9798
except ValueError as e:
9899
raise DecodeError('Invalid payload string: %s' % e)
99-
if not isinstance(payload, Mapping):
100+
if not isinstance(payload, dict):
100101
raise DecodeError('Invalid payload string: must be a json object')
101102

102103
if verify:

0 commit comments

Comments
 (0)