[tool] setup-election-config: fix indent
Using a custom yaml dumper class to ensure that timeline elements are indented Change-Id: I73c69c8d0432db949470ff1cb360fc2d11839e7b
This commit is contained in:
parent
a978b3f9ca
commit
92fd115019
@ -42,6 +42,11 @@ election_parameters = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class IndentDumper(yaml.Dumper):
|
||||||
|
def increase_indent(self, flow=False, indentless=False):
|
||||||
|
return super().increase_indent(flow, False)
|
||||||
|
|
||||||
|
|
||||||
def _dict_representer(dumper, data):
|
def _dict_representer(dumper, data):
|
||||||
return dumper.represent_dict(data.items())
|
return dumper.represent_dict(data.items())
|
||||||
|
|
||||||
@ -280,8 +285,9 @@ def main():
|
|||||||
timeline=events,
|
timeline=events,
|
||||||
)
|
)
|
||||||
yaml.Dumper.add_representer(OrderedDict, _dict_representer)
|
yaml.Dumper.add_representer(OrderedDict, _dict_representer)
|
||||||
print(yaml.dump(configuration, default_flow_style=False,
|
print(yaml.dump(configuration, Dumper=IndentDumper,
|
||||||
default_style='', explicit_start=True))
|
default_flow_style=False, default_style='',
|
||||||
|
explicit_start=True))
|
||||||
|
|
||||||
return 0 if timeframe_span_ok else 1
|
return 0 if timeframe_span_ok else 1
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user