tud_lbm.config.adapter_base

Base class for configuration file adapters.

Classes

ConfigAdapter

Converts a config file into a SimulationConfig and back.

Functions

get_adapter(→ ConfigAdapter)

Return the appropriate adapter for path based on file extension.

Module Contents

class tud_lbm.config.adapter_base.ConfigAdapter[source]

Bases: abc.ABC

Converts a config file into a SimulationConfig and back.

abstractmethod load_raw(path: str) dict[str, Any][source]

Parse path and return raw configuration dict.

Unlike load(), this returns the raw config dict without instantiating SimulationConfig. Useful for detecting array fields before expansion.

Parameters:

path – Filesystem path to a configuration file.

Returns:

Raw config dictionary.

abstractmethod load(path: str) tud_lbm.config.simulation_config.SimulationConfig[source]

Parse path and return a SimulationConfig.

Parameters:

path – Filesystem path to a configuration file.

Returns:

A validated SimulationConfig.

abstractmethod save(config: tud_lbm.config.simulation_config.SimulationConfig, path: str) None[source]

Save a SimulationConfig to path.

Parameters:
  • config – Configuration to save.

  • path – Filesystem path where to save the configuration.

classmethod build_sections(config: tud_lbm.config.simulation_config.SimulationConfig) dict[str, Any][source]

Build a format-agnostic nested dict from config, routed by CONFIG_SECTION metadata.

tud_lbm.config.adapter_base.get_adapter(path: str) ConfigAdapter[source]

Return the appropriate adapter for path based on file extension.