How to use the pluginbase._ImportHook function in pluginbase

To help you get started, we’ve selected a few pluginbase examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mitsuhiko / pluginbase / pluginbase.py View on Github external
ref_globals = sys._getframe(1).f_globals
            space = _discover_space(name, ref_globals)
            if space is not None:
                actual_name = space._rewrite_module_path(name)
                if actual_name is not None:
                    import_name = actual_name

        return self._system_import(import_name, globals, locals,
                                   fromlist, level)


try:
    import __builtin__ as builtins
except ImportError:
    import builtins
import_hook = _ImportHook(__name__ + '.import_hook', builtins.__import__)
builtins.__import__ = import_hook.plugin_import
sys.modules[import_hook.__name__] = import_hook
del builtins

pluginbase

PluginBase is a module for Python that enables the development of flexible plugin systems in Python.

BSD-2-Clause
Latest version published 4 years ago

Package Health Score

58 / 100
Full package analysis