snakeoil.modules module

dynamic import functionality

exception snakeoil.modules.FailedImport(trg, e)[source]

Bases: ImportError

Raised when a requested target cannot be imported

snakeoil.modules.load_any(name)[source]

load an attribute or a module from a namespace

Parameters:

name – python dotted namespace path of the object to load from a module for example, snakeoil.modules.load_module would return load_module(), and snakeoil.modules would return modules

Raise:

FailedImport if importing fails, or the requested attribute cannot be found

Returns:

object resolved from name

snakeoil.modules.load_attribute(name)[source]

load an attribute from a module

Parameters:

name – python dotted namespace path of the attribute to load from a module for example, snakeoil.modules.load_module would return load_module()

Raise:

FailedImport if importing fails, or the requested attribute cannot be found

Returns:

attribute resolved from name

snakeoil.modules.load_module(name)[source]

load a module

Deprecated, use importlib.import_module instead.

Parameters:

name – python dotted namespace path of the module to import

Raise:

FailedImport if importing fails

Returns:

imported module