nvflare.fuel.utils.class_utils module

class ModuleScanner(base_pkgs: List[str], module_names: List[str], exclude_libs=True)[source]

Bases: object

Loads specified modules from base packages and then constructs a class to module name mapping.

Parameters:
  • base_pkgs – base packages to look for modules in

  • module_names – module names to load

  • exclude_libs – excludes modules containing .libs if True. Defaults to True.

get_module_name(class_name) str | None[source]

Gets the name of the module that contains this class.

Parameters:

class_name – The name of the class

Returns:

The module name if found.

get_class(class_path)[source]
get_component_init_parameters(component)[source]

To retrieve the initialize parameters of an object from the class constructor.

Parameters:

component – a class instance

Returns:

instantiate_class(class_path, init_params)[source]

Method for creating an instance for the class.

Parameters:
  • class_path – full path of the class

  • init_params – A dictionary that contains the name of the transform and constructor input

  • a (arguments. The transform name will be appended to medical.common.transforms to make) –

  • built. (full name of the transform to be) –