• Home
  • Raw
  • Download

Lines Matching +full:module +full:- +full:importer

3 Consistent use of this module will make it possible to change the
6 While the built-in module imp exports interfaces to the built-in
7 module searching and loading algorithm, and it is possible to replace
8 the built-in function __import__ in order to change the semantics of
13 This module defines three new concepts:
21 2) A "module loader" class provides an interface to search for a
22 module in a search path and to load it. It defines a method which
23 searches for a module in a single directory; by overriding this method
25 built-in and frozen modules are searched instead.
27 Two module loader class are defined, both implementing the search
28 strategy used by the built-in __import__ function: ModuleLoader uses
29 the imp module's find_module interface, while HookableModuleLoader
31 use the imp module's load_* interfaces to actually load the module.
33 3) A "module importer" class provides an interface to import a
34 module, as well as interfaces to reload and unload a module. It also
38 One module importer class is defined (ModuleImporter), which uses a
39 module loader instance passed in (by default HookableModuleLoader is
45 If a module importer class supports dotted names, its import_module()
53 warnpy3k("the ihooks module has been removed in Python 3.0", stacklevel=2)
99 """Basic module loader.
101 This provides the same functionality as built-in import. It
102 doesn't deal with checking sys.modules -- all it provides is
105 derived class to change the module search algorithm when the basic
110 load_module(name, stuff) loads the module.
208 """Default module loader; uses file system hooks.
278 raise ImportError, "Unrecognized module type (%r) for %s" % \
288 """Fancy module loader -- parses and execs the code itself."""
298 raise ImportError, "No __init__ module in package %s" % name
304 "Bad type (%r) for __init__ module in package %s" % (
339 """Basic module importer; uses module loader.
368 raise ImportError, "No module named %s" % name
371 def reload(self, module, path = None): argument
372 name = str(module.__name__)
375 raise ImportError, "Module %s not found for reload" % name
378 def unload(self, module): argument
379 del self.modules[str(module.__name__)]
380 # XXX Should this try to clear the module's namespace?
402 """A module importer that supports packages."""
405 level=-1):
415 def determine_parent(self, globals, level=-1):
421 raise ValueError, 'Attempted relative import in non-package'
431 # normal module, work out package name if any
435 'non-package')
442 for x in range(level, 1, -1):
447 'top-level package')
453 warn("Parent module '%s' not found while handling "
457 raise SystemError, ("Parent module '%s' not loaded, cannot "
479 raise ImportError, "No module named '%s'" % qname
490 raise ImportError, "No module named '%s'" % mname
508 raise ImportError, "No module named '%s'" % subname
512 # completely empty module name should only happen in
534 def reload(self, module): argument
535 name = str(module.__name__)
547 def install(importer = None): argument
549 current_importer = importer or default_importer or ModuleImporter()