def __new__(cls, op, terms):
if isinstance(terms, list):
return object.__new__(cls, op, terms)
items = terms.items()
if len(items) == 1:
if isinstance(items[0][1], list):
return InOp("in", items[0])
else:
return EqOp("eq", items[0])
else:
acc = []
for lhs, rhs in items:
if rhs.json.startswith("["):
acc.append(InOp("in", [Variable(lhs), rhs]))
else:
acc.append(EqOp("eq", [Variable(lhs), rhs]))
return AndOp("and", acc)
评论列表
文章目录