Removed a couple of un-pythonic lines
This commit is contained in:
parent
5218f41e7b
commit
bcc7053892
@ -289,10 +289,7 @@ def futile_renames(n):
|
|||||||
# Scans dictionary to locate things like "a->b,b->c" and replace them
|
# Scans dictionary to locate things like "a->b,b->c" and replace them
|
||||||
# with "a->c"
|
# with "a->c"
|
||||||
for key in list(_vars.keys()):
|
for key in list(_vars.keys()):
|
||||||
try:
|
value = _vars.get(key)
|
||||||
value = _vars[key]
|
|
||||||
except:
|
|
||||||
value = None
|
|
||||||
if key == value:
|
if key == value:
|
||||||
_vars.pop(value) # Removes the unused one
|
_vars.pop(value) # Removes the unused one
|
||||||
# Reset prop var
|
# Reset prop var
|
||||||
@ -332,10 +329,7 @@ def subsequent_renames(n):
|
|||||||
# Scans dictionary to locate things like "a->b,b->c" and replace them
|
# Scans dictionary to locate things like "a->b,b->c" and replace them
|
||||||
# with "a->c"
|
# with "a->c"
|
||||||
for key in list(_vars.keys()):
|
for key in list(_vars.keys()):
|
||||||
try:
|
value = _vars.get(key)
|
||||||
value = _vars[key]
|
|
||||||
except:
|
|
||||||
value = None
|
|
||||||
if value in _vars.keys():
|
if value in _vars.keys():
|
||||||
if _vars[value] != key:
|
if _vars[value] != key:
|
||||||
# Double rename on attribute
|
# Double rename on attribute
|
||||||
@ -593,8 +587,7 @@ def selection_and_product(n, rels):
|
|||||||
n.child.right = r_node
|
n.child.right = r_node
|
||||||
while len(right) > 0:
|
while len(right) > 0:
|
||||||
c = right.pop(0)
|
c = right.pop(0)
|
||||||
for i in c:
|
r_node.prop += ' '.join(c)
|
||||||
r_node.prop += i + ' '
|
|
||||||
if len(right) > 0:
|
if len(right) > 0:
|
||||||
r_node.prop += ' and '
|
r_node.prop += ' and '
|
||||||
if '(' in r_node.prop:
|
if '(' in r_node.prop:
|
||||||
@ -604,8 +597,7 @@ def selection_and_product(n, rels):
|
|||||||
if len(both) != 0:
|
if len(both) != 0:
|
||||||
while len(both) > 0:
|
while len(both) > 0:
|
||||||
c = both.pop(0)
|
c = both.pop(0)
|
||||||
for i in c:
|
n.prop += ' '.join(c)
|
||||||
n.prop += i + ' '
|
|
||||||
if len(both) > 0:
|
if len(both) > 0:
|
||||||
n.prop += ' and '
|
n.prop += ' and '
|
||||||
if '(' in n.prop:
|
if '(' in n.prop:
|
||||||
@ -616,8 +608,17 @@ def selection_and_product(n, rels):
|
|||||||
return changes + recoursive_scan(selection_and_product, n, rels)
|
return changes + recoursive_scan(selection_and_product, n, rels)
|
||||||
|
|
||||||
general_optimizations = [
|
general_optimizations = [
|
||||||
duplicated_select, down_to_unions_subtractions_intersections, duplicated_projection, selection_inside_projection,
|
duplicated_select,
|
||||||
subsequent_renames, swap_rename_select, futile_union_intersection_subtraction, swap_union_renames, swap_rename_projection, select_union_intersect_subtract]
|
down_to_unions_subtractions_intersections,
|
||||||
|
duplicated_projection,
|
||||||
|
selection_inside_projection,
|
||||||
|
subsequent_renames,
|
||||||
|
swap_rename_select,
|
||||||
|
futile_union_intersection_subtraction,
|
||||||
|
swap_union_renames,
|
||||||
|
swap_rename_projection,
|
||||||
|
select_union_intersect_subtract
|
||||||
|
]
|
||||||
specific_optimizations = [selection_and_product]
|
specific_optimizations = [selection_and_product]
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
Loading…
x
Reference in New Issue
Block a user