diff options
author | Anthon van der Neut <anthon@mnt.org> | 2017-08-13 12:25:39 +0200 |
---|---|---|
committer | Anthon van der Neut <anthon@mnt.org> | 2017-08-13 12:25:39 +0200 |
commit | 56a22f859d4fa1a0be6a6335fb7e9232ea9e9239 (patch) | |
tree | f6cf09417fc8b65877d9c3b04325190404d3bce3 /comments.py | |
parent | d27c1ffe8156ee462cd7f6b0e812c4f84d0b02d6 (diff) | |
download | ruamel.yaml-56a22f859d4fa1a0be6a6335fb7e9232ea9e9239.tar.gz |
fix lists within lists with comments
had to keep emit the comment and mark it for having been emitted, then reset on next run (as with maps)
Diffstat (limited to 'comments.py')
-rw-r--r-- | comments.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/comments.py b/comments.py index 8f69d0e..6cde817 100644 --- a/comments.py +++ b/comments.py @@ -951,10 +951,11 @@ def dump_comments(d, name='', sep='.', out=sys.stdout): print(name) print(d.ca, file=out) for k in d: - dump_comments(d[k], name=name + sep + k if name else k, sep=sep, out=out) + dump_comments(d[k], name=(name + sep + k) if name else k, sep=sep, out=out) elif isinstance(d, list): if name: print(name) print(d.ca, file=out) for idx, k in enumerate(d): - dump_comments(k, name=name + sep + str(idx) if name else k, sep=sep, out=out) + dump_comments(k, name=(name + sep + str(idx)) if name else str(idx), + sep=sep, out=out) |