diff options
author | Anthon van der Neut <anthon@mnt.org> | 2018-08-16 09:49:03 +0200 |
---|---|---|
committer | Anthon van der Neut <anthon@mnt.org> | 2018-08-16 09:49:03 +0200 |
commit | 81fdb659f35a533c29fc163ac679d0c6068385d9 (patch) | |
tree | 20a5e6c809cd8931483e6065da34a5c8db0fd8ac /emitter.py | |
parent | 97ffa8425050d219b42a35e198302f8451f6e303 (diff) | |
download | ruamel.yaml-81fdb659f35a533c29fc163ac679d0c6068385d9.tar.gz |
allow simple mappings as mapping keys
Diffstat (limited to 'emitter.py')
-rw-r--r-- | emitter.py | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -621,7 +621,9 @@ class Emitter(object): self.write_pre_comment(self.event) self.write_indent() if self.check_simple_key(): - if not isinstance(self.event, SequenceStartEvent): # sequence keys + if not isinstance( + self.event, (SequenceStartEvent, MappingStartEvent) + ): # sequence keys if self.event.style == '?': self.write_indicator(u'?', True, indention=True) self.states.append(self.expect_block_mapping_simple_value) @@ -703,6 +705,7 @@ class Emitter(object): return length < self.MAX_SIMPLE_KEY_LENGTH and ( isinstance(self.event, AliasEvent) or (isinstance(self.event, SequenceStartEvent) and self.event.flow_style is True) + or (isinstance(self.event, MappingStartEvent) and self.event.flow_style is True) or ( isinstance(self.event, ScalarEvent) and not self.analysis.empty |