summaryrefslogtreecommitdiff
path: root/constructor.py
diff options
context:
space:
mode:
authorAnthon van der Neut <anthon@mnt.org>2018-08-30 06:47:53 +0200
committerAnthon van der Neut <anthon@mnt.org>2018-08-30 06:47:53 +0200
commit34d02af74473c82e25c9e152a24ffeea862454f0 (patch)
treeb27b185d183890b5ad278ee0ebdc3f6a162d7a3d /constructor.py
parent22ebda34b13607bd4516c36820552d5daa43df70 (diff)
downloadruamel.yaml-34d02af74473c82e25c9e152a24ffeea862454f0.tar.gz
allow round trip of tagged sequences
Diffstat (limited to 'constructor.py')
-rw-r--r--constructor.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/constructor.py b/constructor.py
index 008018a..26a4dd1 100644
--- a/constructor.py
+++ b/constructor.py
@@ -1561,6 +1561,17 @@ class RoundTripConstructor(SafeConstructor):
data2.yaml_set_tag(node.tag)
yield data2
return
+ elif isinstance(node, SequenceNode):
+ data = CommentedSeq()
+ data._yaml_set_line_col(node.start_mark.line, node.start_mark.column)
+ if node.flow_style is True:
+ data.fa.set_flow_style()
+ elif node.flow_style is False:
+ data.fa.set_block_style()
+ data.yaml_set_tag(node.tag)
+ yield data
+ data.extend(self.construct_sequence(node))
+ return
except: # NOQA
pass
raise ConstructorError(