Skip to content

Commit

Permalink
simplify checks
Browse files Browse the repository at this point in the history
  • Loading branch information
Wout4 committed May 17, 2024
1 parent 534219f commit 652c799
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions cpmpy/expressions/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,18 +131,16 @@ def argval(a):
def is_leaf(a):
if hasattr(a, 'is_leaf'):
return a.is_leaf()
if is_any_list(a):
return all([is_leaf(x) for x in a])
else:
return True


def has_nested(expr):
if is_leaf(expr):
return False
if is_any_list(expr):
return not is_leaf(expr)
return not all([is_leaf(x) for x in expr.args])
if hasattr(expr, 'args'):
return not all([is_leaf(x) for x in expr.args])
return True


def eval_comparison(str_op, lhs, rhs):
Expand Down

0 comments on commit 652c799

Please sign in to comment.