68 """Atomically replaces the output with the resolved JSON if changed."""
69 new_output_path = output_path +
'.new'
71 with open(new_output_path,
'w', encoding=
'ascii')
as new_output:
72 json.dump(resolved, new_output)
74 if (os.path.exists(output_path)
and
75 filecmp.cmp(new_output_path, output_path, shallow=
False)):
78 os.replace(new_output_path, output_path)
79 new_output_path =
None
82 os.remove(new_output_path)