Skip to content

Commit 953f84e

Browse files
fix nonetype error during print for tasks without class labels (#1148)
* fix nonetype error during print for tasks without class labels * fix #1100/#1058 nonetype error Co-authored-by: Pieter Gijsbers <p.gijsbers@tue.nl>
1 parent c17704e commit 953f84e

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

doc/progress.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@ Changelog
88

99
0.13.0
1010
~~~~~~
11-
* MAINT#1104: Fix outdated docstring for ``list_task``.
1211
* FIX#1030: ``pre-commit`` hooks now no longer should issue a warning.
12+
* FIX#1058, #1100: Avoid ``NoneType`` error when printing task without ``class_labels`` attribute.
1313
* FIX#1110: Make arguments to ``create_study`` and ``create_suite`` that are defined as optional by the OpenML XSD actually optional.
1414
* FIX#1147: ``openml.flow.flow_exists`` no longer requires an API key.
1515
* MAIN#1088: Do CI for Windows on Github Actions instead of Appveyor.
16+
* MAINT#1104: Fix outdated docstring for ``list_task``.
1617
* MAIN#1146: Update the pre-commit dependencies.
1718
* ADD#1103: Add a ``predictions`` property to OpenMLRun for easy accessibility of prediction data.
1819

openml/tasks/task.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def _get_repr_body_fields(self) -> List[Tuple[str, Union[str, int, List[str]]]]:
9797
fields["Estimation Procedure"] = self.estimation_procedure["type"]
9898
if getattr(self, "target_name", None) is not None:
9999
fields["Target Feature"] = getattr(self, "target_name")
100-
if hasattr(self, "class_labels"):
100+
if hasattr(self, "class_labels") and getattr(self, "class_labels") is not None:
101101
fields["# of Classes"] = len(getattr(self, "class_labels"))
102102
if hasattr(self, "cost_matrix"):
103103
fields["Cost Matrix"] = "Available"

0 commit comments

Comments
 (0)