Пример #1
0
 def evaluate(self, expression):
     if expression is True:
         expression = "default"
     try:
         expression = _ensure_string_from_expression(expression)
         result = eval(expression, expression_namespace, self)
     except:
         import traceback as tb
         tb.print_stack()
         raise
     result = unwrap(result)
     return result
Пример #2
0
 def evaluate(self, expression, out=None):
     if isinstance(expression, vaex.expression.Expression):
         expression = expression.expression
     try:
         # logger.debug("try avoid evaluating: %s", expression)
         result = self[expression]
     except KeyError:
         # logger.debug("no luck, eval: %s", expression)
         # result = ne.evaluate(expression, local_dict=self, out=out)
         # logger.debug("in eval")
         # eval("def f(")
         result = eval(expression, expression_namespace, self)
         self.values[expression] = result
         # if out is not None:
         #   out[:] = result
         #   result = out
         # logger.debug("out eval")
     # logger.debug("done with eval of %s", expression)
     result = unwrap(result)
     return result