Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __and__(self, x):
# Combine results
if isinstance(self, AndFilter):
self.subtree['must'].append(x.subtree)
return self
elif isinstance(x, AndFilter):
x.subtree['must'].append(self.subtree)
return x
return AndFilter(self, x)
def __and__(self, x):
# Combine results
if isinstance(self, AndFilter):
self.subtree['must'].append(x.subtree)
return self
elif isinstance(x, AndFilter):
x.subtree['must'].append(self.subtree)
return x
return AndFilter(self, x)
def __and__(self, x):
# Combine results
if isinstance(self, AndFilter):
self.subtree['must'].append(x.subtree)
return self
elif isinstance(x, AndFilter):
x.subtree['must'].append(self.subtree)
return x
return AndFilter(self, x)
def __init__(self, *args):
[isinstance(x, BooleanFilter) for x in args]
super(AndFilter, self).__init__()
self._filter = {'bool': {'must': [x.build() for x in args]}}