coscon.io_helper module¶
- coscon.io_helper.dumper(data: dict, path: Path | str, overwrite: bool = False, compress: bool = None)[source]¶
Write dict to a TOML/YAML/JSON file.
Dump data to a TOML/YAML/JSON format file, optionally compressing the contents with gzip and optionally overwriting the file.
- Parameters:
data (dict) – The dictionary to be written.
path (str) – The file to write. Valid extensions are .toml, .json, .yaml with optional extension .gz.
overwrite (bool) – If True, overwrite the file if it exists. If False, then existing files will cause an exception.
compress (bool) – If True, compress the data with gzip on write. If None, dispatch by its extension.
- Returns:
None