do not let yamlutils emit alias references
We want the canonical data files to have repeated information to make it easy for human readers to understand the content, so do not emit aliases to blocks of repeated data. Change-Id: Ib6bf3f3683fae2edb94910bea86971e591b5b87c Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
@ -38,14 +38,16 @@ class PrettySafeDumper(yaml.dumper.SafeDumper):
|
||||
values = []
|
||||
node = yaml.nodes.MappingNode(
|
||||
'tag:yaml.org,2002:map', values, flow_style=None)
|
||||
if self.alias_key is not None:
|
||||
self.represented_objects[self.alias_key] = node
|
||||
for key, value in data.items():
|
||||
key_item = self.represent_data(key)
|
||||
value_item = self.represent_data(value)
|
||||
values.append((key_item, value_item))
|
||||
return node
|
||||
|
||||
def ignore_aliases(self, data):
|
||||
# Never output alias references; always repeat the data.
|
||||
return True
|
||||
|
||||
def represent_bool(self, data):
|
||||
if data:
|
||||
value = 'yes'
|
||||
|
Reference in New Issue
Block a user