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
Classes
Adapter that reads and writes TOML configuration files. |
Module Contents
- class tud_lbm.config.adapter_toml.TomlAdapter[source]
Bases:
tud_lbm.config.adapter_base.ConfigAdapterAdapter 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
.tomlfile at path.Delegates the field → section bucketing to
build_sections()(shared by all adapters) and writes the result withtomli_w.- Parameters:
config – A validated
SimulationConfig.path – Destination file path.
- Raises:
OSError – If the file cannot be written.
ImportError – If tomli_w is not installed.