[git] GPGME - branch, master, updated. gpgme-1.11.1-123-gb5fbe90

by Ben McGinnes cvs at cvs.gnupg.org
Sat Aug 18 10:48:15 CEST 2018


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GnuPG Made Easy".

The branch, master has been updated
       via  b5fbe90676f46b9615919133753a65b20318fe63 (commit)
      from  fc55caccfc87253e1703df66b21917cc399fba62 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit b5fbe90676f46b9615919133753a65b20318fe63
Author: Ben McGinnes <ben at adversary.org>
Date:   Sat Aug 18 18:46:47 2018 +1000

    Python bindings examples: PEP8 conpliance
    
    * Appears to be complete compliance.

diff --git a/lang/python/examples/assuan.py b/lang/python/examples/assuan.py
index dd42ad4..6784c9e 100644
--- a/lang/python/examples/assuan.py
+++ b/lang/python/examples/assuan.py
@@ -14,14 +14,14 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, see <http://www.gnu.org/licenses/>.
-
 """Demonstrate the use of the Assuan protocol engine"""
 
 from __future__ import absolute_import, print_function, unicode_literals
-del absolute_import, print_function, unicode_literals
 
 import gpg
 
+del absolute_import, print_function, unicode_literals
+
 with gpg.Context(protocol=gpg.constants.protocol.ASSUAN) as c:
     # Invoke the pinentry to get a confirmation.
     err = c.assuan_transact(['GET_CONFIRMATION', 'Hello there'])
diff --git a/lang/python/examples/decryption-filter.py b/lang/python/examples/decryption-filter.py
index 987dfd1..4d99330 100644
--- a/lang/python/examples/decryption-filter.py
+++ b/lang/python/examples/decryption-filter.py
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 #
-# Copyright (C) 2016 g10 Code GmbH
+# Copyright (C) 2016, 2018 g10 Code GmbH
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -14,7 +14,6 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, see <http://www.gnu.org/licenses/>.
-
 """A decryption filter
 
 This demonstrates decryption using gpg3 in three lines of code.  To
@@ -25,8 +24,10 @@ be used like this:
 """
 
 from __future__ import absolute_import, print_function, unicode_literals
-del absolute_import, print_function, unicode_literals
 
 import sys
 import gpg
+
+del absolute_import, print_function, unicode_literals
+
 gpg.Context().decrypt(sys.stdin, sink=sys.stdout)
diff --git a/lang/python/examples/delkey.py b/lang/python/examples/delkey.py
index 12510f3..30b3145 100755
--- a/lang/python/examples/delkey.py
+++ b/lang/python/examples/delkey.py
@@ -20,10 +20,11 @@
 # It deletes keys for joe at example.org generated by genkey.py script
 
 from __future__ import absolute_import, print_function, unicode_literals
-del absolute_import, print_function, unicode_literals
 
 import gpg
 
+del absolute_import, print_function, unicode_literals
+
 with gpg.Context() as c:
     # Note: We must not modify the key store during iteration,
     # therefore, we explicitly make a list.
diff --git a/lang/python/examples/exportimport.py b/lang/python/examples/exportimport.py
index d84a01c..36ced57 100755
--- a/lang/python/examples/exportimport.py
+++ b/lang/python/examples/exportimport.py
@@ -20,12 +20,13 @@
 # It uses keys for joe+gpg at example.org generated by genkey.py script
 
 from __future__ import absolute_import, print_function, unicode_literals
-del absolute_import, print_function, unicode_literals
 
 import sys
 import os
 import gpg
 
+del absolute_import, print_function, unicode_literals
+
 user = "joe+gpg at example.org"
 
 with gpg.Context(armor=True) as c, gpg.Data() as expkey:
diff --git a/lang/python/examples/genkey.py b/lang/python/examples/genkey.py
index a043500..710a530 100755
--- a/lang/python/examples/genkey.py
+++ b/lang/python/examples/genkey.py
@@ -18,10 +18,11 @@
 # along with this program; if not, see <http://www.gnu.org/licenses/>.
 
 from __future__ import absolute_import, print_function, unicode_literals
-del absolute_import, print_function, unicode_literals
 
 import gpg
 
