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

Commit d395809

Browse files
author
Juanjo Alvarez
committed
Position fix and gofmt
Signed-off-by: Juanjo Alvarez <[email protected]>
1 parent 680963e commit d395809

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

driver/normalizer/normalizer.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ func mapStr(nativeType string) Mapping {
8888
{Name: uast.KeyType, Op: String("Boxed" + nativeType)},
8989
{Name: "boxed_value", Op: UASTType(uast.String{}, Obj{
9090
uast.KeyPos: Var("pos_"),
91-
"Value": Var("s"),
92-
"Format": String(""),
91+
"Value": Var("s"),
92+
//"Format": String(""),
9393
})},
9494
{Name: "noops_previous", Optional: "np_opt", Op: Var("noops_previous")},
9595
{Name: "noops_sameline", Optional: "ns_opt", Op: Var("noops_sameline")},
@@ -114,7 +114,7 @@ var Normalizers = []Mapping{
114114
{Name: uast.KeyType, Op: String("BoxedName")},
115115
{Name: "boxed_value", Op: UASTType(uast.Identifier{}, Obj{
116116
uast.KeyPos: Var("pos_"),
117-
"Name": Var("id"),
117+
"Name": Var("id"),
118118
})},
119119
{Name: "noops_previous", Optional: "np_opt", Op: Var("noops_previous")},
120120
{Name: "noops_sameline", Optional: "ns_opt", Op: Var("noops_sameline")},
@@ -136,7 +136,7 @@ var Normalizers = []Mapping{
136136
{Name: uast.KeyType, Op: String("BoxedBoolLiteral")},
137137
{Name: "boxed_value", Op: UASTType(uast.Bool{}, Obj{
138138
uast.KeyPos: Var("pos_"),
139-
"Value": Var("lv"),
139+
"Value": Var("lv"),
140140
})},
141141
{Name: "noops_previous", Optional: "np_opt", Op: Var("noops_previous")},
142142
{Name: "noops_sameline", Optional: "ns_opt", Op: Var("noops_sameline")},
@@ -225,8 +225,8 @@ var Normalizers = []Mapping{
225225
uast.KeyToken: Var("name"),
226226
},
227227
Obj{
228-
"Name": identifierWithPos("name"),
229-
"MapVariadic": Bool(true),
228+
"Name": identifierWithPos("name"),
229+
"MapVariadic": Bool(true),
230230
},
231231
)),
232232

native/python_package/python_driver/astimprove.py

+10-1
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,15 @@ def name2arg(node: Node):
221221
if isinstance(kwarg, str):
222222
# Python2 kwargs are just strings; convert to same format
223223
# as Python3
224-
kwarg = {"arg": kwarg, "annotation": None}
224+
kwarg = {
225+
"arg": kwarg,
226+
"annotation": None,
227+
# the tokenizer will fix the positions later
228+
"lineno": 1,
229+
"end_lineno": 1,
230+
"col_offset": 0,
231+
"end_col_offset": 0
232+
}
225233
kwarg["ast_type"] = "kwarg"
226234
norm_args.append(self.visit(kwarg))
227235

@@ -275,6 +283,7 @@ def visit_other_field(self, node: Node) -> VisitResult:
275283
version = codeinfo['version']
276284

277285
failed = False
286+
testdict = None
278287

279288
if version in (3, 6) and codeinfo['py3ast']:
280289
testdict = codeinfo['py3ast']["PY3AST"]

0 commit comments

Comments
 (0)