summaryrefslogtreecommitdiff
path: root/src/mailman_pgp/utils/pgp.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/mailman_pgp/utils/pgp.py')
-rw-r--r--src/mailman_pgp/utils/pgp.py20
1 files changed, 8 insertions, 12 deletions
diff --git a/src/mailman_pgp/utils/pgp.py b/src/mailman_pgp/utils/pgp.py
index 0e1e75c..4251693 100644
--- a/src/mailman_pgp/utils/pgp.py
+++ b/src/mailman_pgp/utils/pgp.py
@@ -25,7 +25,7 @@ def verifies(verifications):
"""
:param verifications:
- :type verifications: Sequence[pgpy.types.SignatureVerification]
+ :type verifications: typing.Sequence[pgpy.types.SignatureVerification]
:return: bool
"""
return all(bool(verification) and
@@ -40,7 +40,7 @@ def hashes(verifications):
:param verifications:
:return:
- :rtype: Generator[str]
+ :rtype: typing.Generator[bytes]
"""
for verification in verifications:
for sigsubj in verification.good_signatures:
@@ -56,12 +56,10 @@ def key_from_blob(blob):
:param blob:
:return:
+ :rtype: pgpy.PGPKey
"""
- keys = PGPKey.from_blob(blob)
- if isinstance(keys, tuple):
- return keys[0]
- else:
- return keys
+ key, _ = PGPKey.from_blob(blob)
+ return key
@public
@@ -70,9 +68,7 @@ def key_from_file(file):
:param file:
:return:
+ :rtype: pgpy.PGPKey
"""
- keys = PGPKey.from_file(file)
- if isinstance(keys, tuple):
- return keys[0]
- else:
- return keys
+ key, _ = PGPKey.from_file(file)
+ return key