Python bindings src: PEP8 compliance
* import namespace clearance for src/*.py. * Fixed a handful of is/is not None checks as well.
This commit is contained in:
parent
279cac0ffb
commit
7962cde13c
@ -95,7 +95,6 @@ GPGME documentation: https://www.gnupg.org/documentation/manuals/gpgme/
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import, print_function, unicode_literals
|
||||
del absolute_import, print_function, unicode_literals
|
||||
|
||||
from . import core
|
||||
from . import errors
|
||||
@ -106,6 +105,8 @@ from . import version
|
||||
from .core import Context
|
||||
from .core import Data
|
||||
|
||||
del absolute_import, print_function, unicode_literals
|
||||
|
||||
# Interface hygiene.
|
||||
|
||||
# Drop the low-level gpgme that creeps in for some reason.
|
||||
|
@ -16,17 +16,18 @@
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
from __future__ import absolute_import, print_function, unicode_literals
|
||||
del absolute_import, print_function, unicode_literals
|
||||
|
||||
from getpass import getpass
|
||||
|
||||
del absolute_import, print_function, unicode_literals
|
||||
|
||||
|
||||
def passphrase_stdin(hint, desc, prev_bad, hook=None):
|
||||
"""This is a sample callback that will read a passphrase from
|
||||
the terminal. The hook here, if present, will be used to describe
|
||||
why the passphrase is needed."""
|
||||
why = ''
|
||||
if hook != None:
|
||||
if hook is not None:
|
||||
why = ' ' + hook
|
||||
if prev_bad:
|
||||
why += ' (again)'
|
||||
@ -35,7 +36,7 @@ def passphrase_stdin(hint, desc, prev_bad, hook=None):
|
||||
|
||||
|
||||
def progress_stdout(what, type, current, total, hook=None):
|
||||
print("PROGRESS UPDATE: what = %s, type = %d, current = %d, total = %d" %\
|
||||
print("PROGRESS UPDATE: what = %s, type = %d, current = %d, total = %d" %
|
||||
(what, type, current, total))
|
||||
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from __future__ import absolute_import, print_function, unicode_literals
|
||||
del absolute_import, print_function, unicode_literals
|
||||
|
||||
import re
|
||||
import os
|
||||
@ -14,6 +13,8 @@ from . import constants
|
||||
from . import errors
|
||||
from . import util
|
||||
|
||||
del absolute_import, print_function, unicode_literals
|
||||
|
||||
# Copyright (C) 2016-2018 g10 Code GmbH
|
||||
# Copyright (C) 2004, 2008 Igor Belyi <belyi@users.sourceforge.net>
|
||||
# Copyright (C) 2002 John Goerzen <jgoerzen@complete.org>
|
||||
|
@ -17,11 +17,12 @@
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
from __future__ import absolute_import, print_function, unicode_literals
|
||||
del absolute_import, print_function, unicode_literals
|
||||
|
||||
from . import gpgme
|
||||
from . import util
|
||||
|
||||
del absolute_import, print_function, unicode_literals
|
||||
|
||||
# To appease static analysis tools, we define some constants here.
|
||||
# They are overwritten with the proper values by process_constants.
|
||||
NO_ERROR = None
|
||||
@ -64,33 +65,33 @@ class GpgError(Exception):
|
||||
|
||||
@property
|
||||
def code(self):
|
||||
if self.error == None:
|
||||
if self.error is None:
|
||||
return None
|
||||
return gpgme.gpgme_err_code(self.error)
|
||||
|
||||
@property
|
||||
def code_str(self):
|
||||
if self.error == None:
|
||||
if self.error is None:
|
||||
return None
|
||||
return gpgme.gpgme_strerror(self.error)
|
||||
|
||||
@property
|
||||
def source(self):
|
||||
if self.error == None:
|
||||
if self.error is None:
|
||||
return None
|
||||
return gpgme.gpgme_err_source(self.error)
|
||||
|
||||
@property
|
||||
def source_str(self):
|
||||
if self.error == None:
|
||||
if self.error is None:
|
||||
return None
|
||||
return gpgme.gpgme_strsource(self.error)
|
||||
|
||||
def __str__(self):
|
||||
msgs = []
|
||||
if self.context != None:
|
||||
if self.context is not None:
|
||||
msgs.append(self.context)
|
||||
if self.error != None:
|
||||
if self.error is not None:
|
||||
msgs.append(self.source_str)
|
||||
msgs.append(self.code_str)
|
||||
return ': '.join(msgs)
|
||||
|
@ -17,10 +17,11 @@
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
from __future__ import absolute_import, print_function, unicode_literals
|
||||
del absolute_import, print_function, unicode_literals
|
||||
|
||||
import sys
|
||||
|
||||
del absolute_import, print_function, unicode_literals
|
||||
|
||||
|
||||
def process_constants(prefix, scope):
|
||||
"""Called by the constant modules to load up the constants from the C
|
||||
|
Loading…
Reference in New Issue
Block a user