def save(self):
with NamedTemporaryFile(<EOL>dir=os.path.dirname(self.storage_path), delete=False<EOL>) as f:<EOL><INDENT>dump(self.data, f, protocol=<NUM_LIT:2>)<EOL>f.flush()<EOL>os.fsync(f.fileno())<EOL>tmppath = f.name<EOL><DEDENT>os.rename(tmppath, self.storage_path)<EOL>
Save our data to disk. We want to always have a valid file.