j2y: use a slightly smarter heuristic for disabling flow style in the output YAML
This commit is contained in:
parent
6ee96690b6
commit
a935bfe173
1 changed files with 1 additions and 1 deletions
|
@ -11,7 +11,7 @@ def dict_representer(dumper, d):
|
|||
node = dumper.represent_dict(d)
|
||||
# Don't use YAML flow style for large dicts, because the flow style output
|
||||
# only really looks good with a very small number of keys.
|
||||
if node.flow_style and len(d) > 5:
|
||||
if len(d) > 5 or sum(len(v) for v in d.values()) > 30:
|
||||
node.flow_style = False
|
||||
return node
|
||||
Dumper.add_representer(dict, dict_representer)
|
||||
|
|
Loading…
Reference in a new issue