Skip to content

Commit 70a7ca0

Browse files
committed
more isort
1 parent 9691962 commit 70a7ca0

28 files changed

+96
-176
lines changed

src/cryptojwt/__init__.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,10 @@
99
from cryptojwt.key_jar import KeyJar
1010

1111
from .exception import BadSyntax
12-
from .utils import as_unicode
13-
from .utils import b64d
14-
from .utils import b64encode_item
15-
from .utils import split_token
12+
from .utils import as_unicode, b64d, b64encode_item, split_token
1613

1714
try:
18-
from builtins import zip
19-
from builtins import hex
20-
from builtins import str
15+
from builtins import hex, str, zip
2116
except ImportError:
2217
pass
2318

src/cryptojwt/jwe/aes.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,11 @@
33

44
from cryptography.hazmat.backends import default_backend
55
from cryptography.hazmat.primitives import hmac
6-
from cryptography.hazmat.primitives.ciphers import Cipher
7-
from cryptography.hazmat.primitives.ciphers import algorithms
8-
from cryptography.hazmat.primitives.ciphers import modes
6+
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
97
from cryptography.hazmat.primitives.ciphers.aead import AESGCM
108
from cryptography.hazmat.primitives.padding import PKCS7
119

12-
from ..exception import MissingKey
13-
from ..exception import Unsupported
14-
from ..exception import VerificationError
10+
from ..exception import MissingKey, Unsupported, VerificationError
1511
from . import Encrypter
1612
from .exception import UnsupportedBitLength
1713
from .utils import get_keys_seclen_dgst

src/cryptojwt/jwe/jwe.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@
66
from ..jwk.jwk import key_from_jwk_dict
77
from ..jwk.rsa import RSAKey
88
from ..jwx import JWx
9-
from .exception import DecryptionFailed
10-
from .exception import NoSuitableDecryptionKey
11-
from .exception import NoSuitableECDHKey
12-
from .exception import NoSuitableEncryptionKey
13-
from .exception import NotSupportedAlgorithm
14-
from .exception import WrongEncryptionAlgorithm
9+
from .exception import (
10+
DecryptionFailed,
11+
NoSuitableDecryptionKey,
12+
NoSuitableECDHKey,
13+
NoSuitableEncryptionKey,
14+
NotSupportedAlgorithm,
15+
WrongEncryptionAlgorithm,
16+
)
1517
from .jwe_ec import JWE_EC
1618
from .jwe_hmac import JWE_SYM
1719
from .jwe_rsa import JWE_RSA

src/cryptojwt/jwe/jwe_ec.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,14 @@
22

33
from cryptography.hazmat.backends import default_backend
44
from cryptography.hazmat.primitives.asymmetric import ec
5-
from cryptography.hazmat.primitives.keywrap import aes_key_unwrap
6-
from cryptography.hazmat.primitives.keywrap import aes_key_wrap
7-
8-
from ..jwk.ec import NIST2SEC
9-
from ..jwk.ec import ECKey
10-
from ..utils import as_bytes
11-
from ..utils import as_unicode
12-
from ..utils import b64d
13-
from ..utils import b64e
5+
from cryptography.hazmat.primitives.keywrap import aes_key_unwrap, aes_key_wrap
6+
7+
from ..jwk.ec import NIST2SEC, ECKey
8+
from ..utils import as_bytes, as_unicode, b64d, b64e
149
from . import KEY_LEN
1510
from .jwekey import JWEKey
1611
from .jwenc import JWEnc
17-
from .utils import concat_sha256
18-
from .utils import get_random_bytes
12+
from .utils import concat_sha256, get_random_bytes
1913

2014

2115
def ecdh_derive_key(key, epk, apu, apv, alg, dk_len):

src/cryptojwt/jwe/jwe_hmac.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,11 @@
22
import zlib
33

44
from cryptography.hazmat.backends import default_backend
5-
from cryptography.hazmat.primitives.keywrap import aes_key_unwrap
6-
from cryptography.hazmat.primitives.keywrap import aes_key_wrap
5+
from cryptography.hazmat.primitives.keywrap import aes_key_unwrap, aes_key_wrap
76

8-
from ..exception import MissingKey
9-
from ..exception import WrongNumberOfParts
7+
from ..exception import MissingKey, WrongNumberOfParts
108
from ..jwk.hmac import SYMKey
11-
from ..utils import as_bytes
12-
from ..utils import intarr2str
9+
from ..utils import as_bytes, intarr2str
1310
from .jwekey import JWEKey
1411
from .jwenc import JWEnc
1512

src/cryptojwt/jwe/jwe_rsa.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33

44
from ..utils import as_bytes
55
from . import SUPPORTED
6-
from .exception import NotSupportedAlgorithm
7-
from .exception import ParameterError
6+
from .exception import NotSupportedAlgorithm, ParameterError
87
from .jwekey import JWEKey
98
from .jwenc import JWEnc
109
from .rsa import RSAEncrypter

src/cryptojwt/jwe/jwekey.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
from ..jwx import JWx
22
from . import KEY_LEN_BYTES
3-
from .aes import AES_CBCEncrypter
4-
from .aes import AES_GCMEncrypter
5-
from .exception import DecryptionFailed
6-
from .exception import NotSupportedAlgorithm
7-
from .utils import alg2keytype
8-
from .utils import get_random_bytes
9-
from .utils import split_ctx_and_tag
3+
from .aes import AES_CBCEncrypter, AES_GCMEncrypter
4+
from .exception import DecryptionFailed, NotSupportedAlgorithm
5+
from .utils import alg2keytype, get_random_bytes, split_ctx_and_tag
106

117

128
class JWEKey(JWx):

src/cryptojwt/jwe/utils.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44

55
from cryptography.hazmat.backends import default_backend
66
from cryptography.hazmat.primitives import hashes
7-
from cryptography.hazmat.primitives.hashes import SHA256
8-
from cryptography.hazmat.primitives.hashes import SHA384
9-
from cryptography.hazmat.primitives.hashes import SHA512
7+
from cryptography.hazmat.primitives.hashes import SHA256, SHA384, SHA512
108

119
from ..utils import b64e
1210

src/cryptojwt/jwk/__init__.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,7 @@
55
from typing import List
66

77
from ..exception import UnsupportedAlgorithm
8-
from ..utils import as_bytes
9-
from ..utils import as_unicode
10-
from ..utils import b64e
11-
from ..utils import base64url_to_long
8+
from ..utils import as_bytes, as_unicode, b64e, base64url_to_long
129
from .utils import DIGEST_HASH
1310

1411
USE = {"sign": "sig", "decrypt": "enc", "encrypt": "enc", "verify": "sig"}

src/cryptojwt/jwk/asym.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
from . import JWK
2-
from . import USE
1+
from . import JWK, USE
32

43

54
class AsymmetricKey(JWK):

0 commit comments

Comments
 (0)