keep order of keys

This commit is contained in:
Martin Diehl 2020-10-26 21:43:21 +01:00
parent 5834d95012
commit 4159ae5f3d
1 changed files with 3 additions and 1 deletions

View File

@ -17,7 +17,7 @@ class NiceDumper(yaml.SafeDumper):
return super().increase_indent(flow, False)
def represent_data(self, data):
"""Cast Config objects and its qsubclasses to dict."""
"""Cast Config objects and its subclasses to dict."""
return self.represent_data(dict(data)) if isinstance(data, dict) and type(data) != dict else \
super().represent_data(data)
@ -70,6 +70,8 @@ class Config(dict):
kwargs['width'] = 256
if 'default_flow_style' not in kwargs:
kwargs['default_flow_style'] = None
if 'sort_keys' not in kwargs:
kwargs['sort_keys'] = False
def array_representer(dumper, data):
"""Convert numpy array to list of native types."""