Add support for meta hooks

This commit is contained in:
Paul Hooijenga 2017-10-22 16:40:19 +02:00
parent 39d5205e31
commit 88c676a7c1
6 changed files with 130 additions and 1 deletions

View file

@ -101,6 +101,9 @@ def _check_conditional(self, dct):
if isinstance(self.condition_value, Not):
op = 'is'
cond_val = self.condition_value.val
elif isinstance(self.condition_value, NotIn):
op = 'is any of'
cond_val = self.condition_value.values
else:
op = 'is not'
cond_val = self.condition_value
@ -206,6 +209,14 @@ class Not(object):
return other is not MISSING and other != self.val
class NotIn(object):
def __init__(self, values):
self.values = values
def __eq__(self, other):
return other is not MISSING and other not in self.values
def check_any(_):
pass