Skip to content

Commit

Permalink
Updated type check
Browse files Browse the repository at this point in the history
  • Loading branch information
Pringled committed Feb 16, 2025
1 parent eccec80 commit f9037d9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions model2vec/train/classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,9 @@ def _initialize(self, y: LabelType) -> None:
:raises ValueError: If the labels are inconsistent.
"""
if isinstance(y[0], (str, int)):
# Check if all labels are strings.
# Check if all labels are strings or integers.
if not all(isinstance(label, (str | int)) for label in y):
raise ValueError("Inconsistent label types in y. All labels must be strings.")
raise ValueError("Inconsistent label types in y. All labels must be strings or integers.")

Check warning on line 236 in model2vec/train/classifier.py

View check run for this annotation

Codecov / codecov/patch

model2vec/train/classifier.py#L236

Added line #L236 was not covered by tests
self.multilabel = False
classes = sorted(set(y))
else:
Expand Down

0 comments on commit f9037d9

Please sign in to comment.