diff --git a/relational/optimizer.py b/relational/optimizer.py index d12cefc..dcd7dac 100644 --- a/relational/optimizer.py +++ b/relational/optimizer.py @@ -70,13 +70,13 @@ def optimize_all(expression, rels, specific=True, general=True, debug=None): for i in optimizations.specific_optimizations: res = i(n, rels) # Performs the optimization if res != 0 and dbg: - debug.append(n.__str__()) + debug.append(str(n)) total += res if general: for i in optimizations.general_optimizations: res = i(n) # Performs the optimization if res != 0 and dbg: - debug.append(n.__str__()) + debug.append(str(n)) total += res return n.__str__() diff --git a/relational_gui/guihandler.py b/relational_gui/guihandler.py index 9bb8850..393d0eb 100644 --- a/relational_gui/guihandler.py +++ b/relational_gui/guihandler.py @@ -154,7 +154,9 @@ class relForm(QtWidgets.QMainWindow): res_rel,query = self.user_interface.split_query(self.ui.txtQuery.text(),None) try: result = optimizer.optimize_all( - query, self.user_interface.relations) + query, + self.user_interface.relations + ) if res_rel: result = '%s = %s' % (res_rel, result) self.ui.txtQuery.setText(result) @@ -217,15 +219,14 @@ class relForm(QtWidgets.QMainWindow): # Set content for i in rel.content: item = QtWidgets.QTreeWidgetItem() - for j in range(len(i)): - item.setText(j, i[j]) + for j,k in enumerate(i): + item.setText(j, k) self.ui.table.addTopLevelItem(item) # Sets columns for i, attr in enumerate(rel.header): self.ui.table.headerItem().setText(i, attr) - self.ui.table.resizeColumnToContents( - i) # Must be done in order to avoid too small columns + self.ui.table.resizeColumnToContents(i) def printRelation(self, item): self.selectedRelation = self.user_interface.relations[item.text()]