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

Commit 2377745

Browse files
committed
fix varargs in python 2 files; fixes #199
Signed-off-by: Denys Smirnov <[email protected]>
1 parent 8a13c6b commit 2377745

File tree

5 files changed

+759
-9
lines changed

5 files changed

+759
-9
lines changed

fixtures/vararg_python2.py

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
def function6(a, *param):
2+
print "variadicArgs"
3+
4+
def function7(a, *args, **kwargs):
5+
print "variadicAndKeywordArgs"

fixtures/vararg_python2.py.native

+143
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
{
2+
'PY2AST': {
3+
'ast_type': "Module",
4+
body: [
5+
{
6+
args: {
7+
args: [
8+
{
9+
'@token': "a",
10+
'ast_type': "arg",
11+
'col_offset': 15,
12+
ctx: "Param",
13+
'end_col_offset': 16,
14+
'end_lineno': 1,
15+
lineno: 1,
16+
},
17+
{
18+
'@token': "param",
19+
annotation: ~,
20+
'ast_type': "vararg",
21+
'col_offset': 19,
22+
'end_col_offset': 24,
23+
'end_lineno': 1,
24+
lineno: 1,
25+
},
26+
],
27+
'ast_type': "arguments",
28+
},
29+
'ast_type': "FunctionDef",
30+
body: [
31+
{
32+
'ast_type': "Print",
33+
'col_offset': 5,
34+
dest: ~,
35+
'end_col_offset': 10,
36+
'end_lineno': 2,
37+
lineno: 2,
38+
nl: true,
39+
values: [
40+
{
41+
'ast_type': "Str",
42+
'col_offset': 11,
43+
'end_col_offset': 25,
44+
'end_lineno': 2,
45+
lineno: 2,
46+
s: "variadicArgs",
47+
},
48+
],
49+
},
50+
],
51+
'col_offset': 5,
52+
'decorator_list': [],
53+
'end_col_offset': 14,
54+
'end_lineno': 1,
55+
lineno: 1,
56+
name: "function6",
57+
},
58+
{
59+
args: {
60+
args: [
61+
{
62+
'@token': "a",
63+
'ast_type': "arg",
64+
'col_offset': 15,
65+
ctx: "Param",
66+
'end_col_offset': 16,
67+
'end_lineno': 4,
68+
lineno: 4,
69+
'noops_previous': {
70+
'ast_type': "PreviousNoops",
71+
'col_offset': 1,
72+
'end_col_offset': 1,
73+
'end_lineno': 3,
74+
lineno: 3,
75+
lines: [],
76+
},
77+
},
78+
{
79+
'@token': "kwargs",
80+
annotation: ~,
81+
'ast_type': "kwarg",
82+
'col_offset': 1,
83+
'end_col_offset': 1,
84+
'end_lineno': 1,
85+
lineno: 1,
86+
},
87+
{
88+
'@token': "args",
89+
annotation: ~,
90+
'ast_type': "vararg",
91+
'col_offset': 1,
92+
'end_col_offset': 1,
93+
'end_lineno': 1,
94+
lineno: 1,
95+
},
96+
],
97+
'ast_type': "arguments",
98+
},
99+
'ast_type': "FunctionDef",
100+
body: [
101+
{
102+
'ast_type': "Print",
103+
'col_offset': 5,
104+
dest: ~,
105+
'end_col_offset': 10,
106+
'end_lineno': 5,
107+
lineno: 5,
108+
nl: true,
109+
values: [
110+
{
111+
'ast_type': "Str",
112+
'col_offset': 11,
113+
'end_col_offset': 35,
114+
'end_lineno': 5,
115+
lineno: 5,
116+
'noops_sameline': {
117+
'ast_type': "SameLineNoops",
118+
'col_offset': 34,
119+
'end_col_offset': 35,
120+
'end_lineno': 5,
121+
lineno: 5,
122+
'noop_lines': [
123+
{
124+
'ast_type': "NoopSameLine",
125+
s: "",
126+
},
127+
],
128+
},
129+
s: "variadicAndKeywordArgs",
130+
},
131+
],
132+
},
133+
],
134+
'col_offset': 5,
135+
'decorator_list': [],
136+
'end_col_offset': 14,
137+
'end_lineno': 4,
138+
lineno: 4,
139+
name: "function7",
140+
},
141+
],
142+
},
143+
}

0 commit comments

Comments
 (0)