Skip to content

Commit

Permalink
Upgrade black version and usage (#538)
Browse files Browse the repository at this point in the history
Upgrade black to version 20.8b1 and specify that Python 3.6+ syntax
should be used.

Run it on all files to upgrade syntax.
  • Loading branch information
jdufresne authored Dec 16, 2020
1 parent b8cace5 commit a086e61
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
repos:
- repo: https://github.com/psf/black
rev: 19.10b0
rev: 20.8b1
hooks:
- id: black
language_version: python3.8
args: ["--target-version=py36"]

- repo: https://gitlab.com/pycqa/flake8
rev: 3.7.9
Expand Down
6 changes: 3 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def find_version(*file_paths):
release = find_version("../jwt/__init__.py")

# The short X.Y version.
version = release.rsplit(u".", 1)[0]
version = release.rsplit(".", 1)[0]

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down Expand Up @@ -112,7 +112,7 @@ def find_version(*file_paths):

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [(master_doc, "pyjwt", u"PyJWT Documentation", [author], 1)]
man_pages = [(master_doc, "pyjwt", "PyJWT Documentation", [author], 1)]


# -- Options for Texinfo output -------------------------------------------
Expand All @@ -124,7 +124,7 @@ def find_version(*file_paths):
(
master_doc,
"PyJWT",
u"PyJWT Documentation",
"PyJWT Documentation",
author,
"PyJWT",
"One line description of project.",
Expand Down
2 changes: 1 addition & 1 deletion jwt/api_jws.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def decode(
algorithms: List[str] = None,
options: Dict = None,
complete: bool = False,
**kwargs
**kwargs,
):

merged_options = merge_dict(self.options, options)
Expand Down
4 changes: 2 additions & 2 deletions jwt/api_jwt.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def decode(
algorithms: List[str] = None,
options: Dict = None,
complete: bool = False,
**kwargs
**kwargs,
) -> Dict[str, Any]:

if options is None:
Expand All @@ -90,7 +90,7 @@ def decode(
algorithms=algorithms,
options=options,
complete=complete,
**kwargs
**kwargs,
)

try:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_algorithms.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ def test_rsa_to_jwk_returns_correct_values_for_private_key(self):
key = algo.to_jwk(priv_key)

expected = {
"key_ops": [u"sign"],
"key_ops": ["sign"],
"kty": "RSA",
"e": "AQAB",
"n": (
Expand Down
12 changes: 6 additions & 6 deletions tests/test_api_jws.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ def test_encode_decode_with_rsa_sha256(self, jws, payload):
# PEM-formatted RSA key
with open("tests/keys/testkey_rsa.priv", "r") as rsa_priv_file:
priv_rsakey = load_pem_private_key(
force_bytes(rsa_priv_file.read()), password=None,
force_bytes(rsa_priv_file.read()), password=None
)
jws_message = jws.encode(payload, priv_rsakey, algorithm="RS256")

Expand All @@ -518,7 +518,7 @@ def test_encode_decode_with_rsa_sha384(self, jws, payload):
# PEM-formatted RSA key
with open("tests/keys/testkey_rsa.priv", "r") as rsa_priv_file:
priv_rsakey = load_pem_private_key(
force_bytes(rsa_priv_file.read()), password=None,
force_bytes(rsa_priv_file.read()), password=None
)
jws_message = jws.encode(payload, priv_rsakey, algorithm="RS384")

Expand All @@ -542,7 +542,7 @@ def test_encode_decode_with_rsa_sha512(self, jws, payload):
# PEM-formatted RSA key
with open("tests/keys/testkey_rsa.priv", "r") as rsa_priv_file:
priv_rsakey = load_pem_private_key(
force_bytes(rsa_priv_file.read()), password=None,
force_bytes(rsa_priv_file.read()), password=None
)
jws_message = jws.encode(payload, priv_rsakey, algorithm="RS512")

Expand Down Expand Up @@ -586,7 +586,7 @@ def test_encode_decode_with_ecdsa_sha256(self, jws, payload):
# PEM-formatted EC key
with open("tests/keys/testkey_ec.priv", "r") as ec_priv_file:
priv_eckey = load_pem_private_key(
force_bytes(ec_priv_file.read()), password=None,
force_bytes(ec_priv_file.read()), password=None
)
jws_message = jws.encode(payload, priv_eckey, algorithm="ES256")

Expand All @@ -611,7 +611,7 @@ def test_encode_decode_with_ecdsa_sha384(self, jws, payload):
# PEM-formatted EC key
with open("tests/keys/testkey_ec.priv", "r") as ec_priv_file:
priv_eckey = load_pem_private_key(
force_bytes(ec_priv_file.read()), password=None,
force_bytes(ec_priv_file.read()), password=None
)
jws_message = jws.encode(payload, priv_eckey, algorithm="ES384")

Expand All @@ -635,7 +635,7 @@ def test_encode_decode_with_ecdsa_sha512(self, jws, payload):
# PEM-formatted EC key
with open("tests/keys/testkey_ec.priv", "r") as ec_priv_file:
priv_eckey = load_pem_private_key(
force_bytes(ec_priv_file.read()), password=None,
force_bytes(ec_priv_file.read()), password=None
)
jws_message = jws.encode(payload, priv_eckey, algorithm="ES512")

Expand Down

0 comments on commit a086e61

Please sign in to comment.