Skip to content

Commit b26c724

Browse files
authored
Updates - black formatting, GH actions versions, tox 4 (#313)
* Update GH actions, upgrade to tox 4 * reformat with the new version of black * Remove python 3.6 * More GHA updates * remove quotes
1 parent 96474ec commit b26c724

File tree

16 files changed

+33
-87
lines changed

16 files changed

+33
-87
lines changed

.github/workflows/ci.yml

+23-24
Original file line numberDiff line numberDiff line change
@@ -12,67 +12,66 @@ jobs:
1212
strategy:
1313
fail-fast: false
1414
matrix:
15-
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "pypy3"]
15+
python-version: ["3.7", "3.8", "3.9", "3.10", "pypy3.9"]
1616
os: [ubuntu-latest, macos-latest, windows-latest]
1717
exclude:
1818
- os: macos-latest
19-
python-version: "pypy3"
19+
python-version: "pypy3.9"
2020
- os: windows-latest
21-
python-version: "pypy3"
21+
python-version: "pypy3.9"
2222
runs-on: ${{ matrix.os }}
2323
name: "${{ matrix.os }} Python: ${{ matrix.python-version }}"
2424
steps:
25-
- uses: actions/checkout@v2
25+
- uses: actions/checkout@v3
2626
with:
2727
fetch-depth: 0
2828
- name: Set up Python ${{ matrix.python-version }}
29-
uses: actions/setup-python@v2
29+
uses: actions/setup-python@v4
3030
with:
3131
python-version: ${{ matrix.python-version }}
3232
- name: Install dependencies
3333
run: |
34-
pip install -U "pip>=21.1"
35-
pip install -U setuptools
36-
pip install -U "tox>=3.23.0,<4" codecov tox-gh-actions coverage
34+
pip install -U "pip>=23.1.2"
35+
pip install -U "tox-gh-actions==3.1.0" coverage
3736
- name: Log python & pip versions
3837
run: |
3938
python --version
4039
pip --version
4140
- name: Run unit tests
4241
run: tox
43-
- name: "Coverage report"
42+
- name: Coverage report
4443
run: coverage xml
45-
- name: "Upload coverage to Codecov"
46-
uses: "codecov/codecov-action@v1"
44+
- name: Upload coverage to Codecov
45+
uses: codecov/codecov-action@v3
4746
with:
4847
fail_ci_if_error: true
4948
linting:
5049
runs-on: ubuntu-latest
5150
steps:
52-
- uses: actions/checkout@v2
53-
- uses: actions/setup-python@v2
51+
- uses: actions/checkout@v3
52+
- uses: actions/setup-python@v4
5453
with:
55-
python-version: 3.8
54+
python-version: 3.9
5655
- name: Install dependencies
5756
run: |
5857
pip install -U setuptools
59-
pip install -U "tox>=3.23.0,<4"
58+
pip install -U "tox>=4.5.1,<5"
6059
- run: tox -e lint
6160
package:
62-
name: "Build & verify package"
61+
name: Build & verify package
6362
runs-on: "ubuntu-latest"
6463
steps:
65-
- uses: "actions/checkout@v2"
66-
- uses: "actions/setup-python@v2"
64+
- uses: actions/checkout@v3
65+
- uses: actions/setup-python@v4
6766
with:
68-
python-version: "3.8"
69-
- name: "Install build, check-wheel-content, and twine"
67+
python-version: "3.9"
68+
- name: Install build, check-wheel-content, and twine
7069
run: "python -m pip install build twine check-wheel-contents"
71-
- name: "Build package"
70+
- name: Build package
7271
run: "python -m build --sdist --wheel ."
73-
- name: "List result"
72+
- name: List result
7473
run: "ls -l dist"
75-
- name: "Check wheel contents"
74+
- name: Check wheel contents
7675
run: "check-wheel-contents dist/*.whl"
77-
- name: "Check long_description"
76+
- name: Check long_description
7877
run: "python -m twine check dist/*"

CHANGELOG.md

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog #
22

