Part of bzrlib.lazy_import View In Hierarchy
Known subclasses: bzrlib.tests.test_lazy_import.InstrumentedImportReplacer
It will replace itself with a module, and then make children entries also ImportReplacer objects.
At present, this only supports 'import foo.bar.baz' syntax.
| Method | __init__ | Upon request import 'module_path' as the name 'module_name'. |
| Method | _import | Undocumented |
Inherited from ScopeReplacer:
| Method | __getattribute__ | Undocumented |
| Method | __setattr__ | Undocumented |
| Method | __call__ | Undocumented |
| Method | _replace | Actually replace self with other in the given scope |
| Method | _cleanup | Stop holding on to all the extra stuff |
Upon request import 'module_path' as the name 'module_name'. When imported, prepare children to also be imported.
Examples:
import foo => name='foo' module_path='foo',
member=None, children={}
import foo.bar => name='foo' module_path='foo', member=None,
children={'bar':(['foo', 'bar'], None, {}}
from foo import bar => name='bar' module_path='foo', member='bar'
children={}
from foo import bar, baz would get translated into 2 import
requests. On for 'name=bar' and one for 'name=baz'
| Parameters | scope | The scope that objects should be imported into. Typically this is globals() |
| name | The variable name. Often this is the same as the module_path. 'bzrlib' | |
| module_path | A list for the fully specified module path ['bzrlib', 'foo', 'bar'] | |
| member | The member inside the module to import, often this is None, indicating the module is being imported. | |
| children | Children entries to be imported later. This should be a map of children specifications.
{'foo':(['bzrlib', 'foo'], None,
{'bar':(['bzrlib', 'foo', 'bar'], None {})})
}
|