summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Silverstone <daniel.silverstone@codethink.co.uk>2019-04-04 13:51:49 +0100
committerDaniel Silverstone <daniel.silverstone@codethink.co.uk>2019-04-04 14:51:39 +0100
commita53278ac0b770619dbb3fea3bfcc6800eb684606 (patch)
tree15b748db7bf10852aef0bd195ed36110e52f953e
parenta3fe0a4c5d7d52d456707f675974bbf4ecc62626 (diff)
downloadbuildstream-a53278ac0b770619dbb3fea3bfcc6800eb684606.tar.gz
_yaml.py: Node.__contains__: Support this now
Now that we've had the fallout settle, support `key in somenode` again. Signed-off-by: Daniel Silverstone <daniel.silverstone@codethink.co.uk>
-rw-r--r--buildstream/_yaml.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/buildstream/_yaml.py b/buildstream/_yaml.py
index 15ae5752f..a873cd62c 100644
--- a/buildstream/_yaml.py
+++ b/buildstream/_yaml.py
@@ -63,8 +63,10 @@ from ._exceptions import LoadError, LoadErrorReason
#
class Node(namedtuple('Node', ['value', 'file_index', 'line', 'column'])):
def __contains__(self, what):
- assert False, \
- "BUG: Attempt to do `{} in {}` test".format(what, self)
+ # Delegate to the inner value, though this will likely not work
+ # very well if the node is a list or string, it's unlikely that
+ # code which has access to such nodes would do this.
+ return what in self[0]
# File name handling