portage.proxy.lazyimport module

class portage.proxy.lazyimport._LazyImport(scope, alias, name)

Bases: portage.proxy.objectproxy.ObjectProxy

_alias
_get_target()
_name
_scope
_target
class portage.proxy.lazyimport._LazyImportFrom(scope, name, attr_name, alias)

Bases: portage.proxy.lazyimport._LazyImport

_alias
_attr_name
_get_target()
_name
_scope
_target
portage.proxy.lazyimport._preload_portage_submodules()

Load lazily referenced portage submodules into memory, so imports won’t fail during portage upgrade/downgrade. Note that this recursively loads only the modules that are lazily referenced by currently imported modules, so some portage submodules may still remain unimported after this function is called.

portage.proxy.lazyimport._register_module_proxy(name, proxy)
portage.proxy.lazyimport._unregister_module_proxy(name)

Destroy all proxies that reference the give module name. Also, check for other proxies referenced by modules that have been imported and destroy those proxies too. This way, destruction of a single proxy can trigger destruction of all the rest. If a target module appears to be partially imported (indicated when an AttributeError is caught), this function will leave in place proxies that reference it.

portage.proxy.lazyimport.lazyimport(scope, *args)

Create a proxy in the given scope in order to performa a lazy import.

Syntax Result foo import foo foo:bar,baz from foo import bar, baz foo:bar@baz from foo import bar as baz

Parameters
  • scope – the scope in which to place the import, typically globals()

  • args (strings) – module names to import