Lines Matching refs:ast
3 import ast
165 return Constant(ast.literal_eval(lhs + self.operator + rhs))
283 Constant(ast.literal_eval(f'{lhs} / {rhs}'))
284 return Constant(ast.literal_eval(f'{self.fn}({lhs}, {rhs})'))
517 class _RewriteIfExpToSelect(ast.NodeTransformer):
523 call = ast.Call(
524 func=ast.Name(id='Select', ctx=ast.Load()),
527 ast.copy_location(call, node.test)
534 Converts a json encoded metric expression by way of python's ast and
537 appropriate calls. Python's ast is used to match if-else that can't
538 be handled via operator overloading. Finally the ast is evaluated.
566 parsed = ast.parse(py, mode='eval')
570 parsed = ast.fix_missing_locations(parsed)