Skip to content

Commit 36dde95

Browse files
authored
Add isort (#252)
1 parent f321cf0 commit 36dde95

26 files changed

+85
-80
lines changed

jose/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
__copyright__ = 'Copyright 2016 Michael Davis'
55

66

7+
from .exceptions import ExpiredSignatureError # noqa: F401
78
from .exceptions import JOSEError # noqa: F401
89
from .exceptions import JWSError # noqa: F401
9-
from .exceptions import ExpiredSignatureError # noqa: F401
1010
from .exceptions import JWTError # noqa: F401

jose/backends/__init__.py

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

911
try:
10-
from jose.backends.cryptography_backend import CryptographyRSAKey as RSAKey # noqa: F401
12+
from jose.backends.cryptography_backend import \
13+
CryptographyRSAKey as RSAKey # noqa: F401
1114
except ImportError:
1215
try:
1316
from jose.backends.rsa_backend import RSAKey # noqa: F401
1417
except ImportError:
1518
RSAKey = None
1619

1720
try:
18-
from jose.backends.cryptography_backend import CryptographyECKey as ECKey # noqa: F401
21+
from jose.backends.cryptography_backend import \
22+
CryptographyECKey as ECKey # noqa: F401
1923
except ImportError:
2024
from jose.backends.ecdsa_backend import ECDSAECKey as ECKey # noqa: F401
2125

2226
try:
23-
from jose.backends.cryptography_backend import CryptographyAESKey as AESKey # noqa: F401
27+
from jose.backends.cryptography_backend import \
28+
CryptographyAESKey as AESKey # noqa: F401
2429
except ImportError:
2530
AESKey = None
2631

2732
try:
28-
from jose.backends.cryptography_backend import CryptographyHMACKey as HMACKey # noqa: F401
33+
from jose.backends.cryptography_backend import \
34+
CryptographyHMACKey as HMACKey # noqa: F401
2935
except ImportError:
3036
from jose.backends.native import HMACKey # noqa: F401
3137

jose/backends/cryptography_backend.py

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,30 @@
22
import warnings
33

44
import six
5-
6-
from .base import Key
7-
from ..utils import base64_to_long, long_to_base64, base64url_decode, base64url_encode
8-
from ..constants import ALGORITHMS
9-
from ..exceptions import JWKError, JWEError
10-
115
from cryptography.exceptions import InvalidSignature, InvalidTag
126
from cryptography.hazmat.backends import default_backend
137
from cryptography.hazmat.bindings.openssl.binding import Binding
14-
from cryptography.hazmat.primitives import hashes, serialization, hmac
15-
from cryptography.hazmat.primitives.asymmetric import ec, rsa, padding
16-
from cryptography.hazmat.primitives.asymmetric.utils import decode_dss_signature, encode_dss_signature
17-
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, aead, modes
18-
from cryptography.hazmat.primitives.keywrap import aes_key_wrap, aes_key_unwrap, InvalidUnwrap
8+
from cryptography.hazmat.primitives import hashes, hmac, serialization
9+
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)
1917
from cryptography.hazmat.primitives.padding import PKCS7
20-
from cryptography.hazmat.primitives.serialization import load_pem_private_key, load_pem_public_key
18+
from cryptography.hazmat.primitives.serialization import (load_pem_private_key,
19+
load_pem_public_key)
2120
from cryptography.utils import int_to_bytes
2221
from cryptography.x509 import load_pem_x509_certificate
2322

23+
from ..constants import ALGORITHMS
24+
from ..exceptions import JWEError, JWKError
25+
from ..utils import (base64_to_long, base64url_decode, base64url_encode,
26+
long_to_base64)
27+
from .base import Key
28+
2429
_binding = None
2530

2631

jose/backends/ecdsa_backend.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import hashlib
22

3-
from jose.backends.base import Key
43
import ecdsa
54

5+
from jose.backends.base import Key
66
from jose.constants import ALGORITHMS
77
from jose.exceptions import JWKError
88
from jose.utils import base64_to_long, long_to_base64

jose/backends/native.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import hmac
33
import os
44

5-
65
from jose.backends.base import Key
76
from jose.constants import ALGORITHMS
87
from jose.exceptions import JWKError

jose/backends/rsa_backend.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,17 @@
11
import binascii
2-
32
import warnings
43

5-
from pyasn1.error import PyAsn1Error
6-
74
import rsa as pyrsa
85
import rsa.pem as pyrsa_pem
6+
from pyasn1.error import PyAsn1Error
97
from rsa import DecryptionError
108

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)
1112
from jose.backends.base import Key
12-
from jose.backends._asn1 import (
13-
rsa_private_key_pkcs1_to_pkcs8,
14-
rsa_private_key_pkcs8_to_pkcs1,
15-
rsa_public_key_pkcs1_to_pkcs8,
16-
)
1713
from jose.constants import ALGORITHMS
18-
from jose.exceptions import JWKError, JWEError
14+
from jose.exceptions import JWEError, JWKError
1915
from jose.utils import base64_to_long, long_to_base64
2016

2117
ALGORITHMS.SUPPORTED.remove(ALGORITHMS.RSA_OAEP) # RSA OAEP not supported

jose/jwe.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
except ImportError:
1111
from collections import Mapping # Python 2, will be deprecated in Python 3.8
1212

13+
from . import jwk
1314
from .backends import get_random_bytes
1415
from .constants import ALGORITHMS, ZIPS
15-
from .exceptions import JWEParseError, JWEError
16+
from .exceptions import JWEError, JWEParseError
1617
from .utils import base64url_decode, base64url_encode
17-
from . import jwk
1818

1919

2020
def encrypt(plaintext, key, encryption=ALGORITHMS.A256GCM,

jose/jws.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
import binascii
22
import json
3-
from collections.abc import Mapping, Iterable
3+
from collections.abc import Iterable, Mapping
44

55
from jose import jwk
66
from jose.backends.base import Key
77
from jose.constants import ALGORITHMS
8-
from jose.exceptions import JWSError
9-
from jose.exceptions import JWSSignatureError
10-
from jose.utils import base64url_encode
11-
from jose.utils import base64url_decode
8+
from jose.exceptions import JWSError, JWSSignatureError
9+
from jose.utils import base64url_decode, base64url_encode
1210

1311

1412
def sign(payload, key, headers=None, algorithm=ALGORITHMS.HS256):

jose/jwt.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import json
2-
32
from calendar import timegm
43
from collections.abc import Mapping
54
from datetime import datetime, timedelta
65

76
from jose import jws
87

9-
from .exceptions import JWSError, JWTClaimsError, JWTError, ExpiredSignatureError
108
from .constants import ALGORITHMS
11-
from .utils import timedelta_total_seconds, calculate_at_hash
9+
from .exceptions import (ExpiredSignatureError, JWSError, JWTClaimsError,
10+
JWTError)
11+
from .utils import calculate_at_hash, timedelta_total_seconds
1212

1313

1414
def encode(claims, key, algorithm=ALGORITHMS.HS256, headers=None, access_token=None):

setup.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22
import os
33
from pathlib import Path
44

5-
import jose # noqa: F401
6-
75
from setuptools import setup
86

7+
import jose # noqa: F401
98

109
long_description = (Path(__file__).parent / 'README.rst').read_text()
1110

0 commit comments

Comments
 (0)