Skip to content
Snippets Groups Projects
Commit 2fad2444 authored by Tristan Van Berkom's avatar Tristan Van Berkom
Browse files

_yaml.py: Added node_items() convenience generator

parent 14cbb4b3
No related branches found
No related tags found
No related merge requests found
......@@ -385,6 +385,25 @@ def node_get(node, expected_type, key, indices=[], default_value=None):
return value
# node_items()
#
# A convenience generator for iterating over loaded key/value
# tuples in a dictionary loaded from project YAML.
#
# Args:
# node (dict): The dictionary node
#
# Yields:
# (str): The key name
# (anything): The value for the key
#
def node_items(node):
for key, value in node.items():
if key == PROVENANCE_KEY:
continue
yield (key, value)
# Gives a node a dummy provenance, in case of compositing dictionaries
# where the target is an empty {}
def ensure_provenance(node):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment