Commit 6ed0f179 authored by Bryton Lacquement's avatar Bryton Lacquement 🚪

qa: division_support

parent cfa7e896
...@@ -41,7 +41,8 @@ class FixDivisionSupport(BaseFix): ...@@ -41,7 +41,8 @@ class FixDivisionSupport(BaseFix):
""" """
def transform(self, node, results): def transform(self, node, results):
filename, lineno, id_ = [l.value for l in node.children[1].children[1].children[:-4:2]] args = results['args']
filename, lineno, id_ = [l.value for l in args.children[:-4:2]]
should_change, status = analyze_data( should_change, status = analyze_data(
get_data( get_data(
"division_trace", "division_trace",
...@@ -55,14 +56,14 @@ class FixDivisionSupport(BaseFix): ...@@ -55,14 +56,14 @@ class FixDivisionSupport(BaseFix):
operator = Leaf(lib2to3.pgen2.token.DOUBLESLASH, "//") operator = Leaf(lib2to3.pgen2.token.DOUBLESLASH, "//")
else: else:
operator = Leaf(lib2to3.pgen2.token.SLASH, "/") operator = Leaf(lib2to3.pgen2.token.SLASH, "/")
operator.prefix = node.children[1].children[1].children[3].prefix operator.prefix = args.children[3].prefix
node.replace( node.replace(
Node( Node(
syms.term, syms.term,
[ [
node.children[1].children[1].children[2].clone(), args.children[2].clone(),
operator, operator,
node.children[1].children[1].children[4].clone() args.children[4].clone()
], ],
prefix=node.prefix)) prefix=node.prefix))
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment