multipackage.utilities.file_ops module¶
Helper utilities for file operations.
Summary¶
Functions:
atomic_json |
Atomically dump a dict as a json file. |
atomic_save |
Attempt to atomically save file by saving and then moving into position |
Reference¶
-
multipackage.utilities.file_ops.
atomic_save
(target_path, data, encoding='utf-8')[source]¶ Attempt to atomically save file by saving and then moving into position
The goal is to make it difficult for a crash to corrupt our data file since the move operation can be made atomic if needed on mission critical filesystems. This operation uses os.rename on non-Windows systems for atomic updates but normal saves on Windows since atomic semantics are not properly supported.
Parameters: