From a935bfe1734c57c8139c5aafc91f17d621be6f8b Mon Sep 17 00:00:00 2001 From: Danielle McLean Date: Mon, 9 Apr 2018 08:36:38 +1000 Subject: [PATCH] j2y: use a slightly smarter heuristic for disabling flow style in the output YAML --- local/bin/j2y | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/local/bin/j2y b/local/bin/j2y index f528e5c..561915b 100755 --- a/local/bin/j2y +++ b/local/bin/j2y @@ -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)