|
1 |
| -from typing import Tuple, List |
| 1 | +"""Define types used for array-like data.""" |
| 2 | +from typing import TypeVar |
2 | 3 |
|
3 |
| -Vector3D = Tuple[float, float, float] |
| 4 | +Vector3D = TypeVar("Vector3D", bound=tuple[float, float, float]) |
4 | 5 | Vector3D.__doc__ = "Real space vector" # type: ignore
|
5 | 6 |
|
6 |
| -Matrix3D = Tuple[Vector3D, Vector3D, Vector3D] |
| 7 | +Matrix3D = TypeVar("Matrix3D", bound = tuple[Vector3D, Vector3D, Vector3D]) |
7 | 8 | Matrix3D.__doc__ = "Real space Matrix" # type: ignore
|
8 | 9 |
|
9 |
| -Vector6D = Tuple[float, float, float, float, float, float] |
| 10 | +Vector6D = TypeVar("Vector6D", bound=tuple[float, float, float, float, float, float]) |
10 | 11 | Vector6D.__doc__ = "6D Voigt matrix component" # type: ignore
|
11 | 12 |
|
12 |
| -MatrixVoigt = Tuple[Vector6D, Vector6D, Vector6D, Vector6D, Vector6D, Vector6D] |
13 |
| -Vector6D.__doc__ = "Voigt representation of a 3x3x3x3 tensor" # type: ignore |
| 13 | +MatrixVoigt = TypeVar("MatrixVoigt",bound=tuple[Vector6D, Vector6D, Vector6D, Vector6D, Vector6D, Vector6D]) |
| 14 | +MatrixVoigt.__doc__ = "Voigt representation of a 3x3x3x3 tensor" # type: ignore |
14 | 15 |
|
15 |
| -Tensor3R = List[List[List[float]]] |
| 16 | +Tensor3R = TypeVar("Tensor3R",bound=list[list[list[float]]]) |
16 | 17 | Tensor3R.__doc__ = "Generic tensor of rank 3" # type: ignore
|
17 | 18 |
|
18 |
| -Tensor4R = List[List[List[List[float]]]] |
| 19 | +Tensor4R = TypeVar("Tensor4R",bound=list[list[list[list[float]]]]) |
19 | 20 | Tensor4R.__doc__ = "Generic tensor of rank 4" # type: ignore
|
20 | 21 |
|
21 |
| -ListVector3D = List[float] |
| 22 | +ListVector3D = TypeVar("ListVector3D",bound=list[float]) |
22 | 23 | ListVector3D.__doc__ = "Real space vector as list" # type: ignore
|
23 | 24 |
|
24 |
| -ListMatrix3D = List[ListVector3D] |
| 25 | +ListMatrix3D = TypeVar("ListMatrix3D",bound=list[ListVector3D]) |
25 | 26 | ListMatrix3D.__doc__ = "Real space Matrix as list" # type: ignore
|
0 commit comments