Simplify the Expr.
164618
def simplify(self):
        """"""
        d = defaultdict(float)
        for term in self.terms:
            term = term.simplify()
            d[term.ops] += term.coeff
        return Expr.from_terms_iter(
            Term.from_ops_iter(k, d[k]) for k in sorted(d, key=repr) if d[k])
781962
def _create_exprs_using_func(self, f, columns):
        """"""
        expressions = map(lambda c: f(c).alias(c),
                          self._columns)
        return expressions
1275276
def p_expr_plus_expr(p):
    
    p[0] = make_binary(p.lineno(2), 'PLUS', p[1], p[3], lambda x, y: x + y)
15357
def solve_tuple(expr, vars):
    """"""
    result = tuple(solve(x, vars).value for x in expr.children)
    return Result(result, ())
369944
def Or(*xs, simplify=True):
    
    xs = [Expression.box(x).node for x in xs]
    y = exprnode.or_(*xs)
    if simplify:
        y = y.simplify()
    return _expr(y)
978767
public void simplify()
  {
    // remove all addresses from the cc and bcc that are in the to address set.
    ccSet.removeAll(toSet);
    bccSet.removeAll(toSet);

    // remove all address from the bcc set that are in the cc set.
    bccSet.removeAll(ccSet);
  }
198918
def concat_expr(operator, conditions):
    
    expr = " {0} ".format(operator).join(conditions)
    return ["({0})".format(expr)] if expr else []
573628
def p_exprlt(p):
    
    a = int(p[1]) if p[1].isdigit() else 0
    b = int(p[3]) if p[3].isdigit() else 0

    p[0] = '1' if a < b else '0'
964384
def p_expr_list(self, p):
        ''''''
        if len(p) == 4:
            p[1].append(p[3])
            p[0] = p[1]
        elif len(p) == 2:
            p[0] = [p[1]]
296831
def parse_expr(tokens, options):
    """"""
    seq = parse_seq(tokens, options)
    if tokens.current() != '|':
        return seq
    result = [Required(*seq)] if len(seq) > 1 else seq
    while tokens.current() == '|':
        tokens.move()
        seq = parse_seq(tokens, options)
        result += [Required(*seq)] if len(seq) > 1 else seq
    return [Either(*result)] if len(result) > 1 else result
669984
def simplify_scalar(self, func=sympy.simplify):
        """"""

        def element_simplify(v):
            if isinstance(v, sympy.Basic):
                return func(v)
            elif isinstance(v, QuantumExpression):
                return v.simplify_scalar(func=func)
            else:
                return v

        return self.element_wise(element_simplify)
239002
def normalize(expr):
    """"""
    lhs = normalize(expr.lhs)
    rhs = normalize(expr.rhs)
    return type(expr)(lhs, rhs, start=lhs.start, end=rhs.end)
1056445
def serialize(expr):
    """"""

    result = None

    if isinstance(expr, string_types):
        result = expr

    elif expr is not None:
        result = '=py:{0}'.format(expr)

    return result
845739
def eq(self, other):
        """"""
        other_node = self.box(other).node
        return _expr(exprnode.eq(self.node, other_node))
510215
def _simplify_arguments(arguments):
    
    if len(arguments.args) == 0:
        return arguments.kwargs
    elif len(arguments.kwargs) == 0:
        return arguments.args
    else:
        return arguments
605155
def trim(self, length):
        """"""
        if length > 0:
            for child in self.children.values(): child.trim(length-1)
        else:
            if hasattr(self, 'count'): self.count = sum(map(lambda x: x.count, self))
            self.children = OrderedDict()
1137209
def expr(obj, simplify=True):
    """"""
    if isinstance(obj, Expression):
        return obj
    # False, True, 0, 1
    elif isinstance(obj, int) and obj in {0, 1}:
        return _CONSTS[obj]
    elif isinstance(obj, str):
        ast = pyeda.parsing.boolexpr.parse(obj)
        ex = ast2expr(ast)
        if simplify:
            ex = ex.simplify()
        return ex
    else:
        return One if bool(obj) else Zero