This commit is contained in:
mwiegand 2021-07-13 19:38:54 +02:00
parent 2eb23a5827
commit da11f49cfb
2 changed files with 5 additions and 3 deletions

View file

@ -1,7 +1,9 @@
import json
class hdict(dict): class hdict(dict):
def __hash__(self): def __hash__(self):
return hash(tuple(sorted(self.items()))) return hash(json.dumps(self, sorted=True))
class hlist(list): class hlist(list):
def __hash__(self): def __hash__(self):
return hash(tuple(sorted(self))) return hash(json.dumps(self, sorted=True))

View file

@ -7,7 +7,7 @@ template = '''
# ${segment.split('#', 2)[1]} # ${segment.split('#', 2)[1]}
% endif % endif
[${segment.split('#')[0]}] [${segment.split('#')[0]}]
% for option, value in options.items(): % for option, value in sorted(options.items()):
% if isinstance(value, dict): % if isinstance(value, dict):
% for k, v in value.items(): % for k, v in value.items():
${option}=${k}=${v} ${option}=${k}=${v}