Commit 7d19e69c authored by Chris Lamb's avatar Chris Lamb 💬

Apply black to bidb.keys.tasks now that it is valid Python [3.x].

parent 99ebf5fc
......@@ -11,24 +11,32 @@ from .models import Key
def update_or_create_key(uid):
with TemporaryDirectory() as homedir:
try:
check_output2((
'gpg',
'--homedir', homedir,
'--keyserver', 'pgpkeys.mit.edu',
'--recv-keys', uid,
))
check_output2(
(
'gpg',
'--homedir',
homedir,
'--keyserver',
'pgpkeys.mit.edu',
'--recv-keys',
uid,
)
)
except subprocess.CalledProcessError as exc:
print("E: {}: {}".format(exc, exc.output))
return None, False
data = check_output2((
'gpg',
'--homedir', homedir,
'--with-colons',
'--fixed-list-mode',
'--fingerprint',
uid,
))
data = check_output2(
(
'gpg',
'--homedir',
homedir,
'--with-colons',
'--fixed-list-mode',
'--fingerprint',
uid,
)
)
for line in data.splitlines():
if line.startswith('uid:'):
......@@ -37,9 +45,8 @@ def update_or_create_key(uid):
else:
raise ValueError("Could not parse name from key: {}".format(data))
return Key.objects.update_or_create(uid=uid, defaults={
'name': name,
})
return Key.objects.update_or_create(uid=uid, defaults={'name': name})
@celery.task()
def refresh_all():
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment