From 13055e265c738be43c0a4cb4c2898939cd0c1cd5 Mon Sep 17 00:00:00 2001 From: J08nY Date: Wed, 26 Jul 2017 21:19:34 +0200 Subject: Some cleanup of utility functions. --- src/mailman_pgp/utils/pgp.py | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'src') 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 -- cgit v1.2.3-70-g09d2