Skip to content

Commit 5fb8673

Browse files
authored
Add pyproject.toml w/ isort config, add tox command to run lint fixes (mpdavis#255)
1 parent 36dde95 commit 5fb8673

File tree

8 files changed

+32
-32
lines changed

8 files changed

+32
-32
lines changed

jose/backends/__init__.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,31 @@
11
try:
2-
from jose.backends.cryptography_backend import \
3-
get_random_bytes # noqa: F401
2+
from jose.backends.cryptography_backend import get_random_bytes # noqa: F401
43
except ImportError:
54
try:
6-
from jose.backends.pycrypto_backend import \
7-
get_random_bytes # noqa: F401
5+
from jose.backends.pycrypto_backend import get_random_bytes # noqa: F401
86
except ImportError:
97
from jose.backends.native import get_random_bytes # noqa: F401
108

119
try:
12-
from jose.backends.cryptography_backend import \
13-
CryptographyRSAKey as RSAKey # noqa: F401
10+
from jose.backends.cryptography_backend import CryptographyRSAKey as RSAKey # noqa: F401
1411
except ImportError:
1512
try:
1613
from jose.backends.rsa_backend import RSAKey # noqa: F401
1714
except ImportError:
1815
RSAKey = None
1916

2017
try:
21-
from jose.backends.cryptography_backend import \
22-
CryptographyECKey as ECKey # noqa: F401
18+
from jose.backends.cryptography_backend import CryptographyECKey as ECKey # noqa: F401
2319
except ImportError:
2420
from jose.backends.ecdsa_backend import ECDSAECKey as ECKey # noqa: F401
2521

2622
try:
27-
from jose.backends.cryptography_backend import \
28-
CryptographyAESKey as AESKey # noqa: F401
23+
from jose.backends.cryptography_backend import CryptographyAESKey as AESKey # noqa: F401
2924
except ImportError:
3025
AESKey = None
3126

3227
try:
33-
from jose.backends.cryptography_backend import \
34-
CryptographyHMACKey as HMACKey # noqa: F401
28+
from jose.backends.cryptography_backend import CryptographyHMACKey as HMACKey # noqa: F401
3529
except ImportError:
3630
from jose.backends.native import HMACKey # noqa: F401
3731

jose/backends/cryptography_backend.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,17 @@
77
from cryptography.hazmat.bindings.openssl.binding import Binding
88
from cryptography.hazmat.primitives import hashes, hmac, serialization
99
from cryptography.hazmat.primitives.asymmetric import ec, padding, rsa
10-
from cryptography.hazmat.primitives.asymmetric.utils import (
11-
decode_dss_signature, encode_dss_signature)
12-
from cryptography.hazmat.primitives.ciphers import (Cipher, aead, algorithms,
13-
modes)
14-
from cryptography.hazmat.primitives.keywrap import (InvalidUnwrap,
15-
aes_key_unwrap,
16-
aes_key_wrap)
10+
from cryptography.hazmat.primitives.asymmetric.utils import decode_dss_signature, encode_dss_signature
11+
from cryptography.hazmat.primitives.ciphers import Cipher, aead, algorithms, modes
12+
from cryptography.hazmat.primitives.keywrap import InvalidUnwrap, aes_key_unwrap, aes_key_wrap
1713
from cryptography.hazmat.primitives.padding import PKCS7
18-
from cryptography.hazmat.primitives.serialization import (load_pem_private_key,
19-
load_pem_public_key)
14+
from cryptography.hazmat.primitives.serialization import load_pem_private_key, load_pem_public_key
2015
from cryptography.utils import int_to_bytes
2116
from cryptography.x509 import load_pem_x509_certificate
2217

2318
from ..constants import ALGORITHMS
2419
from ..exceptions import JWEError, JWKError
25-
from ..utils import (base64_to_long, base64url_decode, base64url_encode,
26-
long_to_base64)
20+
from ..utils import base64_to_long, base64url_decode, base64url_encode, long_to_base64
2721
from .base import Key
2822

2923
_binding = None

jose/backends/rsa_backend.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
from pyasn1.error import PyAsn1Error
77
from rsa import DecryptionError
88

9-
from jose.backends._asn1 import (rsa_private_key_pkcs1_to_pkcs8,
10-
rsa_private_key_pkcs8_to_pkcs1,
11-
rsa_public_key_pkcs1_to_pkcs8)
9+
from jose.backends._asn1 import (
10+
rsa_private_key_pkcs1_to_pkcs8, rsa_private_key_pkcs8_to_pkcs1, rsa_public_key_pkcs1_to_pkcs8,
11+
)
1212
from jose.backends.base import Key
1313
from jose.constants import ALGORITHMS
1414
from jose.exceptions import JWEError, JWKError

jose/jwt.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
from jose import jws
77

88
from .constants import ALGORITHMS
9-
from .exceptions import (ExpiredSignatureError, JWSError, JWTClaimsError,
10-
JWTError)
9+
from .exceptions import ExpiredSignatureError, JWSError, JWTClaimsError, JWTError
1110
from .utils import calculate_at_hash, timedelta_total_seconds
1211

1312

pyproject.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[tool.isort]
2+
multi_line_output = 5
3+
include_trailing_comma = true
4+
force_grid_wrap = 0
5+
use_parentheses = true
6+
ensure_newline_before_comments = true
7+
line_length = 120

tests/algorithms/test_EC.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212
ECDSAECKey = ecdsa = None
1313

1414
try:
15-
from cryptography.hazmat.backends import \
16-
default_backend as CryptographyBackend
15+
from cryptography.hazmat.backends import default_backend as CryptographyBackend
1716
from cryptography.hazmat.primitives.asymmetric import ec as CryptographyEc
1817

1918
from jose.backends.cryptography_backend import CryptographyECKey

tests/test_backends.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
except ImportError:
55
PurePythonRSAKey = None
66
try:
7-
from jose.backends.cryptography_backend import (CryptographyECKey,
8-
CryptographyRSAKey)
7+
from jose.backends.cryptography_backend import CryptographyECKey, CryptographyRSAKey
98
except ImportError:
109
CryptographyRSAKey = CryptographyECKey = None
1110
try:

tox.ini

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,11 @@ deps =
6464
commands =
6565
flake8 jose setup.py
6666
isort jose tests setup.py --check-only
67+
68+
[testenv:lintfix]
69+
basepython = python3.8
70+
skip_install= True
71+
deps =
72+
isort
73+
commands =
74+
isort jose tests setup.py

0 commit comments

Comments
 (0)