diplomat.utils.lazy_import.LazyImporter

class diplomat.utils.lazy_import.LazyImporter(name: str, pkg: ~typing.Optional[str] = None, import_function: ~typing.Callable[[str, ~typing.Optional[str]], module] = <function _silent_import>)[source]

Bases: object

Represents a Lazily Imported Object. It waits until the user requests functionality before actually importing a module.

__init__(name: str, pkg: ~typing.Optional[str] = None, import_function: ~typing.Callable[[str, ~typing.Optional[str]], module] = <function _silent_import>)[source]

Create a new lazily import module, object, or function.

Parameters:
  • name – The name or path of the package or module to import.

  • pkg – The relative path information needed for relative import. Defaults to None.

  • import_function – The function to use for importing modules. See ImportFunctions for a list of pre-provided importers.

Methods

__init__(name[, pkg, import_function])

Create a new lazily import module, object, or function.

Attributes

NOTHING