Skip to content
This repository was archived by the owner on Mar 8, 2020. It is now read-only.

Commit f300b74

Browse files
authored
Merge pull request #173 from tsolakoua/python-source-tests
Add source and tests python - benchmark
2 parents 159570e + 3c11b21 commit f300b74

File tree

60 files changed

+41579
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+41579
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
def accumulator(sum):
2+
def f(n):
3+
nonlocal sum
4+
sum += n
5+
return sum
6+
return f
7+
8+
x = accumulator(1)
9+
x(5)
10+
print(accumulator(3))
11+
print(x(2.3))
Lines changed: 309 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,309 @@
1+
{
2+
'PY3AST': {
3+
'ast_type': "Module",
4+
body: [
5+
{
6+
args: {
7+
args: [
8+
{
9+
'@token': "sum",
10+
annotation: ~,
11+
'ast_type': "arg",
12+
'col_offset': 17,
13+
'end_col_offset': 20,
14+
'end_lineno': 1,
15+
lineno: 1,
16+
},
17+
],
18+
'ast_type': "arguments",
19+
},
20+
'ast_type': "FunctionDef",
21+
body: [
22+
{
23+
args: {
24+
args: [
25+
{
26+
'@token': "n",
27+
annotation: ~,
28+
'ast_type': "arg",
29+
'col_offset': 9,
30+
'end_col_offset': 10,
31+
'end_lineno': 2,
32+
lineno: 2,
33+
},
34+
],
35+
'ast_type': "arguments",
36+
},
37+
'ast_type': "FunctionDef",
38+
body: [
39+
{
40+
'ast_type': "Nonlocal",
41+
'col_offset': 5,
42+
'end_col_offset': 13,
43+
'end_lineno': 3,
44+
lineno: 3,
45+
names: [
46+
{
47+
'ast_type': "Name",
48+
'col_offset': 14,
49+
'end_col_offset': 17,
50+
'end_lineno': 3,
51+
id: "sum",
52+
lineno: 3,
53+
},
54+
],
55+
},
56+
{
57+
'ast_type': "AugAssign",
58+
'col_offset': 9,
59+
'end_col_offset': 11,
60+
'end_lineno': 4,
61+
lineno: 4,
62+
op: {
63+
'ast_type': "Add",
64+
},
65+
target: {
66+
'ast_type': "Name",
67+
'col_offset': 5,
68+
ctx: "Store",
69+
'end_col_offset': 8,
70+
'end_lineno': 4,
71+
id: "sum",
72+
lineno: 4,
73+
},
74+
value: {
75+
'ast_type': "Name",
76+
'col_offset': 12,
77+
ctx: "Load",
78+
'end_col_offset': 13,
79+
'end_lineno': 4,
80+
id: "n",
81+
lineno: 4,
82+
},
83+
},
84+
{
85+
'ast_type': "Return",
86+
'col_offset': 5,
87+
'end_col_offset': 11,
88+
'end_lineno': 5,
89+
lineno: 5,
90+
value: {
91+
'ast_type': "Name",
92+
'col_offset': 12,
93+
ctx: "Load",
94+
'end_col_offset': 15,
95+
'end_lineno': 5,
96+
id: "sum",
97+
lineno: 5,
98+
},
99+
},
100+
],
101+
'col_offset': 7,
102+
'decorator_list': [],
103+
'end_col_offset': 8,
104+
'end_lineno': 2,
105+
lineno: 2,
106+
name: "f",
107+
returns: ~,
108+
},
109+
{
110+
'ast_type': "Return",
111+
'col_offset': 3,
112+
'end_col_offset': 9,
113+
'end_lineno': 6,
114+
lineno: 6,
115+
value: {
116+
'ast_type': "Name",
117+
'col_offset': 10,
118+
ctx: "Load",
119+
'end_col_offset': 11,
120+
'end_lineno': 6,
121+
id: "f",
122+
lineno: 6,
123+
},
124+
},
125+
],
126+
'col_offset': 5,
127+
'decorator_list': [],
128+
'end_col_offset': 16,
129+
'end_lineno': 1,
130+
lineno: 1,
131+
name: "accumulator",
132+
returns: ~,
133+
},
134+
{
135+
'ast_type': "Assign",
136+
'col_offset': 1,
137+
lineno: 8,
138+
targets: [
139+
{
140+
'ast_type': "Name",
141+
'col_offset': 1,
142+
ctx: "Store",
143+
'end_col_offset': 2,
144+
'end_lineno': 8,
145+
id: "x",
146+
lineno: 8,
147+
'noops_previous': {
148+
'ast_type': "PreviousNoops",
149+
'col_offset': 1,
150+
'end_col_offset': 1,
151+
'end_lineno': 7,
152+
lineno: 7,
153+
lines: [],
154+
},
155+
},
156+
],
157+
value: {
158+
args: [
159+
{
160+
'ast_type': "Num",
161+
'col_offset': 17,
162+
'end_col_offset': 18,
163+
'end_lineno': 8,
164+
lineno: 8,
165+
'n': 1,
166+
},
167+
],
168+
'ast_type': "Call",
169+
'col_offset': 5,
170+
func: {
171+
'ast_type': "Name",
172+
'col_offset': 5,
173+
ctx: "Load",
174+
'end_col_offset': 16,
175+
'end_lineno': 8,
176+
id: "accumulator",
177+
lineno: 8,
178+
},
179+
keywords: [],
180+
lineno: 8,
181+
},
182+
},
183+
{
184+
'ast_type': "Expr",
185+
'col_offset': 1,
186+
lineno: 9,
187+
value: {
188+
args: [
189+
{
190+
'ast_type': "Num",
191+
'col_offset': 3,
192+
'end_col_offset': 4,
193+
'end_lineno': 9,
194+
lineno: 9,
195+
'n': 5,
196+
},
197+
],
198+
'ast_type': "Call",
199+
'col_offset': 1,
200+
func: {
201+
'ast_type': "Name",
202+
'col_offset': 1,
203+
ctx: "Load",
204+
'end_col_offset': 2,
205+
'end_lineno': 9,
206+
id: "x",
207+
lineno: 9,
208+
},
209+
keywords: [],
210+
lineno: 9,
211+
},
212+
},
213+
{
214+
'ast_type': "Expr",
215+
'col_offset': 1,
216+
lineno: 10,
217+
value: {
218+
args: [
219+
{
220+
args: [
221+
{
222+
'ast_type': "Num",
223+
'col_offset': 19,
224+
'end_col_offset': 20,
225+
'end_lineno': 10,
226+
lineno: 10,
227+
'n': 3,
228+
},
229+
],
230+
'ast_type': "Call",
231+
'col_offset': 7,
232+
func: {
233+
'ast_type': "Name",
234+
'col_offset': 7,
235+
ctx: "Load",
236+
'end_col_offset': 18,
237+
'end_lineno': 10,
238+
id: "accumulator",
239+
lineno: 10,
240+
},
241+
keywords: [],
242+
lineno: 10,
243+
},
244+
],
245+
'ast_type': "Call",
246+
'col_offset': 1,
247+
func: {
248+
'ast_type': "Name",
249+
'col_offset': 1,
250+
ctx: "Load",
251+
'end_col_offset': 6,
252+
'end_lineno': 10,
253+
id: "print",
254+
lineno: 10,
255+
},
256+
keywords: [],
257+
lineno: 10,
258+
},
259+
},
260+
{
261+
'ast_type': "Expr",
262+
'col_offset': 1,
263+
lineno: 11,
264+
value: {
265+
args: [
266+
{
267+
args: [
268+
{
269+
'ast_type': "Num",
270+
'col_offset': 9,
271+
'end_col_offset': 12,
272+
'end_lineno': 11,
273+
lineno: 11,
274+
'n': 2.3,
275+
},
276+
],
277+
'ast_type': "Call",
278+
'col_offset': 7,
279+
func: {
280+
'ast_type': "Name",
281+
'col_offset': 7,
282+
ctx: "Load",
283+
'end_col_offset': 8,
284+
'end_lineno': 11,
285+
id: "x",
286+
lineno: 11,
287+
},
288+
keywords: [],
289+
lineno: 11,
290+
},
291+
],
292+
'ast_type': "Call",
293+
'col_offset': 1,
294+
func: {
295+
'ast_type': "Name",
296+
'col_offset': 1,
297+
ctx: "Load",
298+
'end_col_offset': 6,
299+
'end_lineno': 11,
300+
id: "print",
301+
lineno: 11,
302+
},
303+
keywords: [],
304+
lineno: 11,
305+
},
306+
},
307+
],
308+
},
309+
}

0 commit comments

Comments
 (0)