Skip to content

Commit 13a9fff

Browse files
committed
Keep using Union
1 parent 54ef25b commit 13a9fff

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

coloraide/types.py

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"""Typing."""
33
from __future__ import annotations
44
import sys
5-
from typing import Union, Any, Mapping, Sequence, TypeVar, TYPE_CHECKING
5+
from typing import Union, Any, Mapping, Sequence, List, Tuple, TypeVar, TYPE_CHECKING
66
if (3, 11) <= sys.version_info:
77
from typing import Unpack
88
else:
@@ -13,38 +13,38 @@
1313
ColorInput = Union['Color', str, Mapping[str, Any]]
1414

1515
# Vectors, Matrices, and Arrays are assumed to be mutable lists
16-
Vector = list[float]
17-
Matrix = list[Vector]
18-
Tensor = list[list[list[float | Any]]]
19-
Array = Matrix | Vector | Tensor
16+
Vector = List[float]
17+
Matrix = List[Vector]
18+
Tensor = List[List[List[Union[float, Any]]]]
19+
Array = Union[Matrix, Vector, Tensor]
2020

2121
# Anything that resembles a sequence will be considered "like" one of our types above
2222
VectorLike = Sequence[float]
2323
MatrixLike = Sequence[VectorLike]
24-
TensorLike = Sequence[Sequence[Sequence[float | Any]]]
25-
ArrayLike = VectorLike | MatrixLike | TensorLike
24+
TensorLike = Sequence[Sequence[Sequence[Union[float, Any]]]]
25+
ArrayLike = Union[VectorLike, MatrixLike, TensorLike]
2626

2727
# Vectors, Matrices, and Arrays of various, specific types
28-
VectorBool = list[bool]
29-
MatrixBool = list[VectorBool]
30-
TensorBool = list[list[list[bool | Any]]]
31-
ArrayBool = MatrixBool | VectorBool | TensorBool
28+
VectorBool = List[bool]
29+
MatrixBool = List[VectorBool]
30+
TensorBool = List[List[List[Union[bool, Any]]]]
31+
ArrayBool = Union[MatrixBool, VectorBool, TensorBool]
3232

33-
VectorInt = list[int]
34-
MatrixInt = list[VectorInt]
35-
TensorInt = list[list[list[int | Any]]]
36-
ArrayInt = MatrixInt | VectorInt | TensorInt
33+
VectorInt = List[int]
34+
MatrixInt = List[VectorInt]
35+
TensorInt = List[List[List[Union[int, Any]]]]
36+
ArrayInt = Union[MatrixInt, VectorInt, TensorInt]
3737

3838
# General algebra types
39-
FloatShape = tuple[()]
40-
VectorShape = tuple[int]
41-
MatrixShape = tuple[int, int]
42-
TensorShape = tuple[int, int, int, Unpack[tuple[int, ...]]]
39+
FloatShape = Tuple[()]
40+
VectorShape = Tuple[int]
41+
MatrixShape = Tuple[int, int]
42+
TensorShape = Tuple[int, int, int, Unpack[Tuple[int, ...]]]
4343

44-
ArrayShape = tuple[int, ...]
45-
Shape = FloatShape | ArrayShape
44+
ArrayShape = Tuple[int, ...]
45+
Shape = Union[FloatShape, ArrayShape]
4646
ShapeLike = Sequence[int]
47-
DimHints = tuple[int, int]
47+
DimHints = Tuple[int, int]
4848

4949
# For times when we must explicitly say we support `int` and `float`
5050
SupportsFloatOrInt = TypeVar('SupportsFloatOrInt', float, int)

0 commit comments

Comments
 (0)