tud_lbm.config.adapter_toml

TOML configuration file adapter.

Reads and writes .toml config files.

Requires Python ≥ 3.11 (tomllib in stdlib) or the tomli back-port on Python 3.10:

pip install tomli

Example usage:

from config.adapter_toml import TomlAdapter

adapter = TomlAdapter()
config = adapter.load("example_for_test/config_simple.toml")
adapter.save(config, "output/config.toml")

Attributes

tomli_w

Classes

TomlAdapter

Adapter that reads and writes TOML configuration files.

Module Contents

tud_lbm.config.adapter_toml.tomli_w: Any = None[source]
class tud_lbm.config.adapter_toml.TomlAdapter[source]

Bases: tud_lbm.config.adapter_base.ConfigAdapter

Adapter that reads and writes TOML configuration files.

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

Parse the TOML file at source and return a flat config dict.

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

Serialise config to a .toml file at path.

Delegates the field → section bucketing to build_sections() (shared by all adapters) and writes the result with tomli_w.

Parameters:
  • config – A validated SimulationConfig.

  • path – Destination file path.

Raises: