core.transformer.spec_utils#

Module Contents#

Classes#

ModuleSpec

This is a Module Specification dataclass.

Functions#

import_module

Import a named object from a module in the context of this function.

get_module

build_module

API#

class core.transformer.spec_utils.ModuleSpec#

This is a Module Specification dataclass.

Specification defines the location of the module (to import dynamically) or the imported module itself. It also defines the params that need to be passed to initialize the module.

Parameters:
  • module (Union[Tuple, type]) – A tuple describing the location of the module class e.g. (module.location, ModuleClass) or the imported module class itself e.g. ModuleClass (which is already imported using from module.location import ModuleClass).

  • params (dict) – A dictionary of params that need to be passed while init.

module: Union[Tuple, type]#

None

params: dict#

‘field(…)’

submodules: type#

None

core.transformer.spec_utils.import_module(module_path: Tuple[str])#

Import a named object from a module in the context of this function.

TODO: make this importer module more robust, at least make sure there are no side effects of using this as is

core.transformer.spec_utils.get_module(
spec_or_module: Union[core.transformer.spec_utils.ModuleSpec, type],
**additional_kwargs,
)#
core.transformer.spec_utils.build_module(
spec_or_module: Union[core.transformer.spec_utils.ModuleSpec, type],
*args,
**kwargs,
)#