radloggerpy.common.dynamic_import module

radloggerpy.common.dynamic_import.CONF = <oslo_config.cfg.ConfigOpts object>

Collection of methods which detect and import modules for a directory

radloggerpy.common.dynamic_import.import_modules(modules, path, attribute=None, fetch_attribute=False)[source]

Import and return modules from a path if they have a given attribute

Parameters:
  • modules – Collection of modules to import or collection of tuples containing (module, attribute).

  • path – import path to get modules from

  • attribute – attribute to filter modules by or None if tuples are used

  • fetch_attribute – True to create module, attribute tuples, False to only return modules

Raises:
  • AttributeError – When attribute does not exist for a given module

  • ImportError – If path + module does not exist

Returns:

Collection of imported modules or collection of (module, attribute) tuples when fetch_attribute is True.

radloggerpy.common.dynamic_import.list_module_names(package_path, excludes=[])[source]

Gather a collection of modules from the specified path with excludes

Parameters:
  • package_path – Absolute path to ‘package’ directory.

  • excludes – Collection of strings excluded if found in package_path

Returns:

Collection of modules represented as strings.