From 31a8701d11709ce0807b60f7a5fa604d14175235 Mon Sep 17 00:00:00 2001 From: Kyungmin Lee Date: Fri, 22 Oct 2021 21:49:15 +0900 Subject: [PATCH] Don't use implicit optionals (#705) * Turn off implicit-optional * Change type annotations to use explicit optional According to PEP 484, implicit Optional is no longer recommended. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- jwt/api_jws.py | 8 ++++---- jwt/api_jwt.py | 8 ++++---- setup.cfg | 1 + 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/jwt/api_jws.py b/jwt/api_jws.py index f85072e0..9e8e1787 100644 --- a/jwt/api_jws.py +++ b/jwt/api_jws.py @@ -132,8 +132,8 @@ def decode_complete( self, jwt: str, key: str = "", - algorithms: List[str] = None, - options: Dict = None, + algorithms: Optional[List[str]] = None, + options: Optional[Dict] = None, **kwargs, ) -> Dict[str, Any]: if options is None: @@ -161,8 +161,8 @@ def decode( self, jwt: str, key: str = "", - algorithms: List[str] = None, - options: Dict = None, + algorithms: Optional[List[str]] = None, + options: Optional[Dict] = None, **kwargs, ) -> str: decoded = self.decode_complete(jwt, key, algorithms, options, **kwargs) diff --git a/jwt/api_jwt.py b/jwt/api_jwt.py index f3b55d36..c9d34a5f 100644 --- a/jwt/api_jwt.py +++ b/jwt/api_jwt.py @@ -66,8 +66,8 @@ def decode_complete( self, jwt: str, key: str = "", - algorithms: List[str] = None, - options: Dict = None, + algorithms: Optional[List[str]] = None, + options: Optional[Dict] = None, **kwargs, ) -> Dict[str, Any]: if options is None: @@ -112,8 +112,8 @@ def decode( self, jwt: str, key: str = "", - algorithms: List[str] = None, - options: Dict = None, + algorithms: Optional[List[str]] = None, + options: Optional[Dict] = None, **kwargs, ) -> Dict[str, Any]: decoded = self.decode_complete(jwt, key, algorithms, options, **kwargs) diff --git a/setup.cfg b/setup.cfg index 62798cb9..5e0b244c 100644 --- a/setup.cfg +++ b/setup.cfg @@ -71,3 +71,4 @@ extend-ignore = E203, E501 python_version = 3.6 ignore_missing_imports = true warn_unused_ignores = true +no_implicit_optional = true