Coverage for gpaw/typing.py: 86%

22 statements  

« prev     ^ index     » next       coverage.py v7.7.1, created at 2025-07-20 00:19 +0000

1from typing import Any, Union, Sequence 

2import numpy as np 

3 

4try: 

5 # New in Python-3.11 

6 from typing_extension import Self 

7except ImportError: 

8 Self = Any # type: ignore 

9 

10try: 

11 # Needs numpy-1.20: 

12 from numpy.typing import ArrayLike, DTypeLike 

13except ImportError: 

14 ArrayLike = Any # type: ignore 

15 DTypeLike = Any # type: ignore 

16 

17ArrayLike1D = ArrayLike 

18ArrayLike2D = ArrayLike 

19ArrayLike3D = ArrayLike 

20 

21ArrayND = np.ndarray 

22Array1D = ArrayND 

23Array2D = ArrayND 

24Array3D = ArrayND 

25Array4D = ArrayND 

26 

27# Used for sequences of three numbers: 

28Vector = Union[Sequence[float], Array1D] 

29IntVector = Union[Sequence[int], Array1D] 

30 

31RNG = np.random.Generator