3+
## 3.4.0 -- UNPUBLISHED ##
4+
5+
### News ###
6+
7+
* Remove support for python 3.6
8+
39
## 3.3.0 -- 2021-06-04 ##
410

511
### News ###
@@ -17,7 +23,6 @@
1723
* Updated Syntax to use Python 3.6+
1824
* Upgrade to latest pytest, remove used dev requirements.
1925

20-
2126
## 3.2.0 -- 2020-07-29 ##
2227

2328
### News ###
@@ -39,8 +44,6 @@
3944

4045
* Fixed some typos #160, #162, and #164
4146

42-
43-
4447
## 3.1.0 -- 2019-12-10 ##
4548

4649
This is a greatly overdue release.

docs/conf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
# All configuration values have a default; values that are commented out
1111
# serve to show the default.
1212

13-
import sys
1413
import os
14+
import sys
1515

1616
# If extensions (or modules to document with autodoc) are in another directory,
1717
# add these directories to sys.path here. If the directory is relative to the

jose/backends/rsa_backend.py

-1
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,6 @@ def public_key(self):
221221
return self.__class__(pyrsa.PublicKey(n=self._prepared_key.n, e=self._prepared_key.e), self._algorithm)
222222

223223
def to_pem(self, pem_format="PKCS8"):
224-
225224
if isinstance(self._prepared_key, pyrsa.PrivateKey):
226225
der = self._prepared_key.save_pkcs1(format="DER")
227226
if pem_format == "PKCS8":

jose/jws.py

-2
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,6 @@ def _sig_matches_keys(keys, signing_input, signature, alg):
215215

216216

217217
def _get_keys(key):
218-
219218
if isinstance(key, Key):
220219
return (key,)
221220

@@ -248,7 +247,6 @@ def _get_keys(key):
248247

249248

250249
def _verify_signature(signing_input, header, signature, key="", algorithms=None):
251-
252250
alg = header.get("alg")
253251
if not alg:
254252
raise JWSError("No algorithm was specified in the JWS header.")

jose/jwt.py

