Skip to content

Commit f1528cb

Browse files
committed
import Union for 3.9
1 parent 8ffa626 commit f1528cb

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

model2vec/inference/model.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import re
44
from pathlib import Path
55
from tempfile import TemporaryDirectory
6-
from typing import Sequence, TypeVar, cast
6+
from typing import Sequence, TypeVar, Union, cast
77

88
import huggingface_hub
99
import numpy as np
@@ -293,7 +293,7 @@ def evaluate_single_or_multi_label(
293293
"""
294294
if _is_multi_label_shaped(y):
295295
# Cast because the type checker doesn't understand that y is a list of lists.
296-
y = cast(list[list[str]] | list[list[int]], y)
296+
y = cast(Union[list[list[str]], list[list[int]]], y)
297297
classes = sorted(set([label for labels in y for label in labels]))
298298
mlb = MultiLabelBinarizer(classes=classes)
299299
y_transformed = mlb.fit_transform(y)

0 commit comments

Comments
 (0)