An Python re-implementation of hierarchical module import.
This code is intended to be read, not executed. However, it does work
-- all you need to do to enable it is "import knee".
(The name is a pun on the klunkier predecessor of this module, "ni".)
- ensure_fromlist(m, fromlist, recursive=0)
- find_head_package(parent, name)
- import_hook(name, globals=None, locals=None, fromlist=None)
- # Replacement for __import__()
- import_module(partname, fqname, parent)
- load_tail(q, tail)
- original_import = __import__(...)
- __import__(name, globals, locals, fromlist) -> module
Import a module. The globals are only used to determine the context;
they are not modified. The locals are currently unused. The fromlist
should be a list of names to emulate ``from name import ...'', or an
empty list to emulate ``import name''.
When importing a module from a package, note that __import__('A.B', ...)
returns package A when fromlist is empty, but its submodule B when
fromlist is not empty.
- original_reload = reload(...)
- reload(module) -> module
Reload the module. The module must have been successfully imported before.
- # Replacement for reload()
||__file__ = '/usr/lib/python1.6/knee.pyc'|
__name__ = 'knee'