From 5e5f5d734dd4771be5b611e74b53e730cc361e29 Mon Sep 17 00:00:00 2001 From: Jon Dufresne Date: Thu, 17 Dec 2020 07:07:33 -0800 Subject: [PATCH] Enforce .encode() return type using mypy Closes #505 --- jwt/api_jws.py | 2 +- jwt/api_jwt.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/jwt/api_jws.py b/jwt/api_jws.py index f01f53e4..bce7a1a9 100644 --- a/jwt/api_jws.py +++ b/jwt/api_jws.py @@ -79,7 +79,7 @@ def encode( algorithm: str = "HS256", headers: Optional[Dict] = None, json_encoder: Optional[Type[json.JSONEncoder]] = None, - ): + ) -> str: segments = [] if algorithm is None: diff --git a/jwt/api_jwt.py b/jwt/api_jwt.py index d5bcb15b..60f319b4 100644 --- a/jwt/api_jwt.py +++ b/jwt/api_jwt.py @@ -40,7 +40,7 @@ def encode( algorithm: str = "HS256", headers: Optional[Dict] = None, json_encoder: Optional[Type[json.JSONEncoder]] = None, - ): + ) -> str: # Check that we get a mapping if not isinstance(payload, Mapping): raise TypeError(