toml_formatter module

Define several helper functions for proper .toml formatting.

format_for_toml(key: str, value: Any, preferred_type: type) str

Format the key-value pair so that it matches toml standard.

_concat_dict(value: dict[str, Any]) str

Adapt Python dict to toml inline table.

_format_list(value: list | ndarray, preferred_type: type) str

Format a list of values, including handling lists of dicts.

_format_value(key: str, value: Any, preferred_type: type) str

Format the value so that it matches toml standard.

_str_toml(key: str, value: Any) str

Surround value with quotation marks.

_bool_toml(key: str, value: Any) str

Return ‘true’ or ‘false’.