python: Drop superfluous imports and trim public interface.
* lang/python/pyme/__init__.py: Avoid leaking low-level 'gpgme', make sure the main module looks nice and tidy, appease pyflakes. * lang/python/pyme/errors.py: Appease pyflakes. * lang/python/pyme/util.py: Avoid leaking low-level 'gpgme' into the module namespace. * lang/python/pyme/version.py.in: Likewise. * lang/python/tests/t-keylist.py: Drop superfluous imports. * lang/python/tests/t-sig-notation.py: Likewise. * lang/python/tests/t-sign.py: Likewise. * lang/python/tests/t-signers.py: Likewise. Signed-off-by: Justus Winter <justus@g10code.com>
This commit is contained in:
parent
2f754440f2
commit
2ff58fcbd5
@ -99,7 +99,24 @@ GPGME documentation: https://www.gnupg.org/documentation/manuals/gpgme/
|
||||
|
||||
"""
|
||||
|
||||
__all__ = ['core', 'errors', 'constants', 'util', 'callbacks', 'version']
|
||||
|
||||
from . import core
|
||||
from . import errors
|
||||
from . import constants
|
||||
from . import util
|
||||
from . import callbacks
|
||||
from . import version
|
||||
from .core import Context
|
||||
from .core import Data
|
||||
|
||||
# Interface hygiene.
|
||||
|
||||
# Drop the low-level gpgme that creeps in for some reason.
|
||||
gpgme = None
|
||||
del gpgme
|
||||
|
||||
# This is a white-list of symbols. Any other will alert pyflakes.
|
||||
_ = [Context, Data, core, errors, constants, util, callbacks, version]
|
||||
del _
|
||||
|
||||
__all__ = ["Context", "Data",
|
||||
"core", "errors", "constants", "util", "callbacks", "version"]
|
||||
|
@ -20,6 +20,9 @@ from . import util
|
||||
|
||||
util.process_constants('GPG_ERR_', globals())
|
||||
|
||||
# To appease static analysis tools, we define some constants here:
|
||||
NO_ERROR = 0
|
||||
|
||||
class PymeError(Exception):
|
||||
pass
|
||||
|
||||
|
@ -16,8 +16,6 @@
|
||||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
from . import gpgme
|
||||
|
||||
def process_constants(prefix, scope):
|
||||
"""Called by the constant modules to load up the constants from the C
|
||||
library starting with PREFIX. Matching constants will be inserted
|
||||
@ -25,6 +23,7 @@ def process_constants(prefix, scope):
|
||||
of inserted constants.
|
||||
|
||||
"""
|
||||
from . import gpgme
|
||||
index = len(prefix)
|
||||
constants = {identifier[index:]: getattr(gpgme, identifier)
|
||||
for identifier in dir(gpgme)
|
||||
|
@ -59,3 +59,6 @@ Lesser General Public License for more details.
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA"""
|
||||
|
||||
# Interface hygiene. Keep this at the end.
|
||||
del gpgme
|
||||
|
@ -17,8 +17,6 @@
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import sys
|
||||
import pyme
|
||||
from pyme import core, constants
|
||||
import support
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
# License along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import os
|
||||
from pyme import core, constants, errors
|
||||
from pyme import core, constants
|
||||
import support
|
||||
|
||||
expected_notations = {
|
||||
|
@ -17,7 +17,6 @@
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import sys
|
||||
import os
|
||||
import pyme
|
||||
from pyme import core, constants
|
||||
|
@ -17,7 +17,6 @@
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import sys
|
||||
import pyme
|
||||
from pyme import core, constants
|
||||
import support
|
||||
|
Loading…
Reference in New Issue
Block a user