summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacopo Farina <jacopofar@users.noreply.github.com>2019-01-31 16:00:13 +0100
committerJosé Padilla <jpadilla@webapplicate.com>2019-01-31 10:00:13 -0500
commited28e495f937f50165a252fd5696a82942cd83a7 (patch)
treef9a75d6dc65543c69495305320c543fbe0fbdbbd
parentb65e1ac6dc4d11801f3642eaab34ae6a54162c18 (diff)
downloadpyjwt-ed28e495f937f50165a252fd5696a82942cd83a7.tar.gz
Decode return type is dict[str, Any] (#393)
* Use Dict instead of Mapping for return type of decode * Use str as a dictionary key
-rw-r--r--jwt/api_jwt.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/jwt/api_jwt.py b/jwt/api_jwt.py
index 85504ac..971fa20 100644
--- a/jwt/api_jwt.py
+++ b/jwt/api_jwt.py
@@ -4,7 +4,7 @@ from calendar import timegm
from datetime import datetime, timedelta
try:
# import required by mypy to perform type checking, not used for normal execution
- from typing import Callable, Dict, List, Optional, Union # NOQA
+ from typing import Any, Callable, Dict, List, Optional, Union # NOQA
except ImportError:
pass
@@ -72,6 +72,7 @@ class PyJWT(PyJWS):
algorithms=None, # type: List[str]
options=None, # type: Dict
**kwargs):
+ # type: (...) -> Dict[str, Any]
if verify and not algorithms:
warnings.warn(
@@ -96,7 +97,7 @@ class PyJWT(PyJWS):
payload = json.loads(decoded.decode('utf-8'))
except ValueError as e:
raise DecodeError('Invalid payload string: %s' % e)
- if not isinstance(payload, Mapping):
+ if not isinstance(payload, dict):
raise DecodeError('Invalid payload string: must be a json object')
if verify: