From 154389f2a5e4c13081cf0624222aad29ee480b56 Mon Sep 17 00:00:00 2001 From: Tobias Mueller Date: Tue, 29 Nov 2016 23:26:20 +0100 Subject: [PATCH] python: Make Context have a repr method. * lang/python/gpg/core.py (Context.__repr__): New function. -- This makes Context objects look nicer in a REPL. Signed-off-by: Tobias Mueller --- lang/python/gpg/core.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lang/python/gpg/core.py b/lang/python/gpg/core.py index 748bcbb9..43856ab7 100644 --- a/lang/python/gpg/core.py +++ b/lang/python/gpg/core.py @@ -204,6 +204,14 @@ class Context(GpgmeWrapper): self.pinentry_mode = pinentry_mode self.protocol = protocol + def __repr__(self): + return ( + "Context(armor={0.armor}, " + "textmode={0.textmode}, offline={0.offline}, " + "signers={0.signers}, pinentry_mode={0.pinentry_mode}, " + "protocol={0.protocol}" + ")").format(self) + def encrypt(self, plaintext, recipients=[], sign=True, sink=None, passphrase=None, always_trust=False, add_encrypt_to=False, prepare=False, expect_sign=False, compress=True):