forked from M-Labs/artiq
Replace builtin ast with pythonparser.ast.
This commit is contained in:
parent
f30d671359
commit
c75fd6bc88
|
@ -1,4 +1,4 @@
|
||||||
import ast
|
from pythonparser import ast
|
||||||
|
|
||||||
import llvmlite.ir as ll
|
import llvmlite.ir as ll
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import inspect
|
import inspect
|
||||||
import ast
|
from pythonparser import parse, ast
|
||||||
|
|
||||||
import llvmlite.ir as ll
|
import llvmlite.ir as ll
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ def _gcd(a, b):
|
||||||
|
|
||||||
|
|
||||||
def init_module(module):
|
def init_module(module):
|
||||||
func_def = ast.parse(inspect.getsource(_gcd)).body[0]
|
func_def = parse(inspect.getsource(_gcd)).body[0]
|
||||||
function, _ = module.compile_function(func_def,
|
function, _ = module.compile_function(func_def,
|
||||||
{"a": VInt(64), "b": VInt(64)})
|
{"a": VInt(64), "b": VInt(64)})
|
||||||
function.linkage = "internal"
|
function.linkage = "internal"
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
import ast
|
import pythonparser.algorithm
|
||||||
|
from pythonparser import ast
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
|
|
||||||
from artiq.py2llvm.ast_body import Visitor
|
from artiq.py2llvm.ast_body import Visitor
|
||||||
from artiq.py2llvm import base_types
|
from artiq.py2llvm import base_types
|
||||||
|
|
||||||
|
|
||||||
class _TypeScanner(ast.NodeVisitor):
|
class _TypeScanner(pythonparser.algorithm.Visitor):
|
||||||
def __init__(self, env, ns):
|
def __init__(self, env, ns):
|
||||||
self.exprv = Visitor(env, ns)
|
self.exprv = Visitor(env, ns)
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import unittest
|
import unittest
|
||||||
import ast
|
from pythonparser import parse, ast
|
||||||
import inspect
|
import inspect
|
||||||
from fractions import Fraction
|
from fractions import Fraction
|
||||||
from ctypes import CFUNCTYPE, c_int, c_int32, c_int64, c_double
|
from ctypes import CFUNCTYPE, c_int, c_int32, c_int64, c_double
|
||||||
|
@ -43,7 +43,7 @@ def _base_types(choice):
|
||||||
|
|
||||||
def _build_function_types(f):
|
def _build_function_types(f):
|
||||||
return infer_function_types(
|
return infer_function_types(
|
||||||
None, ast.parse(inspect.getsource(f)),
|
None, parse(inspect.getsource(f)),
|
||||||
dict())
|
dict())
|
||||||
|
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ class CompiledFunction:
|
||||||
def __init__(self, function, param_types):
|
def __init__(self, function, param_types):
|
||||||
module = Module()
|
module = Module()
|
||||||
|
|
||||||
func_def = ast.parse(inspect.getsource(function)).body[0]
|
func_def = parse(inspect.getsource(function)).body[0]
|
||||||
function, retval = module.compile_function(func_def, param_types)
|
function, retval = module.compile_function(func_def, param_types)
|
||||||
argvals = [param_types[arg.arg] for arg in func_def.args.args]
|
argvals = [param_types[arg.arg] for arg in func_def.args.args]
|
||||||
|
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -6,7 +6,7 @@ from setuptools import setup, find_packages
|
||||||
requirements = [
|
requirements = [
|
||||||
"sphinx", "sphinx-argparse", "pyserial", "numpy", "scipy",
|
"sphinx", "sphinx-argparse", "pyserial", "numpy", "scipy",
|
||||||
"python-dateutil", "prettytable", "h5py", "pydaqmx", "pyelftools",
|
"python-dateutil", "prettytable", "h5py", "pydaqmx", "pyelftools",
|
||||||
"quamash", "pyqtgraph"
|
"quamash", "pyqtgraph", "pythonparser"
|
||||||
]
|
]
|
||||||
|
|
||||||
scripts = [
|
scripts = [
|
||||||
|
|
Loading…
Reference in New Issue