Skip to content

Commit 474db74

Browse files
committed
Bug fixes and removing some print() calls
1 parent 7ce7801 commit 474db74

File tree

7 files changed

+20
-15
lines changed

7 files changed

+20
-15
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
* Fixed old name of my output panel:)
2121

22+
* Fixed a bug in the argument module where not forwarding selections cause errors went down in lines for the above below keywords.
23+
2224
### Changed
2325

2426
* The customer bundles have been modified to be usable with aenea !

library/repair.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,8 @@ def before_double_dot(t):
166166
return t[-1] is None or not(
167167
finish_atom(t[-1]) or
168168
t[-1].string.isspace() or
169-
t[-1].string=="["
169+
t[-1].string=="[" or
170+
t[-1].string in KEYWORDS
170171
)
171172

172173
def before_dot(t):
@@ -185,7 +186,14 @@ def after_dot(t):
185186
)
186187
)
187188
return False
188-
189+
'''
190+
def after_else(t):
191+
if 60<t[0].start[0]<80:
192+
print(t,"\n",start_atom(t[1]),t[1].string in [":"],start_atom(t[1]) or t[1].string in [":"])
193+
return t[1] is None or not(
194+
start_atom(t[1]) or t[1].string in [":"]
195+
)
196+
'''
189197
def handle_empty_compound(atok ,t,l,b,dummy):
190198
n = neighbors(atok, t)
191199
left,right = expand_to_line_or_statement(atok,t, l, b)

queries/argument.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class SelectArgument(SelectionQuery):
2929

3030
def process_line(self,q, root ,atok, origin = None, select_node = None,tiebreaker = lambda x: x,
3131
line = None, transformation = None,inverse_transformation = None, priority = {},
32-
constrained_space = (),
32+
constrained_space = (), second_tiebreaker = None
3333
):
3434
result = None
3535
alternatives = None
@@ -110,6 +110,9 @@ def process_line(self,q, root ,atok, origin = None, select_node = None,tiebreak
110110
temporary = [x[1] for x in temporary]
111111
result,alternatives = obtain_result(None,temporary)
112112

113+
if second_tiebreaker:
114+
alternatives = second_tiebreaker(origin,result,alternatives)
115+
113116

114117

115118

queries/big_roi.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,16 +142,13 @@ def case_three(self,view_information,query_description, extra = {}):
142142
# bug fixing
143143
test_result = decode_abstract_vertical(root,atok,targets,row+1, 1,direction,True,
144144
temporary_information,want_alternatives = False)
145-
print(test_result,ast.dump(test_result))
146-
print(search_upwards_log(origin,ast.stmt))
147145
l = search_upwards_log(origin,ast.stmt)
148146
if test_result in [l[0]] + l[1]:
149147
ndir = ndir + 1
150148

151149

152150
result,alternatives = decode_abstract_vertical(root,atok,targets,row+1, ndir,direction,True,
153151
temporary_information,want_alternatives = True)
154-
print("\n\n promoter is old\n",result,alternatives,"\n")
155152

156153
if result:
157154
new_definition_node = search_upwards(result,ast.FunctionDef)

queries/strategies/abstract_vertical.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,13 @@ def decode_abstract_vertical(root,atok, target,current_line, index,direction,
1111
for n in nodes:
1212
line_information.add(n.first_token.start[0])
1313
line_information = sorted(list(line_information))
14-
print(" inside to go to abstract vertical",line_information)
1514
ll=len(line_information)
1615
if direction=="below":
1716
i = bisect_right(line_information,current_line)
1817
i = min(ll-1,i+index-1)
19-
print(i)
2018
elif direction=="above":
2119
i = bisect_left(line_information,current_line)
2220
i = max(0,i-index)
23-
print(i)
2421
else:
2522
return None
2623
if want_node:

queries/strategies/adjective_strategy.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ def adjective_strategy(
5050
small_special = sorted_by_source_region(atok, small_special)
5151
level_nodes = sorted_by_source_region(atok, level_nodes)
5252
information_nodes = sorted_by_source_region(atok,information_nodes)
53-
print("information_note",information_nodes,"level_nones",level_nodes)
5453
################################################################
5554
# small root level and lexical order strategy
5655
################################################################
@@ -70,19 +69,19 @@ def adjective_strategy(
7069
lca = lca,
7170
constrained_space = constrained_space
7271
)
73-
print("small_root",small_root)
72+
# print("small_root",small_root)
7473

7574
################################################################
7675
# root level and lexical order strategy
7776
################################################################
78-
print("\nDEBUGGING after wrote stuf 0f\n", accumulator.history)
77+
# print("\nDEBUGGING after wrote stuf 0f\n", accumulator.history)
7978
root_level_order(accumulator,root,
8079
level,index,
8180
only_information = only_information,
8281
priority = priority["root_level"],
8382
penalty = 2
8483
)
85-
print("\nDEBUGGING after wrote stuff 1\n", accumulator.history)
84+
# print("\nDEBUGGING after wrote stuff 1\n", accumulator.history)
8685
root_lexical_order(accumulator,root,
8786
level_nodes,information_nodes,index,
8887
only_information=only_information,
@@ -91,7 +90,7 @@ def adjective_strategy(
9190
lca = None,
9291
constrained_space = constrained_space
9392
)
94-
print("\nDEBUGGING after wroteup 20\n", accumulator.history)
93+
# print("\nDEBUGGING after wroteup 20\n", accumulator.history)
9594
################################################################
9695
# strategies for spacial and very special
9796
################################################################

queries/strategies/primitives.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ def _get(l,n,d):
55
def root_level_order(accumulator,root,level,index,only_information,priority,penalty):
66
first_option = level(root,1, index,False)
77
second_option = level(root,1, index,True)
8-
print(first_option,second_option,"from root level order ")
98
if first_option in level.special and only_information==False:
109
accumulator.push(first_option,priority)
1110
else:

0 commit comments

Comments
 (0)