this takes evaluated left and right (i.e. values not expressions)
196079
def evalop(op,left,right):
  ""
  if op in ('=','!=','>','<'): return threevl.ThreeVL.compare(op,left,right)
  elif op in ('+','-','*','/'): # todo: does arithmetic require threevl?
    if op=='/': raise NotImplementedError('todo: spec about int/float division')
    return (left + right) if op=='+' else (left - right) if op=='-' else (left * right) if op=='*' else (left/right)
  elif op=='in': return (tuple(left) in right) if isinstance(left,list) and isinstance(right[0],tuple) else (left in right)
  elif op in ('and','or'): return threevl.ThreeVL.andor(op,left,right)
  elif op in ('is not','is'):
    if right is not None: raise NotImplementedError('can null be on either side? what if neither value is null?')
    return (left is not None) if (op=='is not') else (left is None)
  elif op=='@>':
    # todo: support a TextSearchDoc that will overload a lot of these operators
    if not all(isinstance(x,list) for x in (left,right)): raise TypeError('non-array-args',op,left,right)
    return set(left)>=set(right)
  elif op=='||':
    if not all(isinstance(x,list) for x in (left,right)): raise TypeError('non-array-args',op,left,right)
    return left+right
  elif op=='@@':
    if not all(isinstance(x,set) for x in (left,right)): raise TypeError('non_set_args',op,type(left),type(right))
    return bool(left&right)
  else: raise NotImplementedError(op,left,right)
475051
function operate(op, left, right){
  utils.assertType(op, 'string', 'op');
  utils.assertPresent(left, 'left');
  utils.assertPresent(right, 'right');
  return left.operate(op.val, right);
}
40058
private Boolean compareValues(Session session, Object left, Object right) {
        if (left == null) {
            if (opType == OpTypes.NOT_DISTINCT) {
                return right == null;
            }
            return null;
        }

        if (right == null) {
            return (opType == OpTypes.NOT_DISTINCT) ? Boolean.FALSE : null;
        }

        int result = nodes[LEFT].dataType.compare(left, right);

        switch (opType) {

            case OpTypes.EQUAL :
            case OpTypes.NOT_DISTINCT :
                return result == 0 ? Boolean.TRUE
                                   : Boolean.FALSE;

            case OpTypes.NOT_EQUAL :
                return result != 0 ? Boolean.TRUE
                                   : Boolean.FALSE;

            case OpTypes.GREATER :
                return result > 0 ? Boolean.TRUE
                                  : Boolean.FALSE;

            case OpTypes.GREATER_EQUAL :
                return result >= 0 ? Boolean.TRUE
                                   : Boolean.FALSE;

            case OpTypes.SMALLER_EQUAL :
                return result <= 0 ? Boolean.TRUE
                                   : Boolean.FALSE;

            case OpTypes.SMALLER :
                return result < 0 ? Boolean.TRUE
                                  : Boolean.FALSE;

            default :
                throw Error.runtimeError(ErrorCode.U_S0500, "Expression");
        }
    }
795483
public static Boolean lt(Object left, Object right) {
        return EvalHelper.compare(left, right, null, (l, r) -> l.compareTo(r) < 0);
    }
762644
def ensure_compatible(left, right):
    """"""
    conflicts = list(conflicting_pairs(left, right))
    if conflicts:
        raise ValueError('conflicting values for object/property pairs: %r' % conflicts)
1362697
public static Boolean ne(Object left, Object right) {
        return not(EvalHelper.isEqual(left, right, null));
    }
291997
def _call(self, x, out=None):
        """"""
        if out is None:
            return self.left(x) * self.right(x)
        else:
            tmp = self.right.range.element()
            # Write to `tmp` first, otherwise aliased `x` and `out` lead
            # to wrong result
            self.left(x, out=tmp)
            self.right(x, out=out)
            out *= tmp
1181272
function offsetLeft (elem) {
    let left = 0

    do {
      if (!isNaN(elem.offsetLeft)) left += elem.offsetLeft
    } while (elem = elem.offsetParent )

    return left
  }
1001061
private Stream<ImmutableExpression> extractEqualities(ImmutableSubstitution<ImmutableTerm> substitution,
                                                          ImmutableSet<Variable> leftVariables) {
        return substitution.getImmutableMap().entrySet().stream()
                .filter(e -> leftVariables.contains(e.getKey()) || leftVariables.contains(e.getValue()))
                .map(e -> termFactory.getImmutableExpression(EQ, e.getKey(), e.getValue()));
    }
937054
@Override
	public Object evaluate( Message message ) throws JMSException
    {
        Boolean leftOperandValue = leftOperand.evaluateBoolean(message);
        if (leftOperandValue == null)
        {
            Boolean rightOperandValue = rightOperand.evaluateBoolean(message);
            if (rightOperandValue == null || !rightOperandValue.booleanValue())
                return null;
            
            return Boolean.TRUE;
        }
        else
        {
            if (leftOperandValue.booleanValue())
                return Boolean.TRUE;
            
            return rightOperand.evaluateBoolean(message);
        }
    }
806407
def _readedf_extractline(left, right):
    
    functions = [int, float, lambda l:float(l.split(None, 1)[0]),
                 lambda l:int(l.split(None, 1)[0]),
                 dateutil.parser.parse, lambda x:str(x)]
    for f in functions:
        try:
            right = f(right)
            break
        except ValueError:
            continue
    return right
786921
public static Boolean eq(Object left, Object right) {
        return EvalHelper.isEqual(left, right, null);
    }
907590
def _evaluate_expression(self, expr):
        """"""
        def cast_value(v):
            # Convert Decimal to Fraction to allow successful multiplication
            # by either float (most solvers) or Fraction (exact solver).
            # Multiplying Fraction and float results in a float, and
            # multiplying Fraction and Fraction result in Fraction, which are
            # exactly the types of results we want.
            if isinstance(v, Decimal):
                return Fraction(v)
            return v

        total = cast_value(expr.offset)
        for var, value in expr.values():
            value = cast_value(value)
            if not isinstance(var, Product):
                total += self._get_value(var) * value
            else:
                total += reduce(
                    operator.mul, (self._get_value(v) for v in var), value)
        return total
1039996
private static List<String> _evaluateValueExpressions(FacesContext context, List<String> values)
    {
        // note that we have to create a new List here, because if we
        // change any value on the given List, it will be changed in the
        // NavigationCase too and the EL expression won't be evaluated again
        List<String> target = new ArrayList<String>(values.size());
        for (String value : values)
        {
            if (_isExpression(value))
            {
                // evaluate the ValueExpression
                value = context.getApplication().evaluateExpressionGet(context, value, String.class);
            }
            target.add(value);
        }
        return target;
    }
1326106
@Override
	public Object evaluate(Message message) throws JMSException
    {
        String leftValue = leftOperand.evaluateString(message);
        String rightValue = rightOperand.evaluateString(message);
        if (leftValue == null || rightValue == null)
            return null;
        
        String escapeValue = escapeOperand != null ? escapeOperand.evaluateString(message) : null;
        
        return StringUtils.matches(leftValue, rightValue, escapeValue);
    }
561850
def _operator_handling(self, cursor):
        """"""
        values = self._literal_handling(cursor)
        retval = ''.join([str(val) for val in values])
        return retval
1020099
def evaluate_expression(expression, vars):
    ''''''
    try:
        v = eval(expression, globals(), vars)
    except NameError:
        return None
    except ZeroDivisionError:
        return None
    return v