summaryrefslogtreecommitdiff
path: root/representer.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 /representer.py
parent22ebda34b13607bd4516c36820552d5daa43df70 (diff)
downloadruamel.yaml-34d02af74473c82e25c9e152a24ffeea862454f0.tar.gz
allow round trip of tagged sequences
Diffstat (limited to 'representer.py')
-rw-r--r--representer.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/representer.py b/representer.py
index 3088139..6bd5651 100644
--- a/representer.py
+++ b/representer.py
@@ -1103,6 +1103,21 @@ class RoundTripRepresenter(SafeRepresenter):
tag = u'tag:yaml.org,2002:map'
return self.represent_mapping(tag, data)
+ def represent_list(self, data):
+ # type: (Any) -> Any
+ try:
+ t = data.tag.value
+ except AttributeError:
+ t = None
+ if t:
+ if t.startswith('!!'):
+ tag = 'tag:yaml.org,2002:' + t[2:]
+ else:
+ tag = t
+ else:
+ tag = u'tag:yaml.org,2002:seq'
+ return self.represent_sequence(tag, data)
+
def represent_datetime(self, data):
# type: (Any) -> Any
inter = 'T' if data._yaml['t'] else ' '