summaryrefslogtreecommitdiff
path: root/src/buildstream/_options
diff options
context:
space:
mode:
authorBenjamin Schubert <contact@benschubert.me>2019-06-25 21:14:40 +0100
committerbst-marge-bot <marge-bot@buildstream.build>2019-07-15 14:14:03 +0000
commit1aa0fb1fefa7e86586831a13200a92f6dd9bd3b4 (patch)
tree8e675fc215ab9f1fcf8851470c95c0e2039f42ee /src/buildstream/_options
parent42d3d8406a15cd5f6f4a7d00e298dba019a50ed6 (diff)
downloadbuildstream-1aa0fb1fefa7e86586831a13200a92f6dd9bd3b4.tar.gz
_yaml: Remove 'node_items' and add 'MappingNode.items()'
One difference is that 'MappingNode.items()' does not strip the provenance from scalars and lists, which ends up not affecting the code much.
Diffstat (limited to 'src/buildstream/_options')
-rw-r--r--src/buildstream/_options/optionpool.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/buildstream/_options/optionpool.py b/src/buildstream/_options/optionpool.py
index af0f99b97..96cff898d 100644
--- a/src/buildstream/_options/optionpool.py
+++ b/src/buildstream/_options/optionpool.py
@@ -65,7 +65,7 @@ class OptionPool():
#
def load(self, options):
- for option_name, option_definition in _yaml.node_items(options):
+ for option_name, option_definition in options.items():
# Assert that the option name is a valid symbol
p = _yaml.node_get_provenance(options, option_name)
@@ -272,7 +272,7 @@ class OptionPool():
del node['(?)']
for condition, p in zip(conditions, provenance):
- tuples = list(_yaml.node_items(condition))
+ tuples = list(condition.items())
if len(tuples) > 1:
raise LoadError(LoadErrorReason.INVALID_DATA,
"{}: Conditional statement has more than one key".format(p))
@@ -284,7 +284,7 @@ class OptionPool():
# Prepend the provenance of the error
raise LoadError(e.reason, "{}: {}".format(p, e)) from e
- if not _yaml.is_node(value):
+ if type(value) is not _yaml.MappingNode: # pylint: disable=unidiomatic-typecheck
raise LoadError(LoadErrorReason.ILLEGAL_COMPOSITE,
"{}: Only values of type 'dict' can be composed.".format(p))