# to use, copy, modify, and distribute this software is granted under
# terms provided in the LICENSE file distributed with this software.
-import codecs
import os
import re
import stat
os.rename(self.filename, self.filename + ".0")
# our data file
- file_descriptor = codecs.open(self.filename, "w", "utf-8")
+ file_descriptor = open(self.filename, "w")
# if it's marked private, chmod it appropriately
if self.filename in self.universe.private_files and oct(
) != 0o0600:
os.chmod(self.filename, 0o0600)
- # write, flush and close the file
- file_descriptor.write(yaml.dump(self.data))
- file_descriptor.flush()
+ # write and close the file
+ yaml.dump(self.data, allow_unicode=True, default_flow_style=False,
+ stream=file_descriptor)
file_descriptor.close()
# unset the modified flag