mmagic.utils.setup_env
¶
Module Contents¶
Functions¶
|
Register all modules in mmagic into the registries. |
|
Try to import a module. |
- mmagic.utils.setup_env.register_all_modules(init_default_scope: bool = True) None [source]¶
Register all modules in mmagic into the registries.
- Parameters
init_default_scope (bool) – Whether initialize the mmagic default scope. When init_default_scope=True, the global default scope will be set to mmagic, and all registries will build modules from mmagic’s registry node. To understand more about the registry, please refer to https://mmengine.readthedocs.io/en/latest/advanced_tutorials/registry.html Defaults to True.
- mmagic.utils.setup_env.try_import(name: str) Optional[types.ModuleType] [source]¶
Try to import a module.
- Parameters
name (str) – Specifies what module to import in absolute or relative terms (e.g. either pkg.mod or ..mod).
- Returns
If importing successfully, returns the imported module, otherwise returns None.
- Return type
ModuleType or None