diff options
author | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2017-10-01 19:06:21 +0900 |
---|---|---|
committer | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2017-10-01 19:17:13 +0900 |
commit | 2d664a9a47c55f5adb8f7d9694fc4198067411ea (patch) | |
tree | e05f1e6b5f06312f986a170b1f29d7502617c863 /buildstream/_yaml.py | |
parent | 717ef5e35deda4637d0b74a62a3718b83e5471b1 (diff) | |
download | buildstream-2d664a9a47c55f5adb8f7d9694fc4198067411ea.tar.gz |
_yaml.py: Fixing inconsistently named API _yaml.validate_node()
All of the _yaml APIs which deal with a node (dictionary loaded
from YAML) are named _yaml.node_foo(), _yaml.node_bar(), _yaml.node_baz()
etc, except for this one glaring exception.
Also added a missing internal API documenting comment for _yaml.node_validate()
Also updated all callers to _yaml.validate_node() to now call _yaml.node_validate().
Diffstat (limited to 'buildstream/_yaml.py')
-rw-r--r-- | buildstream/_yaml.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/buildstream/_yaml.py b/buildstream/_yaml.py index 9823f7ca3..0922bdbda 100644 --- a/buildstream/_yaml.py +++ b/buildstream/_yaml.py @@ -594,7 +594,21 @@ def node_sanitize(node): return node -def validate_node(node, valid_keys): +# node_validate() +# +# Validate the node so as to ensure the user has not specified +# any keys which are unrecognized by buildstream (usually this +# means a typo which would otherwise not trigger an error). +# +# Args: +# node (dict): A dictionary loaded from YAML +# valid_keys (list): A list of valid keys for the specified node +# +# Raises: +# LoadError: In the case that the specified node contained +# one or more invalid keys +# +def node_validate(node, valid_keys): # Probably the fastest way to do this: https://stackoverflow.com/a/23062482 valid_keys = set(valid_keys) |