safe_dump#

casm.tools.shared.json_io.safe_dump(
data,
path: Path,
force: bool = False,
quiet: bool = False,
gz: bool = False,
)[source]#

Json dump with overwrite/skipping/write output messaging

Writes to the temporary file path + “.tmp”, then removes path and renames the temporary file, to avoid losing the original file without writing the new file. This method does not avoid race conditions.

If the temporary file already exists an exception is raised.