Hello, On Sat 09 Nov 2019 at 04:48PM -05, Daniel Kahn Gillmor wrote:
> + def pgpy_decrypt(self, keys:List[str], ciphertext:str) -> > Optional[Message]: > + if pgpy is None: > + logging.warning(f'Python module pgpy is not available, not > decrypting (try "apt install python3-pgpy")') > + return None > + keyname:str > + ret:Optional[Message] = None > + for keyname in keys: > + try: > + key:pgpy.PGPKey > + key, _ = pgpy.PGPKey.from_file(keyname) > + msg:pgpy.PGPMessage = pgpy.PGPMessage.from_blob(ciphertext) > + msg = key.decrypt(msg) > + return email.message_from_bytes(msg.message) > + except: > + pass > + return None > + I can delete the `ret:Optional[Message] = None` line, right? I don't see the ret variable being used after its declaration. -- Sean Whitton
signature.asc
Description: PGP signature