summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Silverstone <daniel.silverstone@codethink.co.uk>2019-04-04 13:54:12 +0100
committerDaniel Silverstone <daniel.silverstone@codethink.co.uk>2019-04-04 14:51:39 +0100
commit9cb7b88e0f3e4fbbbaf03bbadab3aac0febefd28 (patch)
treef1757af166f77d7fd7b56ff6b98366e08b3b4b3f
parenta53278ac0b770619dbb3fea3bfcc6800eb684606 (diff)
downloadbuildstream-9cb7b88e0f3e4fbbbaf03bbadab3aac0febefd28.tar.gz
Plugin: Remove node_has_member()
Now that we permit `key in somenode` again, remove the unnecessary extra API of Plugin.node_has_member() Signed-off-by: Daniel Silverstone <daniel.silverstone@codethink.co.uk>
-rw-r--r--buildstream/_gitsourcebase.py2
-rw-r--r--buildstream/plugin.py21
-rw-r--r--buildstream/plugins/elements/filter.py4
-rw-r--r--tests/frontend/project/sources/fetch_source.py2
4 files changed, 4 insertions, 25 deletions
diff --git a/buildstream/_gitsourcebase.py b/buildstream/_gitsourcebase.py
index 5777d4aed..7d07c56cb 100644
--- a/buildstream/_gitsourcebase.py
+++ b/buildstream/_gitsourcebase.py
@@ -423,7 +423,7 @@ class _GitSourceBase(Source):
self.mark_download_url(url, primary=False)
self.submodule_overrides[path] = url
- if self.node_has_member(submodule, 'checkout'):
+ if 'checkout' in submodule:
checkout = self.node_get_member(submodule, bool, 'checkout')
self.submodule_checkout_overrides[path] = checkout
diff --git a/buildstream/plugin.py b/buildstream/plugin.py
index 19d82769b..5fdcdaeb8 100644
--- a/buildstream/plugin.py
+++ b/buildstream/plugin.py
@@ -433,27 +433,6 @@ class Plugin():
"""
_yaml.node_set(node, key, value)
- def node_has_member(self, node, key):
- """Essentially the `key in node` test
- Args:
- node (node): A dictionary loaded from YAML
- key (str): The key name
-
- Returns:
- bool: Whether or not key is in node
-
- Raises:
- None
-
- **Example:**
-
- .. code:: python
-
- # To see if `name` is set in `node
- present = self.node_has_member(node, 'name')
- """
- return _yaml.node_contains(node, key)
-
def new_empty_node(self):
"""Create an empty 'Node' object to be handled by BuildStream's core
Args:
diff --git a/buildstream/plugins/elements/filter.py b/buildstream/plugins/elements/filter.py
index cbb4fe7af..940e820a0 100644
--- a/buildstream/plugins/elements/filter.py
+++ b/buildstream/plugins/elements/filter.py
@@ -220,11 +220,11 @@ class FilterElement(Element):
split_rules = self.node_get_member(pub_data, dict, 'split-rules', {})
unfound_includes = []
for domain in self.include:
- if not self.node_has_member(split_rules, domain):
+ if domain not in split_rules:
unfound_includes.append(domain)
unfound_excludes = []
for domain in self.exclude:
- if not self.node_has_member(split_rules, domain):
+ if domain not in split_rules:
unfound_excludes.append(domain)
detail = []
diff --git a/tests/frontend/project/sources/fetch_source.py b/tests/frontend/project/sources/fetch_source.py
index 6bcaca028..f17c14029 100644
--- a/tests/frontend/project/sources/fetch_source.py
+++ b/tests/frontend/project/sources/fetch_source.py
@@ -41,7 +41,7 @@ class FetchSource(Source):
self.original_urls = self.node_get_member(node, list, 'urls')
self.output_file = self.node_get_member(node, str, 'output-text')
self.fetch_succeeds = {}
- if self.node_has_member(node, 'fetch-succeeds'):
+ if 'fetch-succeeds' in node:
fetch_succeeds_node = self.node_get_member(node, dict, 'fetch-succeeds')
for key, value in self.node_items(fetch_succeeds_node):
self.fetch_succeeds[key] = value in ('True', 'true')