summaryrefslogtreecommitdiffstats
path: root/custodia/store
diff options
context:
space:
mode:
authorSimo Sorce <simo@redhat.com>2015-09-29 11:20:38 -0400
committerSimo Sorce <simo@redhat.com>2015-10-19 12:16:52 -0400
commit5fceed2d9be1001fc486d801e0a0f923d8dd3159 (patch)
treefc51762aa859135a1ebdaa9e96c95b25a847991c /custodia/store
parent18178ce292ae2f88528c7e6256c9956ec9ebf896 (diff)
downloadcustodia-5fceed2d9be1001fc486d801e0a0f923d8dd3159.tar.gz
custodia-5fceed2d9be1001fc486d801e0a0f923d8dd3159.tar.xz
custodia-5fceed2d9be1001fc486d801e0a0f923d8dd3159.zip
Make tox pep8 happy
Signed-off-by: Simo Sorce <simo@redhat.com> Reviewed-by: Christian Heimes <cheimes@redhat.com>
Diffstat (limited to 'custodia/store')
-rw-r--r--custodia/store/enclite.py20
-rw-r--r--custodia/store/sqlite.py10
2 files changed, 16 insertions, 14 deletions
diff --git a/custodia/store/enclite.py b/custodia/store/enclite.py
index c22f537..3f88d6b 100644
--- a/custodia/store/enclite.py
+++ b/custodia/store/enclite.py
@@ -1,8 +1,10 @@
# Copyright (C) 2015 Custodia Project Contributors - see LICENSE file
-from custodia.store.sqlite import SqliteStore
from jwcrypto.common import json_decode, json_encode
-from jwcrypto import jwk, jwe
+from jwcrypto.jwe import JWE
+from jwcrypto.jwk import JWK
+
+from custodia.store.sqlite import SqliteStore
class EncryptedStore(SqliteStore):
@@ -17,7 +19,7 @@ class EncryptedStore(SqliteStore):
with open(config['master_key']) as f:
data = f.read()
key = json_decode(data)
- self.mkey = jwk.JWK(**key)
+ self.mkey = JWK(**key)
if 'master_enctype' in config:
self.enc = config['master_enctype']
@@ -26,12 +28,12 @@ class EncryptedStore(SqliteStore):
def get(self, key):
value = super(EncryptedStore, self).get(key)
- E = jwe.JWE()
- E.deserialize(value, self.mkey)
- return E.payload.decode('utf-8')
+ jwe = JWE()
+ jwe.deserialize(value, self.mkey)
+ return jwe.payload.decode('utf-8')
def set(self, key, value, replace=False):
- E = jwe.JWE(value, json_encode({'alg': 'dir', 'enc': self.enc}))
- E.add_recipient(self.mkey)
- cvalue = E.serialize(compact=True)
+ jwe = JWE(value, json_encode({'alg': 'dir', 'enc': self.enc}))
+ jwe.add_recipient(self.mkey)
+ cvalue = jwe.serialize(compact=True)
return super(EncryptedStore, self).set(key, cvalue, replace)
diff --git a/custodia/store/sqlite.py b/custodia/store/sqlite.py
index e96848f..44d139f 100644
--- a/custodia/store/sqlite.py
+++ b/custodia/store/sqlite.py
@@ -1,10 +1,13 @@
# Copyright (C) 2015 Custodia Project Contributors - see LICENSE file
from __future__ import print_function
-from custodia.store.interface import CSStore, CSStoreError, CSStoreExists
+
import os
import sqlite3
import sys
+import unittest
+
+from custodia.store.interface import CSStore, CSStoreError, CSStoreExists
def log_error(error):
@@ -104,9 +107,6 @@ class SqliteStore(CSStore):
return False
-import unittest
-
-
class SqliteStoreTests(unittest.TestCase):
@classmethod
@@ -114,7 +114,7 @@ class SqliteStoreTests(unittest.TestCase):
cls.store = SqliteStore({'dburi': 'testdbstore.sqlite'})
@classmethod
- def tearDownClass(self):
+ def tearDownClass(cls):
try:
os.unlink('testdbstore.sqlite')
except OSError: