|
1 | 1 | from enum import Enum
|
2 |
| -from typing import Annotated, Any, Literal, Optional, Tuple, Union |
| 2 | +from typing import Annotated, Any, Literal, Optional |
3 | 3 |
|
4 | 4 | import numpy as np
|
5 | 5 | from pydantic import (
|
|
19 | 19 | A split is defined by a sequence of integers.
|
20 | 20 | """
|
21 | 21 |
|
22 |
| -SplitType: TypeAlias = tuple[SplitIndicesType, Union[SplitIndicesType, dict[str, SplitIndicesType]]] |
| 22 | +SplitType: TypeAlias = tuple[SplitIndicesType, SplitIndicesType | dict[str, SplitIndicesType]] |
23 | 23 | """
|
24 | 24 | A split is a pair of which the first item is always assumed to be the train set.
|
25 | 25 | The second item can either be a single test set or a dictionary with multiple, named test sets.
|
|
47 | 47 | that looks like {"test_set_name": {"target_name": np.ndarray}}.
|
48 | 48 | """
|
49 | 49 |
|
50 |
| -DatapointPartType = Union[Any, tuple[Any], dict[str, Any]] |
| 50 | +DatapointPartType = Any | tuple[Any] | dict[str, Any] |
51 | 51 | DatapointType: TypeAlias = tuple[DatapointPartType, DatapointPartType]
|
52 | 52 | """
|
53 | 53 | A datapoint has:
|
|
109 | 109 | Type to specify access to a dataset, benchmark or result in the Hub.
|
110 | 110 | """
|
111 | 111 |
|
112 |
| -TimeoutTypes = Union[Tuple[int, int], Literal["timeout", "never"]] |
| 112 | +TimeoutTypes = tuple[int, int] | Literal["timeout", "never"] |
113 | 113 | """
|
114 | 114 | Timeout types for specifying maximum wait times.
|
115 | 115 | """
|
|
150 | 150 | - A single row, e.g. dataset[0]
|
151 | 151 | - Specify a specific value, e.g. dataset[0, "col1"]
|
152 | 152 |
|
153 |
| -There are more exciting options we could implement, such as slicing, |
| 153 | +There are more exciting options we could implement, such as slicing, |
154 | 154 | but this gets complex.
|
155 | 155 | """
|
156 | 156 |
|
|
0 commit comments