parsing

Utility functions for parsing for using with Config-classes.

graphnet.utilities.config.parsing.traverse_and_apply(obj, fn, fn_kwargs)[source]

Apply fn to all elements in obj, resulting in same structure.

Return type:

Any

Parameters:
  • obj (Any)

  • fn (Callable)

  • fn_kwargs (Dict[str, Any] | None)

graphnet.utilities.config.parsing.list_all_submodules(*packages)[source]

List all submodules in packages recursively.

Return type:

List[ModuleType]

Parameters:

packages (ModuleType)

graphnet.utilities.config.parsing.get_all_grapnet_classes(*packages)[source]

List all grapnet classes in packages.

Return type:

Dict[str, type]

Parameters:

packages (ModuleType)

graphnet.utilities.config.parsing.is_graphnet_module(obj)[source]

Return whether obj is a module in graphnet.

Return type:

bool

Parameters:

obj (ModuleType)

graphnet.utilities.config.parsing.is_graphnet_class(obj)[source]

Return whether obj is a class in graphnet.

Return type:

bool

Parameters:

obj (type)

graphnet.utilities.config.parsing.get_graphnet_classes(module)[source]

Return a lookup of all graphnet class names in module.

Return type:

Dict[str, type]

Parameters:

module (ModuleType)