mirror of
https://github.com/m-labs/artiq.git
synced 2025-02-13 11:03:20 +08:00
8 lines
187 B
Python
8 lines
187 B
Python
import ast
|
|
|
|
def eval_ast(expr, symdict=dict()):
|
|
if not isinstance(expr, ast.Expression):
|
|
expr = ast.Expression(expr)
|
|
code = compile(expr, "<ast>", "eval")
|
|
return eval(code, symdict)
|