Merge pull request #40 from SemjonKerner/sort_config_dict

Sort json config file (0.4.5)
This commit is contained in:
Semjon Kerner 2021-03-25 12:55:23 +01:00 committed by GitHub
commit 0924467487
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -60,10 +60,17 @@ class Config:
pass pass
def _sort_dict(self):
tmpdict = dict()
for key in sorted(self.config_dict.keys()):
tmpdict[key] = self.config_dict[key]
self.config_dict = tmpdict
def save_config(self): def save_config(self):
""" """
save the cache to the file save the cache to the file
""" """
self._sort_dict()
with open(filename(), 'w') as f: with open(filename(), 'w') as f:
f.write(json.dumps(self.config_dict)) f.write(json.dumps(self.config_dict))