summaryrefslogtreecommitdiff
path: root/comments.py
diff options
context:
space:
mode:
authorAnthon van der Neut <anthon@mnt.org>2017-08-31 08:17:35 +0200
committerAnthon van der Neut <anthon@mnt.org>2017-08-31 08:17:35 +0200
commit9d09d17dd47a286ce89b741a98f16f936c836cba (patch)
treee19849c91a506c768db76c4a7f9ca3e76e910756 /comments.py
parent10d88a29cf50dc4679a3b079353cd593113d3e41 (diff)
downloadruamel.yaml-9d09d17dd47a286ce89b741a98f16f936c836cba.tar.gz
round-trip support for tagged scalars0.15.33
Inspired by Matthew Patton's question on StackOverflow: https://stackoverflow.com/a/45967047/1307905
Diffstat (limited to 'comments.py')
-rw-r--r--comments.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/comments.py b/comments.py
index d77b981..49fd9f4 100644
--- a/comments.py
+++ b/comments.py
@@ -943,6 +943,12 @@ class CommentedSet(MutableSet, CommentedMap):
return 'set({0!r})'.format(self.odict.keys())
+class TaggedScalar(CommentedBase):
+ # the value and style attributes are set during roundtrip construction
+ def __str__(self):
+ return self.value
+
+
def dump_comments(d, name='', sep='.', out=sys.stdout):
# type: (Any, str, str, Any) -> None
"""