summaryrefslogtreecommitdiff
path: root/constructor.py
diff options
context:
space:
mode:
authorAnthon van der Neut <anthon@mnt.org>2020-01-30 10:59:27 +0100
committerAnthon van der Neut <anthon@mnt.org>2020-01-30 10:59:27 +0100
commit10c6a6b07ee92ee797460fbe8207abe0669e25bf (patch)
tree7e0c6e2bb95065c90b5a02d042e4c128ae82f158 /constructor.py
parent1d7c8bd627dff124687111dc2125e9f1588f2f49 (diff)
downloadruamel.yaml-10c6a6b07ee92ee797460fbe8207abe0669e25bf.tar.gz
fix issue with mypy, dumping lit scalar in sequence0.16.7
Diffstat (limited to 'constructor.py')
-rw-r--r--constructor.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/constructor.py b/constructor.py
index 2280d4f..ddd2915 100644
--- a/constructor.py
+++ b/constructor.py
@@ -1311,9 +1311,10 @@ class RoundTripConstructor(SafeConstructor):
if not templated_id(node.anchor):
seqtyp.yaml_set_anchor(node.anchor)
for idx, child in enumerate(node.value):
- ret_val.append(self.construct_object(child, deep=deep))
if child.comment:
seqtyp._yaml_add_comment(child.comment, key=idx)
+ child.comment = None # if moved to sequence remove from child
+ ret_val.append(self.construct_object(child, deep=deep))
seqtyp._yaml_set_idx_line_col(
idx, [child.start_mark.line, child.start_mark.column]
)
@@ -1467,7 +1468,6 @@ class RoundTripConstructor(SafeConstructor):
)
value = self.construct_object(value_node, deep=deep)
if self.check_mapping_key(node, key_node, maptyp, key, value):
-
if key_node.comment and len(key_node.comment) > 4 and key_node.comment[4]:
if last_value is None:
key_node.comment[0] = key_node.comment.pop(4)