Fixed pep8 issues
diff --git a/cryptography/fernet.py b/cryptography/fernet.py
index 880d96f..ef64b7e 100644
--- a/cryptography/fernet.py
+++ b/cryptography/fernet.py
@@ -28,7 +28,9 @@
def _encrypt_from_parts(self, data, current_time, iv):
if isinstance(data, six.text_type):
- raise TypeError("Unicode-objects must be encoded before encryption")
+ raise TypeError(
+ "Unicode-objects must be encoded before encryption"
+ )
padder = padding.PKCS7(ciphers.AES.block_size).padder()
padded_data = padder.update(data) + padder.finalize()
@@ -49,7 +51,9 @@
def decrypt(self, data, ttl=None, current_time=None):
if isinstance(data, six.text_type):
- raise TypeError("Unicode-objects must be encoded before decryption")
+ raise TypeError(
+ "Unicode-objects must be encoded before decryption"
+ )
if current_time is None:
current_time = int(time.time())
diff --git a/tests/test_fernet.py b/tests/test_fernet.py
index 1507171..b0f22f0 100644
--- a/tests/test_fernet.py
+++ b/tests/test_fernet.py
@@ -40,21 +40,19 @@
)
def test_verify(self, secret, now, src, ttl_sec, token):
f = Fernet(base64.urlsafe_b64decode(secret.encode("ascii")))
+ current_time = calendar.timegm(iso8601.parse_date(now).utctimetuple())
payload = f.decrypt(
- token.encode("ascii"),
- ttl=ttl_sec,
- current_time=calendar.timegm(iso8601.parse_date(now).utctimetuple())
+ token.encode("ascii"), ttl=ttl_sec, current_time=current_time
)
assert payload == src
@json_parametrize(("secret", "token", "now", "ttl_sec"), "invalid.json")
def test_invalid(self, secret, token, now, ttl_sec):
f = Fernet(base64.urlsafe_b64decode(secret.encode("ascii")))
+ current_time = calendar.timegm(iso8601.parse_date(now).utctimetuple())
with pytest.raises(InvalidToken):
f.decrypt(
- token.encode("ascii"),
- ttl=ttl_sec,
- current_time=calendar.timegm(iso8601.parse_date(now).utctimetuple())
+ token.encode("ascii"), ttl=ttl_sec, current_time=current_time
)
def test_unicode(self):