(t)
Turn a Compound into a SymPy object
Turn a Compound into a SymPy object
Turn a Compound into a SymPy object
def construct(t):
    """ Turn a Compound into a SymPy object """
    if isinstance(t, (Variable, CondVariable)):
        return t.arg
    if not isinstance(t, Compound):
        return t
    if any(issubclass(t.op, cls) for cls in eval_false_legal):
        return t.op(*map(construct, t.args), evaluate=False)
    elif any(issubclass(t.op, cls) for cls in basic_new_legal):
        return Basic.__new__(t.op, *map(construct, t.args))
    else:
        return t.op(*map(construct, t.args))
def construct ( t ) : if isinstance ( t , ( Variable , CondVariable ) ) : return t . arg if not isinstance ( t , Compound ) : return t if any ( issubclass ( t . op , cls ) for cls in eval_false_legal ) : return t . op ( * map ( construct , t . args ) , evaluate = False ) elif any ( issubclass ( t . op , cls ) for cls in basic_new_legal ) : return Basic . __new__ ( t . op , * map ( construct , t . args ) ) else : return t . op ( * map ( construct , t . args ) )