importutils¶
Import related utilities and helper functions.
-
oslo_utils.importutils.import_class(import_str)¶ Returns a class from a string including module and class.
New in version 0.3.
-
oslo_utils.importutils.import_module(import_str)¶ Import a module.
New in version 0.3.
-
oslo_utils.importutils.import_object(import_str, *args, **kwargs)¶ Import a class and return an instance of it.
New in version 0.3.
-
oslo_utils.importutils.import_object_ns(name_space, import_str, *args, **kwargs)¶ Tries to import object from default namespace.
Imports a class and return an instance of it, first by trying to find the class in a default namespace, then failing back to a full path if not found in the default namespace.
New in version 0.3.
Changed in version 2.6: Don’t capture
ImportErrorwhen instanciating the object, only when importing the object class.
-
oslo_utils.importutils.import_versioned_module(version, submodule=None)¶ Import a versioned module.
New in version 0.3.
-
oslo_utils.importutils.try_import(import_str, default=None)¶ Try to import a module and if it fails return default.