Skip to content

Commit

Permalink
Merge pull request #166 from olcf/ngin_cleanup
Browse files Browse the repository at this point in the history
cleanup python2/parallel commits
  • Loading branch information
Noah Ginsburg authored Apr 5, 2020
2 parents 498bdf9 + 0ebd16f commit ee93a22
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 17 deletions.
17 changes: 7 additions & 10 deletions libpkpass/identities.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""This Module handles the identitydb object"""
import os
import tempfile
import threading
from threading import Thread
import libpkpass.crypto as crypto
from libpkpass.errors import FileOpenError, CliArgumentError

Expand Down Expand Up @@ -78,15 +78,12 @@ def load_certs_from_directory(self,
if certpath:
self._load_from_directory(certpath, 'certificate')
if verify_on_load:
x_ls = self.iddb.keys()
thread_list = []
results = []
for username in x_ls:
thread = threading.Thread(target=self.verify_identity, args=(username, results))
thread_list.append(thread)
for thread in thread_list:
thread.start()
for thread in thread_list:
threads = []
for identity, _ in self.iddb.items():
threads.append(Thread(target=self.verify_identity,
args=(identity, [])))
threads[-1].start()
for thread in threads:
thread.join()

#######################################################################
Expand Down
13 changes: 7 additions & 6 deletions libpkpass/password.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import libpkpass.crypto as crypto

#######################################################################
class PasswordEntry(object):
class PasswordEntry():
""" Password entry object. Contains information about a password and
related metadata, as well as a list of individually encrypted strings"""
##########################################################################
Expand Down Expand Up @@ -110,10 +110,10 @@ def add_recipients(
#######################################################################
if recipients is None:
recipients = []
for recipient in recipients:
self.recipients[recipient] = self._add_recipient(recipient, secret, distributor,
identitydb, encryption_algorithm, passphrase,
card_slot)

self.recipients = {r:self._add_recipient(
r, secret, distributor, identitydb, encryption_algorithm, passphrase, card_slot
) for r in recipients}
if escrow_users:
#escrow_users may now be none after the set operations
if (len(escrow_users) > 3) and (len(list((set(escrow_users) - set(recipients)))) < 3):
Expand Down Expand Up @@ -145,7 +145,8 @@ def _add_recipient(
identitydb=None,
encryption_algorithm='rsautl',
passphrase=None,
card_slot=None):
card_slot=None,
):
"""Add recipient or sharer to list"""
#######################################################################
try:
Expand Down
2 changes: 1 addition & 1 deletion libpkpass/passworddb.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from libpkpass.errors import PasswordIOError

##############################################################################
class PasswordDB(object):
class PasswordDB():
""" Password database object. Gets and retrieves password entries from places
passwords are stored"""
##############################################################################
Expand Down

0 comments on commit ee93a22

Please sign in to comment.