Skip to content

Commit

Permalink
Create Class: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
janezd committed Jan 19, 2025
1 parent e961836 commit 8fd8c57
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions Orange/widgets/data/owcreateclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,9 +299,9 @@ def __init__(self):
rules_box.addWidget(QLabel("Count"), 0, 3, 1, 2)
self.update_rules()

widget = QWidget(patternbox)
widget.setLayout(rules_box)
patternbox.layout().addWidget(widget)
widg = QWidget(patternbox)
widg.setLayout(rules_box)
patternbox.layout().addWidget(widg)

box = gui.hBox(patternbox)
gui.rubber(box)
Expand Down Expand Up @@ -396,8 +396,8 @@ def _add_line():
self.rules_box.addWidget(button, n_lines, 0)
self.counts.append([])
for coli, kwargs in enumerate(
(dict(),
dict(styleSheet="color: gray"))):
({},
{"styleSheet": "color: gray"})):
label = QLabel(alignment=Qt.AlignCenter, **kwargs)
self.counts[-1].append(label)
self.rules_box.addWidget(label, n_lines, 3 + coli)
Expand Down Expand Up @@ -453,7 +453,7 @@ def class_labels(self):
if re.match("^C\\d+", label)),
default=0)
class_count = count(largest_c + 1)
return [label_edit.text() or "C{}".format(next(class_count))
return [label_edit.text() or f"C{next(class_count)}"
for label_edit, _ in self.line_edits]

def check_patterns(self):
Expand Down Expand Up @@ -542,9 +542,9 @@ def _set_labels():
for (n_matched, n_total), (lab_matched, lab_total), (lab, patt) in \
zip(self.match_counts, self.counts, self.active_rules):
n_before = n_total - n_matched
lab_matched.setText("{}".format(n_matched))
lab_matched.setText(f"{n_matched}")
if n_before and (lab or patt):
lab_total.setText("+ {}".format(n_before))
lab_total.setText(f"+ {n_before}")
if n_matched:
tip = f"{n_before} o" \
f"f {n_total} matching {pl(n_total, 'instance')} " \
Expand Down Expand Up @@ -682,10 +682,10 @@ def _count_part():
for (n_matched, n_total), class_name, (lab, patt) in \
zip(self.match_counts, names, self.active_rules):
if lab or patt or n_total:
output += "<li>{}; {}</li>".format(_cond_part(), _count_part())
output += f"<li>{_cond_part()}; {_count_part()}</li>"
if output:
self.report_items("Output", [("Class name", self.class_name)])
self.report_raw("<ol>{}</ol>".format(output))
self.report_raw(f"<ol>{output}</ol>")


if __name__ == "__main__": # pragma: no cover
Expand Down

0 comments on commit 8fd8c57

Please sign in to comment.