Skip to content

Commit d9bde33

Browse files
committed
Mosaic: Lint
1 parent 93bfcc2 commit d9bde33

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

Orange/widgets/visualize/owmosaic.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ def reset_graph(self):
455455
self.update_graph()
456456

457457
def update_selection_rects(self):
458-
for i, (attr, vals, area) in enumerate(self.areas):
458+
for i, (_, _, area) in enumerate(self.areas):
459459
if i in self.selection:
460460
area.setPen(QPen(Qt.black, 3, Qt.DotLine))
461461
else:
@@ -483,7 +483,7 @@ def send_selection(self):
483483
if isinstance(self.data, SqlTable):
484484
self.Warning.no_cont_selection_sql()
485485
for i in self.selection:
486-
cols, vals, area = self.areas[i]
486+
cols, vals, _ = self.areas[i]
487487
filters.append(
488488
filter.Values(
489489
filter.FilterDiscrete(col, [val])
@@ -509,8 +509,7 @@ def update_graph(self):
509509
bar_width = self.BAR_WIDTH
510510

511511
def draw_data(attr_list, x0_x1, y0_y1, side, condition,
512-
total_attrs, used_attrs=[], used_vals=[],
513-
attr_vals=""):
512+
total_attrs, used_attrs, used_vals, attr_vals=""):
514513
x0, x1 = x0_x1
515514
y0, y1 = y0_y1
516515
if conditionaldict[attr_vals] == 0:
@@ -695,8 +694,8 @@ def draw_text(side, attr, x0_x1, y0_y1,
695694
y0 + (y1 - y0) / 2,
696695
align, bold=1, vertical=True)
697696

698-
def add_rect(x0, x1, y0, y1, condition="",
699-
used_attrs=[], used_vals=[], attr_vals=""):
697+
def add_rect(x0, x1, y0, y1, condition,
698+
used_attrs, used_vals, attr_vals=""):
700699
area_index = len(self.areas)
701700
if x0 == x1:
702701
x1 += 1
@@ -822,18 +821,17 @@ def line(x1, y1, x2, y2):
822821
text = "<br/>".join(
823822
"<b>%s</b>: %d / %.1f%% (Expected %.1f / %.1f%%)" %
824823
(cls, act, 100.0 * act / n_actual,
825-
apr / n_apriori * n_actual, 100.0 * apr / n_apriori
826-
)
824+
apr / n_apriori * n_actual, 100.0 * apr / n_apriori)
827825
for cls, act, apr in zip(cls_values, actual, apriori))
828826
else:
829827
text = ""
830828
outer_rect.setToolTip(
831829
"{}<hr>Instances: {}<br><br>{}".format(
832-
condition, n_actual, text[:-4]))
830+
condition, n_actual, text[:-4]))
833831

834832
def draw_legend(x0_x1, y0_y1):
835833
x0, x1 = x0_x1
836-
y0, y1 = y0_y1
834+
_, y1 = y0_y1
837835
if self.interior_coloring == self.PEARSON:
838836
names = ["<-8", "-8:-4", "-4:-2", "-2:2", "2:4", "4:8", ">8",
839837
"Residuals:"]
@@ -948,7 +946,7 @@ def get_max_label_width(attr):
948946
# draw rectangles
949947
draw_data(
950948
attr_list, (xoff, xoff + square_size), (yoff, yoff + square_size),
951-
0, "", len(attr_list))
949+
0, "", len(attr_list), [], [])
952950
draw_legend((xoff, xoff + square_size), (yoff, yoff + square_size))
953951
self.update_selection_rects()
954952

@@ -983,7 +981,7 @@ def get_conditional_distribution(data, attrs):
983981
for k, ind in enumerate(indices):
984982
vals.append(attr[k].values[ind])
985983
fd = filter.FilterDiscrete(
986-
column=attr[k], values=[attr[k].values[ind]])
984+
column=attr[k], values=[attr[k].values[ind]])
987985
conditions.append(fd)
988986
filt = filter.Values(conditions)
989987
filtdata = filt(data)
@@ -992,8 +990,7 @@ def get_conditional_distribution(data, attrs):
992990
return cond_dist, dist
993991

994992

995-
# test widget appearance
996-
if __name__ == "__main__":
993+
def main():
997994
import sys
998995
from AnyQt.QtWidgets import QApplication
999996
a = QApplication(sys.argv)
@@ -1003,3 +1000,6 @@ def get_conditional_distribution(data, attrs):
10031000
ow.set_data(data)
10041001
ow.handleNewSignals()
10051002
a.exec_()
1003+
1004+
if __name__ == "__main__":
1005+
main()

0 commit comments

Comments
 (0)