summaryrefslogtreecommitdiff
path: root/comments.py
diff options
context:
space:
mode:
authorAnthon van der Neut <anthon@mnt.org>2017-08-13 13:16:06 +0200
committerAnthon van der Neut <anthon@mnt.org>2017-08-13 13:16:06 +0200
commita29127076c536d0009b2556a4a2081e8cad83032 (patch)
tree7c97a6ca1f75bfd76c66ed4dd0475672a93d3198 /comments.py
parent56a22f859d4fa1a0be6a6335fb7e9232ea9e9239 (diff)
downloadruamel.yaml-a29127076c536d0009b2556a4a2081e8cad83032.tar.gz
fix issue #62: not allowing : or ? in flow style plain scalar0.15.27
also fix list withing list comment dropping, as it happened to occur in the example
Diffstat (limited to 'comments.py')
-rw-r--r--comments.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/comments.py b/comments.py
index 6cde817..9c65cf2 100644
--- a/comments.py
+++ b/comments.py
@@ -942,6 +942,7 @@ class CommentedSet(MutableSet, CommentedMap):
def dump_comments(d, name='', sep='.', out=sys.stdout):
+ # type: (Any, str, str, Any) -> None
"""
recurisively dump domments all but the toplevel preceded by the path
in dotted form x.0.a
@@ -949,13 +950,13 @@ def dump_comments(d, name='', sep='.', out=sys.stdout):
if isinstance(d, dict):
if name:
print(name)
- print(d.ca, file=out)
+ print(d.ca, file=out) # type: ignore
for k in d:
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)
+ print(d.ca, file=out) # type: ignore
for idx, k in enumerate(d):
dump_comments(k, name=(name + sep + str(idx)) if name else str(idx),
sep=sep, out=out)