Commit d8b93e5e authored by Laurent Bachelier's avatar Laurent Bachelier 🐧 Committed by ntome

config: No need to check if file exists

Rename will always erase it. This saves two filesystem operations.
parent 9280d6bf
......@@ -78,8 +78,6 @@ class YamlConfig(IConfig):
f = tempfile.NamedTemporaryFile(mode='w', dir=os.path.dirname(self.path), delete=False, encoding='utf-8')
with f:
yaml.dump(self.values, f, Dumper=WeboobDumper, default_flow_style=False)
if os.path.isfile(self.path):
os.remove(self.path)
os.rename(f.name, self.path)
def get(self, *args, **kwargs):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment