diff options
author | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2017-10-01 20:26:50 +0900 |
---|---|---|
committer | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2017-10-01 20:26:50 +0900 |
commit | cced3006a39fd8be6e4fa926e68666c672db3d6d (patch) | |
tree | 921dfa1ee686d25de288054bdcfa44c70ec0bcff /buildstream/_yaml.py | |
parent | 2d664a9a47c55f5adb8f7d9694fc4198067411ea (diff) | |
download | buildstream-cced3006a39fd8be6e4fa926e68666c672db3d6d.tar.gz |
Use _yaml.node_items() across the board, instead of casing _yaml.PROVENANCE_KEY
Consequently improved _yaml.node_sanitize() to omit a crazy lambda
which had no effect at all on the outcome of the function.
Diffstat (limited to 'buildstream/_yaml.py')
-rw-r--r-- | buildstream/_yaml.py | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/buildstream/_yaml.py b/buildstream/_yaml.py index 0922bdbda..c408117b4 100644 --- a/buildstream/_yaml.py +++ b/buildstream/_yaml.py @@ -269,10 +269,7 @@ def node_decorate_dict(filename, target, source, toplevel): provenance = DictProvenance(filename, source, toplevel) target[PROVENANCE_KEY] = provenance - for key, value in source.items(): - if key == PROVENANCE_KEY: - continue - + for key, value in node_items(source): member = MemberProvenance(filename, source, key, toplevel) provenance.members[key] = member @@ -459,11 +456,7 @@ def composite_dict(target, source, policy=CompositePolicy.OVERWRITE, typesafe=Fa target_provenance = ensure_provenance(target) source_provenance = ensure_provenance(source) - for key, source_value in source.items(): - - # Handle the provenance keys specially - if key == PROVENANCE_KEY: - continue + for key, source_value in node_items(source): # Track the full path of keys, only for raising CompositeError if path: @@ -581,9 +574,8 @@ def node_sanitize(node): result = SanitizedDict() - for key in sorted(node, key=lambda s: (s == PROVENANCE_KEY, s)): - if key == PROVENANCE_KEY: - continue + key_list = [key for key, _ in node_items(node)] + for key in sorted(key_list): result[key] = node_sanitize(node[key]) return result |