gws.lib.inifile

Tools to deal with ini config files.

Source code: gws.lib.inifile

Package Contents

gws.lib.inifile.from_paths(*paths: str) dict

Merges the key-value pairs of .ini files into a dictionary.

Parameters:

paths – Paths to .ini files.

Returns:

Nested dictionary with sections as keys and options as sub-keys.

gws.lib.inifile.from_paths_flat(*paths: str) dict

Merges the key-value pairs of .ini files into a flat dictionary.

Parameters:

paths – Paths to .ini files.

Returns:

Flat dictionary with the section names as prefixes.

gws.lib.inifile.to_string(d: dict) str

Converts key-value pairs in a dictionary to a string grouped in sections.

Parameters:

d – Key-value pairs.

Returns:

String formatted like .ini files.