+del absolute_import, print_function, unicode_literals
+
 # This is the example from the GPGME manual.
 
 parms = """<GnupgKeyParms format="internal">
diff --git a/lang/python/examples/inter-edit.py b/lang/python/examples/inter-edit.py
index ed0d8c4..5b58c97 100644
--- a/lang/python/examples/inter-edit.py
+++ b/lang/python/examples/inter-edit.py
@@ -15,15 +15,15 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, see <http://www.gnu.org/licenses/>.
-
 """Simple interactive editor to test editor scripts"""
 
 from __future__ import absolute_import, print_function, unicode_literals
-del absolute_import, print_function, unicode_literals
 
 import sys
 import gpg
 
+del absolute_import, print_function, unicode_literals
+
 if len(sys.argv) != 2:
     sys.exit("Usage: %s <Gpg key pattern>\n" % sys.argv[0])
 
@@ -40,10 +40,12 @@ with gpg.Context() as c:
     print("Editing key {} ({}):".format(key.uids[0].uid, key.subkeys[0].fpr))
 
     def edit_fnc(keyword, args):
-        print("Status: {}, args: {} > ".format(
-            keyword, args), end='', flush=True)
+        print(
+            "Status: {}, args: {} > ".format(keyword, args),
+            end='',
+            flush=True)
 
-        if not 'GET' in keyword:
+        if 'GET' not in keyword:
             # no prompt
             print()
             return None
diff --git a/lang/python/examples/low_level-encrypt_to_all.py b/lang/python/examples/low_level-encrypt_to_all.py
index bad4220..5c10d3d 100755
--- a/lang/python/examples/low_level-encrypt_to_all.py
+++ b/lang/python/examples/low_level-encrypt_to_all.py
@@ -16,18 +16,18 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, see <http://www.gnu.org/licenses/>.
-
 """
 This program will try to encrypt a simple message to each key on your
 keyring.  If your keyring has any invalid keys on it, those keys will
 be skipped and it will re-try the encryption."""
 
 from __future__ import absolute_import, print_function, unicode_literals
-del absolute_import, print_function, unicode_literals
 
 import sys
 import gpg
 
+del absolute_import, print_function, unicode_literals
+
 with gpg.Context(armor=True) as c:
     recipients = list()
     for key in c.keylist():
@@ -40,14 +40,15 @@ with gpg.Context(armor=True) as c:
     while not ciphertext:
         print("Encrypting to %d recipients" % len(recipients))
         try:
-            ciphertext, _, _ = c.encrypt(b'This is my message.',
-                                         recipients=recipients)
+            ciphertext, _, _ = c.encrypt(
+                b'This is my message.', recipients=recipients)
         except gpg.errors.InvalidRecipients as e:
             print("Encryption failed for these keys:\n{0!s}".format(e))
 
             # filter out the bad keys
             bad_keys = {bad.fpr for bad in e.recipients}
-            recipients = [r for r in recipients
-                          if not r.subkeys[0].fpr in bad_keys]
+            recipients = [
+                r for r in recipients if not r.subkeys[0].fpr in bad_keys
+            ]
 
     sys.stdout.buffer.write(ciphertext)
diff --git a/lang/python/examples/sign.py b/lang/python/examples/sign.py
index 16c2256..5b90b4b 100755
--- a/lang/python/examples/sign.py
+++ b/lang/python/examples/sign.py
@@ -17,12 +17,13 @@
 # along with this program; if not, see <http://www.gnu.org/licenses/>.
 
 from __future__ import absolute_import, print_function, unicode_literals
-del absolute_import, print_function, unicode_literals
 
 import sys
 import gpg
 from gpg.constants.sig import mode
 
+del absolute_import, print_function, unicode_literals
+
 with gpg.Context() as c:
     signed, _ = c.sign(b"Test message", mode=mode.CLEAR)
     sys.stdout.buffer.write(signed)
diff --git a/lang/python/examples/signverify.py b/lang/python/examples/signverify.py
index 5870ca9..2df7275 100755
--- a/lang/python/examples/signverify.py
+++ b/lang/python/examples/signverify.py
@@ -20,12 +20,13 @@
 # It uses keys for joe+gpg at example.org generated by genkey.py script
 
 from __future__ import absolute_import, print_function, unicode_literals
-del absolute_import, print_function, unicode_literals
 
 import sys
 import gpg
 from gpg.constants.sig import mode
 
+del absolute_import, print_function, unicode_literals
+
 user = "joe+gpg"
 
 with gpg.Context(pinentry_mode=gpg.constants.PINENTRY_MODE_LOOPBACK) as c:
diff --git a/lang/python/examples/simple.py b/lang/python/examples/simple.py
index 8f451d7..17c3eba 100755
--- a/lang/python/examples/simple.py
+++ b/lang/python/examples/simple.py
@@ -18,11 +18,12 @@
 # along with this program; if not, see <http://www.gnu.org/licenses/>.
 
 from __future__ import absolute_import, print_function, unicode_literals
-del absolute_import, print_function, unicode_literals
 
 import sys
 import gpg
 
+del absolute_import, print_function, unicode_literals
+
 with gpg.Context(armor=True) as c:
     recipients = []
     print("Enter name of your recipient(s), end with a blank line.")
@@ -40,8 +41,8 @@ with gpg.Context(armor=True) as c:
     if not recipients:
         sys.exit("No recipients.")
 
-    print("Encrypting for {}.".format(", ".join(k.uids[0].name
-                                                for k in recipients)))
+    print("Encrypting for {}.".format(", ".join(
+        k.uids[0].name for k in recipients)))
 
     ciphertext, _, _ = c.encrypt(b"This is my message,", recipients)
     sys.stdout.buffer.write(ciphertext)
diff --git a/lang/python/examples/testCMSgetkey.py b/lang/python/examples/testCMSgetkey.py
index d4c0884..f1cdb2c 100644
--- a/lang/python/examples/testCMSgetkey.py
+++ b/lang/python/examples/testCMSgetkey.py
@@ -15,15 +15,15 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, see <http://www.gnu.org/licenses/>.
-
 """A test applicaton for the CMS protocol."""
 
 from __future__ import absolute_import, print_function, unicode_literals
-del absolute_import, print_function, unicode_literals
 
 import sys
 import gpg
 
+del absolute_import, print_function, unicode_literals
+
 if len(sys.argv) != 2:
     sys.exit("fingerprint or unique key ID for gpgme_get_key()")
 
diff --git a/lang/python/examples/verifydetails.py b/lang/python/examples/verifydetails.py
index b3ca133..dc0e7d3 100755
--- a/lang/python/examples/verifydetails.py
+++ b/lang/python/examples/verifydetails.py
@@ -18,11 +18,13 @@
 # along with this program; if not, see <http://www.gnu.org/licenses/>.
 
 from __future__ import absolute_import, print_function, unicode_literals
-del absolute_import, print_function, unicode_literals
 
 import sys
 import gpg
 
+del absolute_import, print_function, unicode_literals
+
+
 def print_engine_infos():
     print("gpgme version:", gpg.core.check_version(None))
     print("engines:")
@@ -31,8 +33,9 @@ def print_engine_infos():
         print(engine.file_name, engine.version)
 
     for proto in [gpg.constants.protocol.OpenPGP, gpg.constants.protocol.CMS]:
-        print("Have {}? {}".format(gpg.core.get_protocol_name(proto),
-                                   gpg.core.engine_check_version(proto)))
+        print("Have {}? {}".format(
+            gpg.core.get_protocol_name(proto),
+            gpg.core.engine_check_version(proto)))
 
 
 def verifyprintdetails(filename, detached_sig_filename=None):
@@ -40,9 +43,9 @@ def verifyprintdetails(filename, detached_sig_filename=None):
     with gpg.Context() as c:
 
         # Verify.
-        data, result = c.verify(open(filename),
-                                open(detached_sig_filename)
-                                if detached_sig_filename else None)
+        data, result = c.verify(
+            open(filename),
+            open(detached_sig_filename) if detached_sig_filename else None)
 
         # List results for all signatures. Status equal 0 means "Ok".
         for index, sign in enumerate(result.signatures):
@@ -57,15 +60,15 @@ def verifyprintdetails(filename, detached_sig_filename=None):
     if data:
         sys.stdout.buffer.write(data)
 
+
 def main():
     print_engine_infos()
     print()
 
     argc = len(sys.argv)
     if argc < 2 or argc > 3:
-        sys.exit(
-            "Usage: {} <filename>[ <detached_signature_filename>]".format(
-                sys.argv[0]))
+        sys.exit("Usage: {} <filename>[ <detached_signature_filename>]".format(
+            sys.argv[0]))
 
     if argc == 2:
         print("trying to verify file {}.".format(sys.argv[1]))
@@ -74,5 +77,6 @@ def main():
         print("trying to verify signature {1} for file {0}.".format(*sys.argv))
         verifyprintdetails(sys.argv[1], sys.argv[2])
 
+
 if __name__ == "__main__":
     main()

-----------------------------------------------------------------------

Summary of changes:
 lang/python/examples/assuan.py                   |  4 ++--
 lang/python/examples/decryption-filter.py        |  7 ++++---
 lang/python/examples/delkey.py                   |  3 ++-
 lang/python/examples/exportimport.py             |  3 ++-
 lang/python/examples/genkey.py                   |  3 ++-
 lang/python/examples/inter-edit.py               | 12 +++++++-----
 lang/python/examples/low_level-encrypt_to_all.py | 13 +++++++------
 lang/python/examples/sign.py                     |  3 ++-
 lang/python/examples/signverify.py               |  3 ++-
 lang/python/examples/simple.py                   |  7 ++++---
 lang/python/examples/testCMSgetkey.py            |  4 ++--
 lang/python/examples/verifydetails.py            | 22 +++++++++++++---------
 12 files changed, 49 insertions(+), 35 deletions(-)


hooks/post-receive
-- 
GnuPG Made Easy
http://git.gnupg.org




More information about the Gnupg-commits mailing list