Skip to content

Commit 7ce7801

Browse files
committed
Bug fix in arguments and repair
1 parent b074bcc commit 7ce7801

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

library/repair.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -163,11 +163,12 @@ def after_double_dot(t):
163163
)
164164

165165
def before_double_dot(t):
166-
return t[ -1] is None or not(
167-
start_atom(t[1]) or
166+
return t[-1] is None or not(
167+
finish_atom(t[-1]) or
168168
t[-1].string.isspace() or
169169
t[-1].string=="["
170170
)
171+
171172
def before_dot(t):
172173
return t[ - 1] is None or not (
173174
t[-1].string in ["from",".","import"] or
@@ -190,20 +191,16 @@ def handle_empty_compound(atok ,t,l,b,dummy):
190191
left,right = expand_to_line_or_statement(atok,t, l, b)
191192
if token.DEDENT==left.type:
192193
left = next_token(atok,left)
193-
print("empty compound ",[left,right])
194194
if t.string=="elif" and left.string!="elif":
195195
left = next_token(atok,left)
196196
if left is t and right.string == ":" :
197197
rh = next_token(atok,right)
198-
# print("rh is",[rh])
199198
while rh and (rh.line.isspace() or rh.start[0]==right.start[0]):
200-
# print("rh is",[rh])
201199
rh = next_token(atok, rh)
202200
temporary = left.line
203201
ls = temporary[:len(temporary) - len(temporary.lstrip())]
204202
temporary = rh.line if rh else ""
205203
rs = temporary[:len(temporary) - len(temporary.lstrip())]
206-
(print("\nstarting new variation\n",[t],"\n",ls,rs,"these are the indentations",len(ls),len(rs),[left,rh]))
207204
if len(ls)>=len(rs):
208205
return True , right.endpos," pass ", False
209206
else:
@@ -237,7 +234,7 @@ def process_token(atok,t,l,b ):
237234
after = after_bracket(n)
238235
after_space = False
239236
elif s in [":"]:
240-
before = False
237+
before = before_double_dot(n)
241238
before_space = False
242239
after = after_double_dot(n)
243240
after_space = False

queries/argument.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ def case_two(self,view_information,query_description, extra = {}):
161161
ndir = query_description["ndir"]
162162

163163
if vertical_direction in ["up","down"]:
164-
row, column = view_information["rowcol"](selection[0])
164+
row, column = view_information["rowcol"](m.backward(selection)[0])
165165
nr = max(0,row + ndir if vertical_direction=="down" else row - ndir)
166166
t = view_information["text_point"](nr,0)
167167
selection = (t,t)
@@ -172,8 +172,9 @@ def case_two(self,view_information,query_description, extra = {}):
172172
root,atok,m,r = build
173173
selection = m.forward(selection)
174174

175+
# this is the wrong but for some reason it is working:)
175176
if vertical_direction in ["above","below"]:
176-
row, column = view_information["rowcol"](selection[0])
177+
row, column = view_information["rowcol"](m.backward(selection)[0])
177178
nr = decode_abstract_vertical(root,atok,ast.Call,row+1, ndir,vertical_direction)-1
178179
t = view_information["text_point"](nr,0)
179180
selection = (t,t)

0 commit comments

Comments
 (0)