Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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