-2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ def encode(claims, key, algorithm=ALGORITHMS.HS256, headers=None, access_token=N
4242
"""
4343

4444
for time_claim in ["exp", "iat", "nbf"]:
45-
4645
# Convert datetime to a intDate value in known time-format claims
4746
if isinstance(claims.get(time_claim), datetime):
4847
claims[time_claim] = timegm(claims[time_claim].utctimetuple())
@@ -456,7 +455,6 @@ def _validate_at_hash(claims, access_token, algorithm):
456455

457456

458457
def _validate_claims(claims, audience=None, issuer=None, subject=None, algorithm=None, access_token=None, options=None):
459-
460458
leeway = options.get("leeway", 0)
461459

462460
if isinstance(leeway, timedelta):

jose/utils.py

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
def long_to_bytes(n, blocksize=0):
1010
return _long_to_bytes(n, blocksize or None)
1111

12-
1312
except ImportError:
1413
from ecdsa.ecdsa import int_to_string as _long_to_bytes
1514

setup.cfg

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ classifiers =
2121
Programming Language :: Python
2222
Programming Language :: Python :: 3
2323
Programming Language :: Python :: 3 :: Only
24-
Programming Language :: Python :: 3.6
2524
Programming Language :: Python :: 3.7
2625
Programming Language :: Python :: 3.8
2726
Programming Language :: Python :: 3.9

setup.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env python
22
from setuptools import setup
33

4-
54
setup()

tests/algorithms/test_RSA.py

-1
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,6 @@ def test_python_rsa_legacy_private_key_pkcs8_to_pkcs1_invalid(self):
223223
None in (default_backend, pyca_rsa, CryptographyRSAKey), reason="Cryptography backend not available"
224224
)
225225
def test_cryptography_RSA_key_instance():
226-
227226
key = pyca_rsa.RSAPublicNumbers(
228227
int(65537),
229228
int(

tests/rfc/test_rfc7520.py

-7
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
from jose.backends import RSAKey
77
from jose.jws import verify
88

9-
109
expected_payload = b"It\xe2\x80\x99s a dangerous business, Frodo, going out your door. You step onto the road, and if you don't keep your feet, there\xe2\x80\x99s no knowing where you might be swept off to."
1110

1211

@@ -39,31 +38,25 @@
3938

4039

4140
class TestFourOneThree:
42-
4341
token = "eyJhbGciOiJSUzI1NiIsImtpZCI6ImJpbGJvLmJhZ2dpbnNAaG9iYml0b24uZXhhbXBsZSJ9.SXTigJlzIGEgZGFuZ2Vyb3VzIGJ1c2luZXNzLCBGcm9kbywgZ29pbmcgb3V0IHlvdXIgZG9vci4gWW91IHN0ZXAgb250byB0aGUgcm9hZCwgYW5kIGlmIHlvdSBkb24ndCBrZWVwIHlvdXIgZmVldCwgdGhlcmXigJlzIG5vIGtub3dpbmcgd2hlcmUgeW91IG1pZ2h0IGJlIHN3ZXB0IG9mZiB0by4.MRjdkly7_-oTPTS3AXP41iQIGKa80A0ZmTuV5MEaHoxnW2e5CZ5NlKtainoFmKZopdHM1O2U4mwzJdQx996ivp83xuglII7PNDi84wnB-BDkoBwA78185hX-Es4JIwmDLJK3lfWRa-XtL0RnltuYv746iYTh_qHRD68BNt1uSNCrUCTJDt5aAE6x8wW1Kt9eRo4QPocSadnHXFxnt8Is9UzpERV0ePPQdLuW3IS_de3xyIrDaLGdjluPxUAhb6L2aXic1U12podGU0KLUQSE_oI-ZnmKJ3F4uOZDnd6QZWJushZ41Axf_fcIe8u9ipH84ogoree7vjbU5y18kDquDg"
4442

4543
@pytest.mark.skipif(RSAKey is None, reason="RSA is not available")
4644
def test_signature(self):
47-
4845
payload = verify(self.token, rsa_public_jwk, "RS256")
4946
assert payload == expected_payload
5047

5148

5249
class TestFourThreeThree:
53-
5450
token = "eyJhbGciOiJFUzUxMiIsImtpZCI6ImJpbGJvLmJhZ2dpbnNAaG9iYml0b24uZXhhbXBsZSJ9.SXTigJlzIGEgZGFuZ2Vyb3VzIGJ1c2luZXNzLCBGcm9kbywgZ29pbmcgb3V0IHlvdXIgZG9vci4gWW91IHN0ZXAgb250byB0aGUgcm9hZCwgYW5kIGlmIHlvdSBkb24ndCBrZWVwIHlvdXIgZmVldCwgdGhlcmXigJlzIG5vIGtub3dpbmcgd2hlcmUgeW91IG1pZ2h0IGJlIHN3ZXB0IG9mZiB0by4.AE_R_YZCChjn4791jSQCrdPZCNYqHXCTZH0-JZGYNlaAjP2kqaluUIIUnC9qvbu9Plon7KRTzoNEuT4Va2cmL1eJAQy3mtPBu_u_sDDyYjnAMDxXPn7XrT0lw-kvAD890jl8e2puQens_IEKBpHABlsbEPX6sFY8OcGDqoRuBomu9xQ2"
5551

5652
def test_signature(self):
57-
5853
payload = verify(self.token, ec_public_key, "ES512")
5954
assert payload == expected_payload
6055

6156

6257
class TestFourFourThree:
63-
6458
token = "eyJhbGciOiJIUzI1NiIsImtpZCI6IjAxOGMwYWU1LTRkOWItNDcxYi1iZmQ2LWVlZjMxNGJjNzAzNyJ9.SXTigJlzIGEgZGFuZ2Vyb3VzIGJ1c2luZXNzLCBGcm9kbywgZ29pbmcgb3V0IHlvdXIgZG9vci4gWW91IHN0ZXAgb250byB0aGUgcm9hZCwgYW5kIGlmIHlvdSBkb24ndCBrZWVwIHlvdXIgZmVldCwgdGhlcmXigJlzIG5vIGtub3dpbmcgd2hlcmUgeW91IG1pZ2h0IGJlIHN3ZXB0IG9mZiB0by4.s0h6KThzkfBBBkLspW1h84VsJZFTsPPqMDA7g1Md7p0"
6559

6660
def test_signature(self):
67-
6861
payload = verify(self.token, hmac_key, "HS256")
6962
assert payload == expected_payload

tests/test_jwe.py

-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,6 @@ def test_wrong_auth_tag_is_ignored(self):
136136
@pytest.mark.skipif(AESKey is None, reason="Test requires AES Backend")
137137
@pytest.mark.skipif(RSAKey is RSABackendRSAKey, reason="RSA Backend does not support all modes")
138138
class TestDecrypt:
139-
140139
JWE_RSA_PACKAGES = (
141140
pytest.param(
142141
b"eyJhbGciOiJSU0ExXzUiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2In0.qHxZy-MfqRjCDAieY5AoU75XRGS7S-Xx4NytHgNa5dmGh9R8q1riHyPw5Hec_D395fKqV75u1hKke5r-jgiDTaCicQjOuxM2cSaiFlUid7dk5zIucaKH84N8jMzq3PwBePmGftePM2NMCzs6RvWBFP5SnDHh95NU2Xd-rIUICA7zIBXTwNRsB2LM9c_TZv1qh59DYoiSHWy94WXJBNFqViuVLmjVz5250J6Q4uRiYKGJKEGkfLDUp18N97aw5RQ35jJF6QyO5JkeLFTA0L10QAEtM8RjBRrKYgJ6fJLCVbHHTf7EKdn6Z-4cIZKtYe2d7PPKa0ZWZvtYTuU1S6DgmA.gdSr6lSIci4GjzMsdLaK6g.4ynh6gGG4dzxpmNfZHo6o8Eqp1eXRhKzI2Tmde-IulU.cFUhLtodRUqZ1GfSO6e3pw",

tests/test_jwk.py

-5
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333

3434
class TestJWK:
3535
def test_interface(self):
36-
3736
key = jwk.Key("key", "ALG")
3837

3938
with pytest.raises(NotImplementedError):
@@ -55,7 +54,6 @@ def test_invalid_hash_alg(self):
5554

5655
@pytest.mark.skipif(RSAKey is None, reason="RSA is not available")
5756
def test_invalid_jwk(self):
58-
5957
with pytest.raises(JWKError):
6058
key = HMACKey(rsa_key, "HS256")
6159

@@ -67,7 +65,6 @@ def test_invalid_jwk(self):
6765

6866
@pytest.mark.skipif(RSAKey is None, reason="RSA is not available")
6967
def test_RSAKey_errors(self):
70-
7168
rsa_key = {
7269
"kty": "RSA",
7370
@@ -91,7 +88,6 @@ def test_RSAKey_errors(self):
9188
key = RSAKey(rsa_key, "RS256") # noqa: F841
9289

9390
def test_construct_from_jwk(self):
94-
9591
hmac_key = {
9692
"kty": "oct",
9793
"kid": "018c0ae5-4d9b-471b-bfd6-eef314bc7037",
@@ -108,7 +104,6 @@ def test_construct_EC_from_jwk(self):
108104
assert isinstance(key, jwk.Key)
109105

110106
def test_construct_from_jwk_missing_alg(self):
111-
112107
hmac_key = {
113108
"kty": "oct",
114109
"kid": "018c0ae5-4d9b-471b-bfd6-eef314bc7037",

tests/test_jws.py

-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ def test_unsupported_alg(self, payload):
126126
jws.sign(payload, "secret", algorithm="SOMETHING")
127127

128128
def test_add_headers(self, payload):
129-
130129
additional_headers = {"test": "header"}
131130

132131
expected_headers = {

0 commit comments

Comments
 (0)