toml_formatter module

Define several helper functions for proper TOML formatting.

format_for_toml(key, value, preferred_type)[source]

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

Parameters:
Return type:

str

_concat_dict(value)[source]

Adapt Python dict to toml inline table.

Parameters:

value (dict[str, Any])

Return type:

str

_format_list(value, preferred_type)[source]

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

Parameters:
Return type:

str

_format_value(key, value, preferred_type)[source]

Format the value so that it matches toml standard.

Parameters:
Return type:

str

_str_toml(key, value)[source]

Surround value with quotation marks.

Parameters:
Return type:

str

_bool_toml(key, value)[source]

Return ‘true’ or ‘false’.

Parameters:
Return type:

str