Skip to content

Commit 859b456

Browse files
authored
pylint warning fix take two
1 parent 572a679 commit 859b456

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

adafruit_jwt.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def validate(jwt):
7878
try:
7979
jose_header = STRING_TOOLS.urlsafe_b64decode(jwt.split(".")[0])
8080
except UnicodeError as unicode_error:
81-
raise unicode_error("Unable to decode JOSE header.")
81+
raise UnicodeError("Unable to decode JOSE header.") from unicode_error
8282
# Check for typ and alg in decoded JOSE header
8383
if "typ" not in jose_header:
8484
raise TypeError("JOSE Header does not contain required type key.")
@@ -88,7 +88,7 @@ def validate(jwt):
8888
try:
8989
claims = json.loads(STRING_TOOLS.urlsafe_b64decode(jwt.split(".")[1]))
9090
except UnicodeError as unicode_error:
91-
raise unicode_error("Invalid claims encoding.")
91+
raise UnicodeError("Invalid claims encoding.") from unicode_error
9292
if not hasattr(claims, "keys"):
9393
raise TypeError("Provided claims is not a JSON dict. object")
9494
return (jose_header, claims)
@@ -183,8 +183,8 @@ def _bytes_from_decode_data(str_data):
183183
if isinstance(str_data, str):
184184
try:
185185
return str_data.encode("ascii")
186-
except:
187-
raise ValueError("string argument should contain only ASCII characters")
186+
except BaseException as error:
187+
raise ValueError("string argument should contain only ASCII characters") from error
188188
elif isinstance(str_data, bit_types):
189189
return str_data
190190
else:

0 commit comments

Comments
 (0)