|
53 | 53 | # convenience to end-users. All supplied values will be |
54 | 54 | # internally converted to a tuple of `Hashable`'s before |
55 | 55 | # use |
56 | | -KeysCollection = Union[Collection[Hashable], Hashable] |
| 56 | +KeysCollection = Collection[Hashable] | Hashable |
57 | 57 |
|
58 | 58 | #: IndexSelection |
59 | 59 | # |
60 | 60 | # The IndexSelection type is used to for defining variables |
61 | 61 | # that store a subset of indices to select items from a List or Array like objects. |
62 | 62 | # The indices must be integers, and if a container of indices is specified, the |
63 | 63 | # container must be iterable. |
64 | | -IndexSelection = Union[Iterable[int], int] |
| 64 | +IndexSelection = Iterable[int] | int |
65 | 65 |
|
66 | 66 | #: Type of datatypes: Adapted from https://github.com/numpy/numpy/blob/v1.21.4/numpy/typing/_dtype_like.py#L121 |
67 | | -DtypeLike = Union[np.dtype, type, str, None] |
| 67 | +DtypeLike = np.dtype | type | str | None |
68 | 68 |
|
69 | 69 | #: NdarrayOrTensor: Union of numpy.ndarray and torch.Tensor to be used for typing |
70 | | -NdarrayOrTensor = Union[np.ndarray, torch.Tensor] |
| 70 | +NdarrayOrTensor = np.ndarray | torch.Tensor |
71 | 71 |
|
72 | 72 | #: NdarrayTensor |
73 | 73 | # |
|
76 | 76 | NdarrayTensor = TypeVar("NdarrayTensor", bound=NdarrayOrTensor) |
77 | 77 |
|
78 | 78 | #: TensorOrList: The TensorOrList type is used for defining `batch-first Tensor` or `list of channel-first Tensor`. |
79 | | -TensorOrList = Union[torch.Tensor, Sequence[torch.Tensor]] |
| 79 | +TensorOrList = torch.Tensor | Sequence[torch.Tensor] |
80 | 80 |
|
81 | 81 | #: PathLike: The PathLike type is used for defining a file path. |
82 | | -PathLike = Union[str, os.PathLike] |
| 82 | +PathLike = str | os.PathLike |
83 | 83 |
|
84 | 84 | #: SequenceStr |
85 | 85 | # string or a sequence of strings for `mode` types. |
86 | | -SequenceStr = Union[Sequence[str], str] |
| 86 | +SequenceStr = Sequence[str] | str |
0 commit comments