mlos_bench.dict_templater

Simple class to help with nested dictionary $var templating in configuration file expansions.

Classes

DictTemplater

Simple class to help with nested dictionary $var templating.

Module Contents

class mlos_bench.dict_templater.DictTemplater(source_dict: Dict[str, Any])[source]

Simple class to help with nested dictionary $var templating.

Initialize the templater.

Parameters:

source_dict (Dict[str, Any]) – The template dict to use for source variables.

expand_vars(*, extra_source_dict: Dict[str, Any] | None = None, use_os_env: bool = False) Dict[str, Any][source]

Expand the template variables in the destination dictionary.

Parameters:
  • extra_source_dict (Dict[str, Any]) – An optional extra source dictionary to use for expansion.

  • use_os_env (bool) – Whether to use the os environment variables a final fallback for expansion.

Returns:

The expanded dictionary.

Return type:

Dict[str, Any]

Raises:

ValueError – On unsupported nested types.