Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reimplemented lessThan: ensure bool is returned #7030

Merged
merged 2 commits into from
Feb 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Orange/widgets/evaluate/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ class ScoreModel(QSortFilterProxyModel):
def lessThan(self, left, right):
def is_bad(x):
return not isinstance(x, (int, float, str)) \
or isinstance(x, float) and np.isnan(x)
or isinstance(x, float) and bool(np.isnan(x))

left = left.data()
right = right.data()
Expand All @@ -146,7 +146,7 @@ def is_bad(x):
return left.upper() < right.upper()

# otherwise, compare numbers
return left < right
return bool(left < right)


DEFAULT_HINTS = {"Model_": True, "Train_": False, "Test_": False}
Expand Down
2 changes: 1 addition & 1 deletion Orange/widgets/visualize/owboxplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def lessThan(self, left, right):
role = self.sortRole()
l_score = left.data(role)
r_score = right.data(role)
return r_score is not None and (l_score is None or l_score < r_score)
return r_score is not None and (l_score is None or bool(l_score < r_score))


class OWBoxPlot(widget.OWWidget):
Expand Down
Loading