QPromaQ commited on
Commit
0d2331d
·
verified ·
1 Parent(s): f6b2771

Reset repository and upload final project (part 10)

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +10 -0
  2. .venv_haddock/lib/python3.12/site-packages/numpy/_typing/_array_like.py +106 -0
  3. .venv_haddock/lib/python3.12/site-packages/numpy/_typing/_char_codes.py +213 -0
  4. .venv_haddock/lib/python3.12/site-packages/numpy/_typing/_dtype_like.py +114 -0
  5. .venv_haddock/lib/python3.12/site-packages/numpy/_typing/_extended_precision.py +15 -0
  6. .venv_haddock/lib/python3.12/site-packages/numpy/_typing/_nbit.py +19 -0
  7. .venv_haddock/lib/python3.12/site-packages/numpy/_typing/_nbit_base.py +94 -0
  8. .venv_haddock/lib/python3.12/site-packages/numpy/_typing/_nbit_base.pyi +39 -0
  9. .venv_haddock/lib/python3.12/site-packages/numpy/_typing/_nested_sequence.py +79 -0
  10. .venv_haddock/lib/python3.12/site-packages/numpy/_typing/_scalars.py +20 -0
  11. .venv_haddock/lib/python3.12/site-packages/numpy/_typing/_shape.py +8 -0
  12. .venv_haddock/lib/python3.12/site-packages/numpy/_typing/_ufunc.py +7 -0
  13. .venv_haddock/lib/python3.12/site-packages/numpy/_typing/_ufunc.pyi +975 -0
  14. .venv_haddock/lib/python3.12/site-packages/numpy/_utils/.___init__.py +0 -0
  15. .venv_haddock/lib/python3.12/site-packages/numpy/_utils/.___init__.pyi +0 -0
  16. .venv_haddock/lib/python3.12/site-packages/numpy/_utils/.___pycache__ +0 -0
  17. .venv_haddock/lib/python3.12/site-packages/numpy/_utils/.__convertions.py +0 -0
  18. .venv_haddock/lib/python3.12/site-packages/numpy/_utils/.__convertions.pyi +0 -0
  19. .venv_haddock/lib/python3.12/site-packages/numpy/_utils/.__inspect.py +0 -0
  20. .venv_haddock/lib/python3.12/site-packages/numpy/_utils/.__inspect.pyi +0 -0
  21. .venv_haddock/lib/python3.12/site-packages/numpy/_utils/.__pep440.py +0 -0
  22. .venv_haddock/lib/python3.12/site-packages/numpy/_utils/.__pep440.pyi +0 -0
  23. .venv_haddock/lib/python3.12/site-packages/numpy/_utils/__init__.py +95 -0
  24. .venv_haddock/lib/python3.12/site-packages/numpy/_utils/__init__.pyi +28 -0
  25. .venv_haddock/lib/python3.12/site-packages/numpy/_utils/_convertions.py +18 -0
  26. .venv_haddock/lib/python3.12/site-packages/numpy/_utils/_convertions.pyi +4 -0
  27. .venv_haddock/lib/python3.12/site-packages/numpy/_utils/_inspect.py +192 -0
  28. .venv_haddock/lib/python3.12/site-packages/numpy/_utils/_inspect.pyi +70 -0
  29. .venv_haddock/lib/python3.12/site-packages/numpy/_utils/_pep440.py +486 -0
  30. .venv_haddock/lib/python3.12/site-packages/numpy/_utils/_pep440.pyi +118 -0
  31. .venv_haddock/lib/python3.12/site-packages/numpy/char/.___init__.py +0 -0
  32. .venv_haddock/lib/python3.12/site-packages/numpy/char/.___init__.pyi +0 -0
  33. .venv_haddock/lib/python3.12/site-packages/numpy/char/.___pycache__ +0 -0
  34. .venv_haddock/lib/python3.12/site-packages/numpy/char/__init__.py +2 -0
  35. .venv_haddock/lib/python3.12/site-packages/numpy/char/__init__.pyi +111 -0
  36. .venv_haddock/lib/python3.12/site-packages/numpy/conftest.py +248 -0
  37. .venv_haddock/lib/python3.12/site-packages/numpy/core/.___init__.py +0 -0
  38. .venv_haddock/lib/python3.12/site-packages/numpy/core/.___init__.pyi +0 -0
  39. .venv_haddock/lib/python3.12/site-packages/numpy/core/.___pycache__ +0 -0
  40. .venv_haddock/lib/python3.12/site-packages/numpy/core/.__dtype.py +0 -0
  41. .venv_haddock/lib/python3.12/site-packages/numpy/core/.__dtype.pyi +0 -0
  42. .venv_haddock/lib/python3.12/site-packages/numpy/core/.__dtype_ctypes.py +0 -0
  43. .venv_haddock/lib/python3.12/site-packages/numpy/core/.__dtype_ctypes.pyi +0 -0
  44. .venv_haddock/lib/python3.12/site-packages/numpy/core/.__internal.py +0 -0
  45. .venv_haddock/lib/python3.12/site-packages/numpy/core/.__multiarray_umath.py +0 -0
  46. .venv_haddock/lib/python3.12/site-packages/numpy/core/.__utils.py +0 -0
  47. .venv_haddock/lib/python3.12/site-packages/numpy/core/._arrayprint.py +0 -0
  48. .venv_haddock/lib/python3.12/site-packages/numpy/core/._defchararray.py +0 -0
  49. .venv_haddock/lib/python3.12/site-packages/numpy/core/._einsumfunc.py +0 -0
  50. .venv_haddock/lib/python3.12/site-packages/numpy/core/._fromnumeric.py +0 -0
.gitattributes CHANGED
@@ -71,3 +71,13 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
71
  .venv_haddock/lib/python3.12/site-packages/numpy/_core/_multiarray_tests.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
72
  .venv_haddock/lib/python3.12/site-packages/numpy/_core/_multiarray_umath.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
73
  .venv_haddock/lib/python3.12/site-packages/numpy/_core/_simd.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
71
  .venv_haddock/lib/python3.12/site-packages/numpy/_core/_multiarray_tests.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
72
  .venv_haddock/lib/python3.12/site-packages/numpy/_core/_multiarray_umath.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
73
  .venv_haddock/lib/python3.12/site-packages/numpy/_core/_simd.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
74
+ .venv_haddock/lib/python3.12/site-packages/numpy/fft/_pocketfft_umath.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
75
+ .venv_haddock/lib/python3.12/site-packages/numpy/linalg/_umath_linalg.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
76
+ .venv_haddock/lib/python3.12/site-packages/numpy/random/_bounded_integers.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
77
+ .venv_haddock/lib/python3.12/site-packages/numpy/random/_common.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
78
+ .venv_haddock/lib/python3.12/site-packages/numpy/random/_generator.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
79
+ .venv_haddock/lib/python3.12/site-packages/numpy/random/_mt19937.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
80
+ .venv_haddock/lib/python3.12/site-packages/numpy/random/_pcg64.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
81
+ .venv_haddock/lib/python3.12/site-packages/numpy/random/_philox.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
82
+ .venv_haddock/lib/python3.12/site-packages/numpy/random/bit_generator.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
83
+ .venv_haddock/lib/python3.12/site-packages/numpy/random/mtrand.cpython-312-darwin.so filter=lfs diff=lfs merge=lfs -text
.venv_haddock/lib/python3.12/site-packages/numpy/_typing/_array_like.py ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import sys
2
+ from collections.abc import Callable, Collection, Sequence
3
+ from typing import TYPE_CHECKING, Any, Protocol, TypeAlias, TypeVar, runtime_checkable
4
+
5
+ import numpy as np
6
+ from numpy import dtype
7
+
8
+ from ._nbit_base import _32Bit, _64Bit
9
+ from ._nested_sequence import _NestedSequence
10
+ from ._shape import _AnyShape
11
+
12
+ if TYPE_CHECKING:
13
+ StringDType = np.dtypes.StringDType
14
+ else:
15
+ # at runtime outside of type checking importing this from numpy.dtypes
16
+ # would lead to a circular import
17
+ from numpy._core.multiarray import StringDType
18
+
19
+ _T = TypeVar("_T")
20
+ _ScalarT = TypeVar("_ScalarT", bound=np.generic)
21
+ _DTypeT = TypeVar("_DTypeT", bound=dtype[Any])
22
+ _DTypeT_co = TypeVar("_DTypeT_co", covariant=True, bound=dtype[Any])
23
+
24
+ NDArray: TypeAlias = np.ndarray[_AnyShape, dtype[_ScalarT]]
25
+
26
+ # The `_SupportsArray` protocol only cares about the default dtype
27
+ # (i.e. `dtype=None` or no `dtype` parameter at all) of the to-be returned
28
+ # array.
29
+ # Concrete implementations of the protocol are responsible for adding
30
+ # any and all remaining overloads
31
+ @runtime_checkable
32
+ class _SupportsArray(Protocol[_DTypeT_co]):
33
+ def __array__(self) -> np.ndarray[Any, _DTypeT_co]: ...
34
+
35
+
36
+ @runtime_checkable
37
+ class _SupportsArrayFunc(Protocol):
38
+ """A protocol class representing `~class.__array_function__`."""
39
+ def __array_function__(
40
+ self,
41
+ func: Callable[..., Any],
42
+ types: Collection[type[Any]],
43
+ args: tuple[Any, ...],
44
+ kwargs: dict[str, Any],
45
+ ) -> object: ...
46
+
47
+
48
+ # TODO: Wait until mypy supports recursive objects in combination with typevars
49
+ _FiniteNestedSequence: TypeAlias = (
50
+ _T
51
+ | Sequence[_T]
52
+ | Sequence[Sequence[_T]]
53
+ | Sequence[Sequence[Sequence[_T]]]
54
+ | Sequence[Sequence[Sequence[Sequence[_T]]]]
55
+ )
56
+
57
+ # A subset of `npt.ArrayLike` that can be parametrized w.r.t. `np.generic`
58
+ _ArrayLike: TypeAlias = (
59
+ _SupportsArray[dtype[_ScalarT]]
60
+ | _NestedSequence[_SupportsArray[dtype[_ScalarT]]]
61
+ )
62
+
63
+ # A union representing array-like objects; consists of two typevars:
64
+ # One representing types that can be parametrized w.r.t. `np.dtype`
65
+ # and another one for the rest
66
+ _DualArrayLike: TypeAlias = (
67
+ _SupportsArray[_DTypeT]
68
+ | _NestedSequence[_SupportsArray[_DTypeT]]
69
+ | _T
70
+ | _NestedSequence[_T]
71
+ )
72
+
73
+ if sys.version_info >= (3, 12):
74
+ from collections.abc import Buffer as _Buffer
75
+ else:
76
+ @runtime_checkable
77
+ class _Buffer(Protocol):
78
+ def __buffer__(self, flags: int, /) -> memoryview: ...
79
+
80
+ ArrayLike: TypeAlias = _Buffer | _DualArrayLike[dtype[Any], complex | bytes | str]
81
+
82
+ # `ArrayLike<X>_co`: array-like objects that can be coerced into `X`
83
+ # given the casting rules `same_kind`
84
+ _ArrayLikeBool_co: TypeAlias = _DualArrayLike[dtype[np.bool], bool]
85
+ _ArrayLikeUInt_co: TypeAlias = _DualArrayLike[dtype[np.bool | np.unsignedinteger], bool]
86
+ _ArrayLikeInt_co: TypeAlias = _DualArrayLike[dtype[np.bool | np.integer], int]
87
+ _ArrayLikeFloat_co: TypeAlias = _DualArrayLike[dtype[np.bool | np.integer | np.floating], float]
88
+ _ArrayLikeComplex_co: TypeAlias = _DualArrayLike[dtype[np.bool | np.number], complex]
89
+ _ArrayLikeNumber_co: TypeAlias = _ArrayLikeComplex_co
90
+ _ArrayLikeTD64_co: TypeAlias = _DualArrayLike[dtype[np.bool | np.integer | np.timedelta64], int]
91
+ _ArrayLikeDT64_co: TypeAlias = _ArrayLike[np.datetime64]
92
+ _ArrayLikeObject_co: TypeAlias = _ArrayLike[np.object_]
93
+
94
+ _ArrayLikeVoid_co: TypeAlias = _ArrayLike[np.void]
95
+ _ArrayLikeBytes_co: TypeAlias = _DualArrayLike[dtype[np.bytes_], bytes]
96
+ _ArrayLikeStr_co: TypeAlias = _DualArrayLike[dtype[np.str_], str]
97
+ _ArrayLikeString_co: TypeAlias = _DualArrayLike[StringDType, str]
98
+ _ArrayLikeAnyString_co: TypeAlias = _DualArrayLike[dtype[np.character] | StringDType, bytes | str]
99
+
100
+ __Float64_co: TypeAlias = np.floating[_64Bit] | np.float32 | np.float16 | np.integer | np.bool
101
+ __Complex128_co: TypeAlias = np.number[_64Bit] | np.number[_32Bit] | np.float16 | np.integer | np.bool
102
+ _ArrayLikeFloat64_co: TypeAlias = _DualArrayLike[dtype[__Float64_co], float]
103
+ _ArrayLikeComplex128_co: TypeAlias = _DualArrayLike[dtype[__Complex128_co], complex]
104
+
105
+ # NOTE: This includes `builtins.bool`, but not `numpy.bool`.
106
+ _ArrayLikeInt: TypeAlias = _DualArrayLike[dtype[np.integer], int]
.venv_haddock/lib/python3.12/site-packages/numpy/_typing/_char_codes.py ADDED
@@ -0,0 +1,213 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Literal
2
+
3
+ _BoolCodes = Literal[
4
+ "bool", "bool_",
5
+ "?", "|?", "=?", "<?", ">?",
6
+ "b1", "|b1", "=b1", "<b1", ">b1",
7
+ ] # fmt: skip
8
+
9
+ _UInt8Codes = Literal["uint8", "u1", "|u1", "=u1", "<u1", ">u1"]
10
+ _UInt16Codes = Literal["uint16", "u2", "|u2", "=u2", "<u2", ">u2"]
11
+ _UInt32Codes = Literal["uint32", "u4", "|u4", "=u4", "<u4", ">u4"]
12
+ _UInt64Codes = Literal["uint64", "u8", "|u8", "=u8", "<u8", ">u8"]
13
+
14
+ _Int8Codes = Literal["int8", "i1", "|i1", "=i1", "<i1", ">i1"]
15
+ _Int16Codes = Literal["int16", "i2", "|i2", "=i2", "<i2", ">i2"]
16
+ _Int32Codes = Literal["int32", "i4", "|i4", "=i4", "<i4", ">i4"]
17
+ _Int64Codes = Literal["int64", "i8", "|i8", "=i8", "<i8", ">i8"]
18
+
19
+ _Float16Codes = Literal["float16", "f2", "|f2", "=f2", "<f2", ">f2"]
20
+ _Float32Codes = Literal["float32", "f4", "|f4", "=f4", "<f4", ">f4"]
21
+ _Float64Codes = Literal["float64", "f8", "|f8", "=f8", "<f8", ">f8"]
22
+
23
+ _Complex64Codes = Literal["complex64", "c8", "|c8", "=c8", "<c8", ">c8"]
24
+ _Complex128Codes = Literal["complex128", "c16", "|c16", "=c16", "<c16", ">c16"]
25
+
26
+ _ByteCodes = Literal["byte", "b", "|b", "=b", "<b", ">b"]
27
+ _ShortCodes = Literal["short", "h", "|h", "=h", "<h", ">h"]
28
+ _IntCCodes = Literal["intc", "i", "|i", "=i", "<i", ">i"]
29
+ _IntPCodes = Literal["intp", "int", "int_", "n", "|n", "=n", "<n", ">n"]
30
+ _LongCodes = Literal["long", "l", "|l", "=l", "<l", ">l"]
31
+ _IntCodes = _IntPCodes
32
+ _LongLongCodes = Literal["longlong", "q", "|q", "=q", "<q", ">q"]
33
+
34
+ _UByteCodes = Literal["ubyte", "B", "|B", "=B", "<B", ">B"]
35
+ _UShortCodes = Literal["ushort", "H", "|H", "=H", "<H", ">H"]
36
+ _UIntCCodes = Literal["uintc", "I", "|I", "=I", "<I", ">I"]
37
+ _UIntPCodes = Literal["uintp", "uint", "N", "|N", "=N", "<N", ">N"]
38
+ _ULongCodes = Literal["ulong", "L", "|L", "=L", "<L", ">L"]
39
+ _UIntCodes = _UIntPCodes
40
+ _ULongLongCodes = Literal["ulonglong", "Q", "|Q", "=Q", "<Q", ">Q"]
41
+
42
+ _HalfCodes = Literal["half", "e", "|e", "=e", "<e", ">e"]
43
+ _SingleCodes = Literal["single", "f", "|f", "=f", "<f", ">f"]
44
+ _DoubleCodes = Literal["double", "float", "d", "|d", "=d", "<d", ">d"]
45
+ _LongDoubleCodes = Literal["longdouble", "g", "|g", "=g", "<g", ">g"]
46
+
47
+ _CSingleCodes = Literal["csingle", "F", "|F", "=F", "<F", ">F"]
48
+ _CDoubleCodes = Literal["cdouble", "complex", "D", "|D", "=D", "<D", ">D"]
49
+ _CLongDoubleCodes = Literal["clongdouble", "G", "|G", "=G", "<G", ">G"]
50
+
51
+ _StrCodes = Literal["str", "str_", "unicode", "U", "|U", "=U", "<U", ">U"]
52
+ _BytesCodes = Literal["bytes", "bytes_", "S", "|S", "=S", "<S", ">S"]
53
+ _VoidCodes = Literal["void", "V", "|V", "=V", "<V", ">V"]
54
+ _ObjectCodes = Literal["object", "object_", "O", "|O", "=O", "<O", ">O"]
55
+
56
+ _DT64Codes = Literal[
57
+ "datetime64", "|datetime64", "=datetime64",
58
+ "<datetime64", ">datetime64",
59
+ "datetime64[Y]", "|datetime64[Y]", "=datetime64[Y]",
60
+ "<datetime64[Y]", ">datetime64[Y]",
61
+ "datetime64[M]", "|datetime64[M]", "=datetime64[M]",
62
+ "<datetime64[M]", ">datetime64[M]",
63
+ "datetime64[W]", "|datetime64[W]", "=datetime64[W]",
64
+ "<datetime64[W]", ">datetime64[W]",
65
+ "datetime64[D]", "|datetime64[D]", "=datetime64[D]",
66
+ "<datetime64[D]", ">datetime64[D]",
67
+ "datetime64[h]", "|datetime64[h]", "=datetime64[h]",
68
+ "<datetime64[h]", ">datetime64[h]",
69
+ "datetime64[m]", "|datetime64[m]", "=datetime64[m]",
70
+ "<datetime64[m]", ">datetime64[m]",
71
+ "datetime64[s]", "|datetime64[s]", "=datetime64[s]",
72
+ "<datetime64[s]", ">datetime64[s]",
73
+ "datetime64[ms]", "|datetime64[ms]", "=datetime64[ms]",
74
+ "<datetime64[ms]", ">datetime64[ms]",
75
+ "datetime64[us]", "|datetime64[us]", "=datetime64[us]",
76
+ "<datetime64[us]", ">datetime64[us]",
77
+ "datetime64[ns]", "|datetime64[ns]", "=datetime64[ns]",
78
+ "<datetime64[ns]", ">datetime64[ns]",
79
+ "datetime64[ps]", "|datetime64[ps]", "=datetime64[ps]",
80
+ "<datetime64[ps]", ">datetime64[ps]",
81
+ "datetime64[fs]", "|datetime64[fs]", "=datetime64[fs]",
82
+ "<datetime64[fs]", ">datetime64[fs]",
83
+ "datetime64[as]", "|datetime64[as]", "=datetime64[as]",
84
+ "<datetime64[as]", ">datetime64[as]",
85
+ "M", "|M", "=M", "<M", ">M",
86
+ "M8", "|M8", "=M8", "<M8", ">M8",
87
+ "M8[Y]", "|M8[Y]", "=M8[Y]", "<M8[Y]", ">M8[Y]",
88
+ "M8[M]", "|M8[M]", "=M8[M]", "<M8[M]", ">M8[M]",
89
+ "M8[W]", "|M8[W]", "=M8[W]", "<M8[W]", ">M8[W]",
90
+ "M8[D]", "|M8[D]", "=M8[D]", "<M8[D]", ">M8[D]",
91
+ "M8[h]", "|M8[h]", "=M8[h]", "<M8[h]", ">M8[h]",
92
+ "M8[m]", "|M8[m]", "=M8[m]", "<M8[m]", ">M8[m]",
93
+ "M8[s]", "|M8[s]", "=M8[s]", "<M8[s]", ">M8[s]",
94
+ "M8[ms]", "|M8[ms]", "=M8[ms]", "<M8[ms]", ">M8[ms]",
95
+ "M8[us]", "|M8[us]", "=M8[us]", "<M8[us]", ">M8[us]",
96
+ "M8[ns]", "|M8[ns]", "=M8[ns]", "<M8[ns]", ">M8[ns]",
97
+ "M8[ps]", "|M8[ps]", "=M8[ps]", "<M8[ps]", ">M8[ps]",
98
+ "M8[fs]", "|M8[fs]", "=M8[fs]", "<M8[fs]", ">M8[fs]",
99
+ "M8[as]", "|M8[as]", "=M8[as]", "<M8[as]", ">M8[as]",
100
+ ]
101
+ _TD64Codes = Literal[
102
+ "timedelta64", "|timedelta64", "=timedelta64",
103
+ "<timedelta64", ">timedelta64",
104
+ "timedelta64[Y]", "|timedelta64[Y]", "=timedelta64[Y]",
105
+ "<timedelta64[Y]", ">timedelta64[Y]",
106
+ "timedelta64[M]", "|timedelta64[M]", "=timedelta64[M]",
107
+ "<timedelta64[M]", ">timedelta64[M]",
108
+ "timedelta64[W]", "|timedelta64[W]", "=timedelta64[W]",
109
+ "<timedelta64[W]", ">timedelta64[W]",
110
+ "timedelta64[D]", "|timedelta64[D]", "=timedelta64[D]",
111
+ "<timedelta64[D]", ">timedelta64[D]",
112
+ "timedelta64[h]", "|timedelta64[h]", "=timedelta64[h]",
113
+ "<timedelta64[h]", ">timedelta64[h]",
114
+ "timedelta64[m]", "|timedelta64[m]", "=timedelta64[m]",
115
+ "<timedelta64[m]", ">timedelta64[m]",
116
+ "timedelta64[s]", "|timedelta64[s]", "=timedelta64[s]",
117
+ "<timedelta64[s]", ">timedelta64[s]",
118
+ "timedelta64[ms]", "|timedelta64[ms]", "=timedelta64[ms]",
119
+ "<timedelta64[ms]", ">timedelta64[ms]",
120
+ "timedelta64[us]", "|timedelta64[us]", "=timedelta64[us]",
121
+ "<timedelta64[us]", ">timedelta64[us]",
122
+ "timedelta64[ns]", "|timedelta64[ns]", "=timedelta64[ns]",
123
+ "<timedelta64[ns]", ">timedelta64[ns]",
124
+ "timedelta64[ps]", "|timedelta64[ps]", "=timedelta64[ps]",
125
+ "<timedelta64[ps]", ">timedelta64[ps]",
126
+ "timedelta64[fs]", "|timedelta64[fs]", "=timedelta64[fs]",
127
+ "<timedelta64[fs]", ">timedelta64[fs]",
128
+ "timedelta64[as]", "|timedelta64[as]", "=timedelta64[as]",
129
+ "<timedelta64[as]", ">timedelta64[as]",
130
+ "m", "|m", "=m", "<m", ">m",
131
+ "m8", "|m8", "=m8", "<m8", ">m8",
132
+ "m8[Y]", "|m8[Y]", "=m8[Y]", "<m8[Y]", ">m8[Y]",
133
+ "m8[M]", "|m8[M]", "=m8[M]", "<m8[M]", ">m8[M]",
134
+ "m8[W]", "|m8[W]", "=m8[W]", "<m8[W]", ">m8[W]",
135
+ "m8[D]", "|m8[D]", "=m8[D]", "<m8[D]", ">m8[D]",
136
+ "m8[h]", "|m8[h]", "=m8[h]", "<m8[h]", ">m8[h]",
137
+ "m8[m]", "|m8[m]", "=m8[m]", "<m8[m]", ">m8[m]",
138
+ "m8[s]", "|m8[s]", "=m8[s]", "<m8[s]", ">m8[s]",
139
+ "m8[ms]", "|m8[ms]", "=m8[ms]", "<m8[ms]", ">m8[ms]",
140
+ "m8[us]", "|m8[us]", "=m8[us]", "<m8[us]", ">m8[us]",
141
+ "m8[ns]", "|m8[ns]", "=m8[ns]", "<m8[ns]", ">m8[ns]",
142
+ "m8[ps]", "|m8[ps]", "=m8[ps]", "<m8[ps]", ">m8[ps]",
143
+ "m8[fs]", "|m8[fs]", "=m8[fs]", "<m8[fs]", ">m8[fs]",
144
+ "m8[as]", "|m8[as]", "=m8[as]", "<m8[as]", ">m8[as]",
145
+ ]
146
+
147
+ # NOTE: `StringDType' has no scalar type, and therefore has no name that can
148
+ # be passed to the `dtype` constructor
149
+ _StringCodes = Literal["T", "|T", "=T", "<T", ">T"]
150
+
151
+ # NOTE: Nested literals get flattened and de-duplicated at runtime, which isn't
152
+ # the case for a `Union` of `Literal`s.
153
+ # So even though they're equivalent when type-checking, they differ at runtime.
154
+ # Another advantage of nesting, is that they always have a "flat"
155
+ # `Literal.__args__`, which is a tuple of *literally* all its literal values.
156
+
157
+ _UnsignedIntegerCodes = Literal[
158
+ _UInt8Codes,
159
+ _UInt16Codes,
160
+ _UInt32Codes,
161
+ _UInt64Codes,
162
+ _UIntCodes,
163
+ _UByteCodes,
164
+ _UShortCodes,
165
+ _UIntCCodes,
166
+ _ULongCodes,
167
+ _ULongLongCodes,
168
+ ]
169
+ _SignedIntegerCodes = Literal[
170
+ _Int8Codes,
171
+ _Int16Codes,
172
+ _Int32Codes,
173
+ _Int64Codes,
174
+ _IntCodes,
175
+ _ByteCodes,
176
+ _ShortCodes,
177
+ _IntCCodes,
178
+ _LongCodes,
179
+ _LongLongCodes,
180
+ ]
181
+ _FloatingCodes = Literal[
182
+ _Float16Codes,
183
+ _Float32Codes,
184
+ _Float64Codes,
185
+ _HalfCodes,
186
+ _SingleCodes,
187
+ _DoubleCodes,
188
+ _LongDoubleCodes
189
+ ]
190
+ _ComplexFloatingCodes = Literal[
191
+ _Complex64Codes,
192
+ _Complex128Codes,
193
+ _CSingleCodes,
194
+ _CDoubleCodes,
195
+ _CLongDoubleCodes,
196
+ ]
197
+ _IntegerCodes = Literal[_UnsignedIntegerCodes, _SignedIntegerCodes]
198
+ _InexactCodes = Literal[_FloatingCodes, _ComplexFloatingCodes]
199
+ _NumberCodes = Literal[_IntegerCodes, _InexactCodes]
200
+
201
+ _CharacterCodes = Literal[_StrCodes, _BytesCodes]
202
+ _FlexibleCodes = Literal[_VoidCodes, _CharacterCodes]
203
+
204
+ _GenericCodes = Literal[
205
+ _BoolCodes,
206
+ _NumberCodes,
207
+ _FlexibleCodes,
208
+ _DT64Codes,
209
+ _TD64Codes,
210
+ _ObjectCodes,
211
+ # TODO: add `_StringCodes` once it has a scalar type
212
+ # _StringCodes,
213
+ ]
.venv_haddock/lib/python3.12/site-packages/numpy/_typing/_dtype_like.py ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from collections.abc import Sequence # noqa: F811
2
+ from typing import Any, Protocol, TypeAlias, TypedDict, TypeVar
3
+
4
+ import numpy as np
5
+
6
+ from ._char_codes import (
7
+ _BoolCodes,
8
+ _BytesCodes,
9
+ _ComplexFloatingCodes,
10
+ _DT64Codes,
11
+ _FloatingCodes,
12
+ _NumberCodes,
13
+ _ObjectCodes,
14
+ _SignedIntegerCodes,
15
+ _StrCodes,
16
+ _TD64Codes,
17
+ _UnsignedIntegerCodes,
18
+ _VoidCodes,
19
+ )
20
+
21
+ _ScalarT = TypeVar("_ScalarT", bound=np.generic)
22
+ _DTypeT = TypeVar("_DTypeT", bound=np.dtype)
23
+ _DTypeT_co = TypeVar("_DTypeT_co", bound=np.dtype, covariant=True)
24
+
25
+ _DTypeLikeNested: TypeAlias = Any # TODO: wait for support for recursive types
26
+
27
+
28
+ # Mandatory keys
29
+ class _DTypeDictBase(TypedDict):
30
+ names: Sequence[str]
31
+ formats: Sequence[_DTypeLikeNested]
32
+
33
+
34
+ # Mandatory + optional keys
35
+ class _DTypeDict(_DTypeDictBase, total=False):
36
+ # Only `str` elements are usable as indexing aliases,
37
+ # but `titles` can in principle accept any object
38
+ offsets: Sequence[int]
39
+ titles: Sequence[Any]
40
+ itemsize: int
41
+ aligned: bool
42
+
43
+
44
+ class _HasDType(Protocol[_DTypeT_co]):
45
+ @property
46
+ def dtype(self) -> _DTypeT_co: ...
47
+
48
+
49
+ class _HasNumPyDType(Protocol[_DTypeT_co]):
50
+ @property
51
+ def __numpy_dtype__(self, /) -> _DTypeT_co: ...
52
+
53
+
54
+ _SupportsDType: TypeAlias = _HasDType[_DTypeT] | _HasNumPyDType[_DTypeT]
55
+
56
+
57
+ # A subset of `npt.DTypeLike` that can be parametrized w.r.t. `np.generic`
58
+ _DTypeLike: TypeAlias = type[_ScalarT] | np.dtype[_ScalarT] | _SupportsDType[np.dtype[_ScalarT]]
59
+
60
+
61
+ # Would create a dtype[np.void]
62
+ _VoidDTypeLike: TypeAlias = (
63
+ # If a tuple, then it can be either:
64
+ # - (flexible_dtype, itemsize)
65
+ # - (fixed_dtype, shape)
66
+ # - (base_dtype, new_dtype)
67
+ # But because `_DTypeLikeNested = Any`, the first two cases are redundant
68
+
69
+ # tuple[_DTypeLikeNested, int] | tuple[_DTypeLikeNested, _ShapeLike] |
70
+ tuple[_DTypeLikeNested, _DTypeLikeNested]
71
+
72
+ # [(field_name, field_dtype, field_shape), ...]
73
+ # The type here is quite broad because NumPy accepts quite a wide
74
+ # range of inputs inside the list; see the tests for some examples.
75
+ | list[Any]
76
+
77
+ # {'names': ..., 'formats': ..., 'offsets': ..., 'titles': ..., 'itemsize': ...}
78
+ | _DTypeDict
79
+ )
80
+
81
+ # Aliases for commonly used dtype-like objects.
82
+ # Note that the precision of `np.number` subclasses is ignored herein.
83
+ _DTypeLikeBool: TypeAlias = type[bool] | _DTypeLike[np.bool] | _BoolCodes
84
+ _DTypeLikeInt: TypeAlias = (
85
+ type[int] | _DTypeLike[np.signedinteger] | _SignedIntegerCodes
86
+ )
87
+ _DTypeLikeUInt: TypeAlias = _DTypeLike[np.unsignedinteger] | _UnsignedIntegerCodes
88
+ _DTypeLikeFloat: TypeAlias = type[float] | _DTypeLike[np.floating] | _FloatingCodes
89
+ _DTypeLikeComplex: TypeAlias = (
90
+ type[complex] | _DTypeLike[np.complexfloating] | _ComplexFloatingCodes
91
+ )
92
+ _DTypeLikeComplex_co: TypeAlias = (
93
+ type[complex] | _DTypeLike[np.bool | np.number] | _BoolCodes | _NumberCodes
94
+ )
95
+ _DTypeLikeDT64: TypeAlias = _DTypeLike[np.timedelta64] | _TD64Codes
96
+ _DTypeLikeTD64: TypeAlias = _DTypeLike[np.datetime64] | _DT64Codes
97
+ _DTypeLikeBytes: TypeAlias = type[bytes] | _DTypeLike[np.bytes_] | _BytesCodes
98
+ _DTypeLikeStr: TypeAlias = type[str] | _DTypeLike[np.str_] | _StrCodes
99
+ _DTypeLikeVoid: TypeAlias = (
100
+ type[memoryview] | _DTypeLike[np.void] | _VoidDTypeLike | _VoidCodes
101
+ )
102
+ _DTypeLikeObject: TypeAlias = type[object] | _DTypeLike[np.object_] | _ObjectCodes
103
+
104
+
105
+ # Anything that can be coerced into numpy.dtype.
106
+ # Reference: https://docs.scipy.org/doc/numpy/reference/arrays.dtypes.html
107
+ DTypeLike: TypeAlias = _DTypeLike[Any] | _VoidDTypeLike | str
108
+
109
+ # NOTE: while it is possible to provide the dtype as a dict of
110
+ # dtype-like objects (e.g. `{'field1': ..., 'field2': ..., ...}`),
111
+ # this syntax is officially discouraged and
112
+ # therefore not included in the type-union defining `DTypeLike`.
113
+ #
114
+ # See https://github.com/numpy/numpy/issues/16891 for more details.
.venv_haddock/lib/python3.12/site-packages/numpy/_typing/_extended_precision.py ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """A module with platform-specific extended precision
2
+ `numpy.number` subclasses.
3
+
4
+ The subclasses are defined here (instead of ``__init__.pyi``) such
5
+ that they can be imported conditionally via the numpy's mypy plugin.
6
+ """
7
+
8
+ import numpy as np
9
+
10
+ from . import _96Bit, _128Bit
11
+
12
+ float96 = np.floating[_96Bit]
13
+ float128 = np.floating[_128Bit]
14
+ complex192 = np.complexfloating[_96Bit, _96Bit]
15
+ complex256 = np.complexfloating[_128Bit, _128Bit]
.venv_haddock/lib/python3.12/site-packages/numpy/_typing/_nbit.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """A module with the precisions of platform-specific `~numpy.number`s."""
2
+
3
+ from typing import TypeAlias
4
+
5
+ from ._nbit_base import _8Bit, _16Bit, _32Bit, _64Bit, _96Bit, _128Bit
6
+
7
+ # To-be replaced with a `npt.NBitBase` subclass by numpy's mypy plugin
8
+ _NBitByte: TypeAlias = _8Bit
9
+ _NBitShort: TypeAlias = _16Bit
10
+ _NBitIntC: TypeAlias = _32Bit
11
+ _NBitIntP: TypeAlias = _32Bit | _64Bit
12
+ _NBitInt: TypeAlias = _NBitIntP
13
+ _NBitLong: TypeAlias = _32Bit | _64Bit
14
+ _NBitLongLong: TypeAlias = _64Bit
15
+
16
+ _NBitHalf: TypeAlias = _16Bit
17
+ _NBitSingle: TypeAlias = _32Bit
18
+ _NBitDouble: TypeAlias = _64Bit
19
+ _NBitLongDouble: TypeAlias = _64Bit | _96Bit | _128Bit
.venv_haddock/lib/python3.12/site-packages/numpy/_typing/_nbit_base.py ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """A module with the precisions of generic `~numpy.number` types."""
2
+ from typing import final
3
+
4
+ from numpy._utils import set_module
5
+
6
+
7
+ @final # Disallow the creation of arbitrary `NBitBase` subclasses
8
+ @set_module("numpy.typing")
9
+ class NBitBase:
10
+ """
11
+ A type representing `numpy.number` precision during static type checking.
12
+
13
+ Used exclusively for the purpose of static type checking, `NBitBase`
14
+ represents the base of a hierarchical set of subclasses.
15
+ Each subsequent subclass is herein used for representing a lower level
16
+ of precision, *e.g.* ``64Bit > 32Bit > 16Bit``.
17
+
18
+ .. versionadded:: 1.20
19
+
20
+ .. deprecated:: 2.3
21
+ Use ``@typing.overload`` or a ``TypeVar`` with a scalar-type as upper
22
+ bound, instead.
23
+
24
+ Examples
25
+ --------
26
+ Below is a typical usage example: `NBitBase` is herein used for annotating
27
+ a function that takes a float and integer of arbitrary precision
28
+ as arguments and returns a new float of whichever precision is largest
29
+ (*e.g.* ``np.float16 + np.int64 -> np.float64``).
30
+
31
+ .. code-block:: python
32
+
33
+ >>> from typing import TypeVar, TYPE_CHECKING
34
+ >>> import numpy as np
35
+ >>> import numpy.typing as npt
36
+
37
+ >>> S = TypeVar("S", bound=npt.NBitBase)
38
+ >>> T = TypeVar("T", bound=npt.NBitBase)
39
+
40
+ >>> def add(a: np.floating[S], b: np.integer[T]) -> np.floating[S | T]:
41
+ ... return a + b
42
+
43
+ >>> a = np.float16()
44
+ >>> b = np.int64()
45
+ >>> out = add(a, b)
46
+
47
+ >>> if TYPE_CHECKING:
48
+ ... reveal_locals()
49
+ ... # note: Revealed local types are:
50
+ ... # note: a: numpy.floating[numpy.typing._16Bit*]
51
+ ... # note: b: numpy.signedinteger[numpy.typing._64Bit*]
52
+ ... # note: out: numpy.floating[numpy.typing._64Bit*]
53
+
54
+ """
55
+ # Deprecated in NumPy 2.3, 2025-05-01
56
+
57
+ def __init_subclass__(cls) -> None:
58
+ allowed_names = {
59
+ "NBitBase", "_128Bit", "_96Bit", "_64Bit", "_32Bit", "_16Bit", "_8Bit"
60
+ }
61
+ if cls.__name__ not in allowed_names:
62
+ raise TypeError('cannot inherit from final class "NBitBase"')
63
+ super().__init_subclass__()
64
+
65
+ @final
66
+ @set_module("numpy._typing")
67
+ # Silence errors about subclassing a `@final`-decorated class
68
+ class _128Bit(NBitBase): # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues]
69
+ pass
70
+
71
+ @final
72
+ @set_module("numpy._typing")
73
+ class _96Bit(_128Bit): # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues]
74
+ pass
75
+
76
+ @final
77
+ @set_module("numpy._typing")
78
+ class _64Bit(_96Bit): # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues]
79
+ pass
80
+
81
+ @final
82
+ @set_module("numpy._typing")
83
+ class _32Bit(_64Bit): # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues]
84
+ pass
85
+
86
+ @final
87
+ @set_module("numpy._typing")
88
+ class _16Bit(_32Bit): # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues]
89
+ pass
90
+
91
+ @final
92
+ @set_module("numpy._typing")
93
+ class _8Bit(_16Bit): # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues]
94
+ pass
.venv_haddock/lib/python3.12/site-packages/numpy/_typing/_nbit_base.pyi ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # pyright: reportDeprecated=false
2
+ # pyright: reportGeneralTypeIssues=false
3
+ # mypy: disable-error-code=misc
4
+
5
+ from typing import final
6
+ from typing_extensions import deprecated
7
+
8
+ # Deprecated in NumPy 2.3, 2025-05-01
9
+ @deprecated(
10
+ "`NBitBase` is deprecated and will be removed from numpy.typing in the "
11
+ "future. Use `@typing.overload` or a `TypeVar` with a scalar-type as upper "
12
+ "bound, instead. (deprecated in NumPy 2.3)",
13
+ )
14
+ @final
15
+ class NBitBase: ...
16
+
17
+ @final
18
+ class _256Bit(NBitBase): ...
19
+
20
+ @final
21
+ class _128Bit(_256Bit): ...
22
+
23
+ @final
24
+ class _96Bit(_128Bit): ...
25
+
26
+ @final
27
+ class _80Bit(_96Bit): ...
28
+
29
+ @final
30
+ class _64Bit(_80Bit): ...
31
+
32
+ @final
33
+ class _32Bit(_64Bit): ...
34
+
35
+ @final
36
+ class _16Bit(_32Bit): ...
37
+
38
+ @final
39
+ class _8Bit(_16Bit): ...
.venv_haddock/lib/python3.12/site-packages/numpy/_typing/_nested_sequence.py ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """A module containing the `_NestedSequence` protocol."""
2
+
3
+ from typing import TYPE_CHECKING, Any, Protocol, TypeVar, runtime_checkable
4
+
5
+ if TYPE_CHECKING:
6
+ from collections.abc import Iterator
7
+
8
+ __all__ = ["_NestedSequence"]
9
+
10
+ _T_co = TypeVar("_T_co", covariant=True)
11
+
12
+
13
+ @runtime_checkable
14
+ class _NestedSequence(Protocol[_T_co]):
15
+ """A protocol for representing nested sequences.
16
+
17
+ Warning
18
+ -------
19
+ `_NestedSequence` currently does not work in combination with typevars,
20
+ *e.g.* ``def func(a: _NestedSequnce[T]) -> T: ...``.
21
+
22
+ See Also
23
+ --------
24
+ collections.abc.Sequence
25
+ ABCs for read-only and mutable :term:`sequences`.
26
+
27
+ Examples
28
+ --------
29
+ .. code-block:: python
30
+
31
+ >>> from typing import TYPE_CHECKING
32
+ >>> import numpy as np
33
+ >>> from numpy._typing import _NestedSequence
34
+
35
+ >>> def get_dtype(seq: _NestedSequence[float]) -> np.dtype[np.float64]:
36
+ ... return np.asarray(seq).dtype
37
+
38
+ >>> a = get_dtype([1.0])
39
+ >>> b = get_dtype([[1.0]])
40
+ >>> c = get_dtype([[[1.0]]])
41
+ >>> d = get_dtype([[[[1.0]]]])
42
+
43
+ >>> if TYPE_CHECKING:
44
+ ... reveal_locals()
45
+ ... # note: Revealed local types are:
46
+ ... # note: a: numpy.dtype[numpy.floating[numpy._typing._64Bit]]
47
+ ... # note: b: numpy.dtype[numpy.floating[numpy._typing._64Bit]]
48
+ ... # note: c: numpy.dtype[numpy.floating[numpy._typing._64Bit]]
49
+ ... # note: d: numpy.dtype[numpy.floating[numpy._typing._64Bit]]
50
+
51
+ """
52
+
53
+ def __len__(self, /) -> int:
54
+ """Implement ``len(self)``."""
55
+ raise NotImplementedError
56
+
57
+ def __getitem__(self, index: int, /) -> "_T_co | _NestedSequence[_T_co]":
58
+ """Implement ``self[x]``."""
59
+ raise NotImplementedError
60
+
61
+ def __contains__(self, x: object, /) -> bool:
62
+ """Implement ``x in self``."""
63
+ raise NotImplementedError
64
+
65
+ def __iter__(self, /) -> "Iterator[_T_co | _NestedSequence[_T_co]]":
66
+ """Implement ``iter(self)``."""
67
+ raise NotImplementedError
68
+
69
+ def __reversed__(self, /) -> "Iterator[_T_co | _NestedSequence[_T_co]]":
70
+ """Implement ``reversed(self)``."""
71
+ raise NotImplementedError
72
+
73
+ def count(self, value: Any, /) -> int:
74
+ """Return the number of occurrences of `value`."""
75
+ raise NotImplementedError
76
+
77
+ def index(self, value: Any, /) -> int:
78
+ """Return the first index of `value`."""
79
+ raise NotImplementedError
.venv_haddock/lib/python3.12/site-packages/numpy/_typing/_scalars.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Any, TypeAlias
2
+
3
+ import numpy as np
4
+
5
+ # NOTE: `_StrLike_co` and `_BytesLike_co` are pointless, as `np.str_` and
6
+ # `np.bytes_` are already subclasses of their builtin counterpart
7
+ _CharLike_co: TypeAlias = str | bytes
8
+
9
+ # The `<X>Like_co` type-aliases below represent all scalars that can be
10
+ # coerced into `<X>` (with the casting rule `same_kind`)
11
+ _BoolLike_co: TypeAlias = bool | np.bool
12
+ _UIntLike_co: TypeAlias = bool | np.unsignedinteger | np.bool
13
+ _IntLike_co: TypeAlias = int | np.integer | np.bool
14
+ _FloatLike_co: TypeAlias = float | np.floating | np.integer | np.bool
15
+ _ComplexLike_co: TypeAlias = complex | np.number | np.bool
16
+ _NumberLike_co: TypeAlias = _ComplexLike_co
17
+ _TD64Like_co: TypeAlias = int | np.timedelta64 | np.integer | np.bool
18
+ # `_VoidLike_co` is technically not a scalar, but it's close enough
19
+ _VoidLike_co: TypeAlias = tuple[Any, ...] | np.void
20
+ _ScalarLike_co: TypeAlias = complex | str | bytes | np.generic
.venv_haddock/lib/python3.12/site-packages/numpy/_typing/_shape.py ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ from collections.abc import Sequence
2
+ from typing import Any, SupportsIndex, TypeAlias
3
+
4
+ _Shape: TypeAlias = tuple[int, ...]
5
+ _AnyShape: TypeAlias = tuple[Any, ...]
6
+
7
+ # Anything that can be coerced to a shape tuple
8
+ _ShapeLike: TypeAlias = SupportsIndex | Sequence[SupportsIndex]
.venv_haddock/lib/python3.12/site-packages/numpy/_typing/_ufunc.py ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ from numpy import ufunc
2
+
3
+ _UFunc_Nin1_Nout1 = ufunc
4
+ _UFunc_Nin2_Nout1 = ufunc
5
+ _UFunc_Nin1_Nout2 = ufunc
6
+ _UFunc_Nin2_Nout2 = ufunc
7
+ _GUFunc_Nin2_Nout1 = ufunc
.venv_haddock/lib/python3.12/site-packages/numpy/_typing/_ufunc.pyi ADDED
@@ -0,0 +1,975 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """A module with private type-check-only `numpy.ufunc` subclasses.
2
+
3
+ The signatures of the ufuncs are too varied to reasonably type
4
+ with a single class. So instead, `ufunc` has been expanded into
5
+ four private subclasses, one for each combination of
6
+ `~ufunc.nin` and `~ufunc.nout`.
7
+ """ # noqa: PYI021
8
+
9
+ from _typeshed import Incomplete
10
+ from types import EllipsisType
11
+ from typing import (
12
+ Any,
13
+ Generic,
14
+ Literal,
15
+ LiteralString,
16
+ Never,
17
+ NoReturn,
18
+ Protocol,
19
+ SupportsIndex,
20
+ TypeAlias,
21
+ TypedDict,
22
+ TypeVar,
23
+ Unpack,
24
+ overload,
25
+ type_check_only,
26
+ )
27
+
28
+ import numpy as np
29
+ from numpy import _CastingKind, _OrderKACF, ufunc
30
+ from numpy.typing import NDArray
31
+
32
+ from ._array_like import ArrayLike, _ArrayLikeBool_co, _ArrayLikeInt_co
33
+ from ._dtype_like import DTypeLike
34
+ from ._scalars import _ScalarLike_co
35
+ from ._shape import _ShapeLike
36
+
37
+ _T = TypeVar("_T")
38
+ _2Tuple: TypeAlias = tuple[_T, _T]
39
+ _3Tuple: TypeAlias = tuple[_T, _T, _T]
40
+ _4Tuple: TypeAlias = tuple[_T, _T, _T, _T]
41
+
42
+ _2PTuple: TypeAlias = tuple[_T, _T, *tuple[_T, ...]]
43
+ _3PTuple: TypeAlias = tuple[_T, _T, _T, *tuple[_T, ...]]
44
+ _4PTuple: TypeAlias = tuple[_T, _T, _T, _T, *tuple[_T, ...]]
45
+
46
+ _NTypes = TypeVar("_NTypes", bound=int, covariant=True)
47
+ _IDType = TypeVar("_IDType", covariant=True)
48
+ _NameType = TypeVar("_NameType", bound=LiteralString, covariant=True)
49
+ _Signature = TypeVar("_Signature", bound=LiteralString, covariant=True)
50
+
51
+ _NIn = TypeVar("_NIn", bound=int, covariant=True)
52
+ _NOut = TypeVar("_NOut", bound=int, covariant=True)
53
+ _ReturnType_co = TypeVar("_ReturnType_co", covariant=True)
54
+ _ArrayT = TypeVar("_ArrayT", bound=np.ndarray)
55
+
56
+ @type_check_only
57
+ class _SupportsArrayUFunc(Protocol):
58
+ def __array_ufunc__(
59
+ self,
60
+ ufunc: ufunc,
61
+ method: Literal["__call__", "reduce", "reduceat", "accumulate", "outer", "at"],
62
+ *inputs: Any,
63
+ **kwargs: Any,
64
+ ) -> Any: ...
65
+
66
+ @type_check_only
67
+ class _UFunc3Kwargs(TypedDict, total=False):
68
+ where: _ArrayLikeBool_co | None
69
+ casting: _CastingKind
70
+ order: _OrderKACF
71
+ subok: bool
72
+ signature: _3Tuple[str | None] | str | None
73
+
74
+ @type_check_only
75
+ class _ReduceKwargs(TypedDict, total=False):
76
+ initial: Incomplete # = <no value>
77
+ where: _ArrayLikeBool_co | None # = True
78
+
79
+ # NOTE: `reduce`, `accumulate`, `reduceat` and `outer` raise a ValueError for
80
+ # ufuncs that don't accept two input arguments and return one output argument.
81
+ # In such cases the respective methods return `NoReturn`
82
+
83
+ # NOTE: Similarly, `at` won't be defined for ufuncs that return
84
+ # multiple outputs; in such cases `at` is typed to return `NoReturn`
85
+
86
+ # NOTE: If 2 output types are returned then `out` must be a
87
+ # 2-tuple of arrays. Otherwise `None` or a plain array are also acceptable
88
+
89
+ # pyright: reportIncompatibleMethodOverride=false
90
+
91
+ @type_check_only
92
+ class _UFunc_Nin1_Nout1(ufunc, Generic[_NameType, _NTypes, _IDType]): # type: ignore[misc]
93
+ @property
94
+ def __name__(self) -> _NameType: ...
95
+ @property
96
+ def __qualname__(self) -> _NameType: ... # pyright: ignore[reportIncompatibleVariableOverride]
97
+ @property
98
+ def ntypes(self) -> _NTypes: ...
99
+ @property
100
+ def identity(self) -> _IDType: ...
101
+ @property
102
+ def nin(self) -> Literal[1]: ...
103
+ @property
104
+ def nout(self) -> Literal[1]: ...
105
+ @property
106
+ def nargs(self) -> Literal[2]: ...
107
+ @property
108
+ def signature(self) -> None: ...
109
+
110
+ @overload
111
+ def __call__(
112
+ self,
113
+ x1: _ScalarLike_co,
114
+ /,
115
+ out: None = None,
116
+ *,
117
+ dtype: DTypeLike | None = None,
118
+ where: _ArrayLikeBool_co | None = True,
119
+ casting: _CastingKind = ...,
120
+ order: _OrderKACF = ...,
121
+ subok: bool = ...,
122
+ signature: str | _2Tuple[str | None] = ...,
123
+ ) -> Incomplete: ...
124
+ @overload
125
+ def __call__(
126
+ self,
127
+ x1: ArrayLike,
128
+ /,
129
+ out: np.ndarray | tuple[np.ndarray] | EllipsisType | None = None,
130
+ *,
131
+ dtype: DTypeLike | None = None,
132
+ where: _ArrayLikeBool_co | None = True,
133
+ casting: _CastingKind = ...,
134
+ order: _OrderKACF = ...,
135
+ subok: bool = ...,
136
+ signature: str | _2Tuple[str | None] = ...,
137
+ ) -> NDArray[Incomplete]: ...
138
+ @overload
139
+ def __call__(
140
+ self,
141
+ x1: _SupportsArrayUFunc,
142
+ /,
143
+ out: np.ndarray | tuple[np.ndarray] | EllipsisType | None = None,
144
+ *,
145
+ dtype: DTypeLike | None = None,
146
+ where: _ArrayLikeBool_co | None = True,
147
+ casting: _CastingKind = ...,
148
+ order: _OrderKACF = ...,
149
+ subok: bool = ...,
150
+ signature: str | _2Tuple[str | None] = ...,
151
+ ) -> Incomplete: ...
152
+
153
+ def accumulate(self, array: Never, /) -> NoReturn: ... # type: ignore[override]
154
+ def reduce(self, array: Never, /) -> NoReturn: ... # type: ignore[override]
155
+ def reduceat(self, array: Never, /, indices: Never) -> NoReturn: ... # type: ignore[override]
156
+ def outer(self, A: Never, B: Never, /) -> NoReturn: ... # type: ignore[override]
157
+
158
+ def at(self, a: np.ndarray | _SupportsArrayUFunc, indices: _ArrayLikeInt_co, /) -> None: ... # type: ignore[override]
159
+
160
+ @type_check_only
161
+ class _UFunc_Nin2_Nout1(ufunc, Generic[_NameType, _NTypes, _IDType]): # type: ignore[misc]
162
+ @property
163
+ def __name__(self) -> _NameType: ...
164
+ @property
165
+ def __qualname__(self) -> _NameType: ... # pyright: ignore[reportIncompatibleVariableOverride]
166
+ @property
167
+ def ntypes(self) -> _NTypes: ...
168
+ @property
169
+ def identity(self) -> _IDType: ...
170
+ @property
171
+ def nin(self) -> Literal[2]: ...
172
+ @property
173
+ def nout(self) -> Literal[1]: ...
174
+ @property
175
+ def nargs(self) -> Literal[3]: ...
176
+ @property
177
+ def signature(self) -> None: ...
178
+
179
+ @overload # (scalar, scalar) -> scalar
180
+ def __call__(
181
+ self,
182
+ x1: _ScalarLike_co,
183
+ x2: _ScalarLike_co,
184
+ /,
185
+ out: EllipsisType | None = None,
186
+ *,
187
+ dtype: DTypeLike | None = None,
188
+ **kwds: Unpack[_UFunc3Kwargs],
189
+ ) -> Incomplete: ...
190
+ @overload # (array-like, array) -> array
191
+ def __call__(
192
+ self,
193
+ x1: ArrayLike,
194
+ x2: np.ndarray,
195
+ /,
196
+ out: np.ndarray | tuple[np.ndarray] | EllipsisType | None = None,
197
+ *,
198
+ dtype: DTypeLike | None = None,
199
+ **kwds: Unpack[_UFunc3Kwargs],
200
+ ) -> NDArray[Incomplete]: ...
201
+ @overload # (array, array-like) -> array
202
+ def __call__(
203
+ self,
204
+ x1: np.ndarray,
205
+ x2: ArrayLike,
206
+ /,
207
+ out: np.ndarray | tuple[np.ndarray] | EllipsisType | None = None,
208
+ *,
209
+ dtype: DTypeLike | None = None,
210
+ **kwds: Unpack[_UFunc3Kwargs],
211
+ ) -> NDArray[Incomplete]: ...
212
+ @overload # (array-like, array-like, out=array) -> array
213
+ def __call__(
214
+ self,
215
+ x1: ArrayLike,
216
+ x2: ArrayLike,
217
+ /,
218
+ out: np.ndarray | tuple[np.ndarray],
219
+ *,
220
+ dtype: DTypeLike | None = None,
221
+ **kwds: Unpack[_UFunc3Kwargs],
222
+ ) -> NDArray[Incomplete]: ...
223
+ @overload # (array-like, array-like) -> array | scalar
224
+ def __call__(
225
+ self,
226
+ x1: ArrayLike,
227
+ x2: ArrayLike,
228
+ /,
229
+ out: np.ndarray | tuple[np.ndarray] | EllipsisType | None = None,
230
+ *,
231
+ dtype: DTypeLike | None = None,
232
+ **kwds: Unpack[_UFunc3Kwargs],
233
+ ) -> NDArray[Incomplete] | Incomplete: ...
234
+
235
+ def accumulate(
236
+ self,
237
+ array: ArrayLike,
238
+ /,
239
+ axis: SupportsIndex = 0,
240
+ dtype: DTypeLike | None = None,
241
+ out: np.ndarray | EllipsisType | None = None,
242
+ ) -> NDArray[Incomplete]: ...
243
+
244
+ @overload # type: ignore[override]
245
+ def reduce( # out=None (default), keepdims=False (default)
246
+ self,
247
+ array: ArrayLike,
248
+ /,
249
+ axis: _ShapeLike | None = 0,
250
+ dtype: DTypeLike | None = None,
251
+ out: None = None,
252
+ *,
253
+ keepdims: Literal[False] = False,
254
+ **kwargs: Unpack[_ReduceKwargs],
255
+ ) -> Incomplete: ...
256
+ @overload # out=ndarray or out=...
257
+ def reduce(
258
+ self,
259
+ array: ArrayLike,
260
+ /,
261
+ axis: _ShapeLike | None = 0,
262
+ dtype: DTypeLike | None = None,
263
+ *,
264
+ out: np.ndarray | EllipsisType,
265
+ keepdims: bool = False,
266
+ **kwargs: Unpack[_ReduceKwargs],
267
+ ) -> NDArray[Incomplete]: ...
268
+ @overload # keepdims=True
269
+ def reduce(
270
+ self,
271
+ array: ArrayLike,
272
+ /,
273
+ axis: _ShapeLike | None = 0,
274
+ dtype: DTypeLike | None = None,
275
+ out: np.ndarray | EllipsisType | None = None,
276
+ *,
277
+ keepdims: Literal[True],
278
+ **kwargs: Unpack[_ReduceKwargs],
279
+ ) -> NDArray[Incomplete]: ...
280
+
281
+ def reduceat(
282
+ self,
283
+ array: ArrayLike,
284
+ /,
285
+ indices: _ArrayLikeInt_co,
286
+ axis: SupportsIndex = 0,
287
+ dtype: DTypeLike | None = None,
288
+ out: np.ndarray | EllipsisType | None = None,
289
+ ) -> NDArray[Incomplete]: ...
290
+
291
+ @overload # type: ignore[override]
292
+ def outer( # (scalar, scalar) -> scalar
293
+ self,
294
+ A: _ScalarLike_co,
295
+ B: _ScalarLike_co,
296
+ /,
297
+ *,
298
+ out: None = None,
299
+ dtype: DTypeLike | None = None,
300
+ **kwds: Unpack[_UFunc3Kwargs],
301
+ ) -> Incomplete: ...
302
+ @overload # (array-like, array) -> array
303
+ def outer(
304
+ self,
305
+ A: ArrayLike,
306
+ B: np.ndarray,
307
+ /,
308
+ *,
309
+ out: np.ndarray | tuple[np.ndarray] | EllipsisType | None = None,
310
+ dtype: DTypeLike | None = None,
311
+ **kwds: Unpack[_UFunc3Kwargs],
312
+ ) -> NDArray[Incomplete]: ...
313
+ @overload # (array, array-like) -> array
314
+ def outer(
315
+ self,
316
+ A: np.ndarray,
317
+ B: ArrayLike,
318
+ /,
319
+ *,
320
+ out: np.ndarray | tuple[np.ndarray] | EllipsisType | None = None,
321
+ dtype: DTypeLike | None = None,
322
+ **kwds: Unpack[_UFunc3Kwargs],
323
+ ) -> NDArray[Incomplete]: ...
324
+ @overload # (array-like, array-like, out=array) -> array
325
+ def outer(
326
+ self,
327
+ A: ArrayLike,
328
+ B: ArrayLike,
329
+ /,
330
+ *,
331
+ out: np.ndarray | tuple[np.ndarray] | EllipsisType,
332
+ dtype: DTypeLike | None = None,
333
+ **kwds: Unpack[_UFunc3Kwargs],
334
+ ) -> NDArray[Incomplete]: ...
335
+ @overload # (array-like, array-like) -> array | scalar
336
+ def outer(
337
+ self,
338
+ A: ArrayLike,
339
+ B: ArrayLike,
340
+ /,
341
+ *,
342
+ out: None = None,
343
+ dtype: DTypeLike | None = None,
344
+ **kwds: Unpack[_UFunc3Kwargs],
345
+ ) -> NDArray[Incomplete] | Incomplete: ...
346
+
347
+ def at( # type: ignore[override]
348
+ self,
349
+ a: np.ndarray | _SupportsArrayUFunc,
350
+ indices: _ArrayLikeInt_co,
351
+ b: ArrayLike,
352
+ /,
353
+ ) -> None: ...
354
+
355
+ @type_check_only
356
+ class _UFunc_Nin1_Nout2(ufunc, Generic[_NameType, _NTypes, _IDType]): # type: ignore[misc]
357
+ @property
358
+ def __name__(self) -> _NameType: ...
359
+ @property
360
+ def __qualname__(self) -> _NameType: ... # pyright: ignore[reportIncompatibleVariableOverride]
361
+ @property
362
+ def ntypes(self) -> _NTypes: ...
363
+ @property
364
+ def identity(self) -> _IDType: ...
365
+ @property
366
+ def nin(self) -> Literal[1]: ...
367
+ @property
368
+ def nout(self) -> Literal[2]: ...
369
+ @property
370
+ def nargs(self) -> Literal[3]: ...
371
+ @property
372
+ def signature(self) -> None: ...
373
+
374
+ @overload
375
+ def __call__(
376
+ self,
377
+ x1: _ScalarLike_co,
378
+ out1: EllipsisType | None = ...,
379
+ out2: None = None,
380
+ /,
381
+ *,
382
+ out: EllipsisType | None = ...,
383
+ dtype: DTypeLike | None = None,
384
+ where: _ArrayLikeBool_co | None = True,
385
+ casting: _CastingKind = ...,
386
+ order: _OrderKACF = ...,
387
+ subok: bool = ...,
388
+ signature: str | _3Tuple[str | None] = ...,
389
+ ) -> _2Tuple[Incomplete]: ...
390
+ @overload
391
+ def __call__(
392
+ self,
393
+ x1: ArrayLike,
394
+ out1: np.ndarray | EllipsisType | None = ...,
395
+ out2: np.ndarray | None = ...,
396
+ /,
397
+ *,
398
+ out: _2Tuple[np.ndarray] | EllipsisType = ...,
399
+ dtype: DTypeLike | None = None,
400
+ where: _ArrayLikeBool_co | None = True,
401
+ casting: _CastingKind = ...,
402
+ order: _OrderKACF = ...,
403
+ subok: bool = ...,
404
+ signature: str | _3Tuple[str | None] = ...,
405
+ ) -> _2Tuple[NDArray[Incomplete]]: ...
406
+ @overload
407
+ def __call__(
408
+ self,
409
+ x1: _SupportsArrayUFunc,
410
+ out1: np.ndarray | EllipsisType | None = ...,
411
+ out2: np.ndarray | None = ...,
412
+ /,
413
+ *,
414
+ out: _2Tuple[np.ndarray] | EllipsisType = ...,
415
+ dtype: DTypeLike | None = None,
416
+ where: _ArrayLikeBool_co | None = True,
417
+ casting: _CastingKind = ...,
418
+ order: _OrderKACF = ...,
419
+ subok: bool = ...,
420
+ signature: str | _3Tuple[str | None] = ...,
421
+ ) -> _2Tuple[Incomplete]: ...
422
+
423
+ def accumulate(self, array: Never, /) -> NoReturn: ... # type: ignore[override]
424
+ def reduce(self, array: Never, /) -> NoReturn: ... # type: ignore[override]
425
+ def reduceat(self, array: Never, /, indices: Never) -> NoReturn: ... # type: ignore[override]
426
+ def outer(self, A: Never, B: Never, /) -> NoReturn: ... # type: ignore[override]
427
+ def at(self, a: Never, indices: Never, /) -> NoReturn: ... # type: ignore[override]
428
+
429
+ @type_check_only
430
+ class _UFunc_Nin2_Nout2(ufunc, Generic[_NameType, _NTypes, _IDType]): # type: ignore[misc]
431
+ @property
432
+ def __name__(self) -> _NameType: ...
433
+ @property
434
+ def __qualname__(self) -> _NameType: ... # pyright: ignore[reportIncompatibleVariableOverride]
435
+ @property
436
+ def ntypes(self) -> _NTypes: ...
437
+ @property
438
+ def identity(self) -> _IDType: ...
439
+ @property
440
+ def nin(self) -> Literal[2]: ...
441
+ @property
442
+ def nout(self) -> Literal[2]: ...
443
+ @property
444
+ def nargs(self) -> Literal[4]: ...
445
+ @property
446
+ def signature(self) -> None: ...
447
+
448
+ @overload
449
+ def __call__(
450
+ self,
451
+ x1: _ScalarLike_co,
452
+ x2: _ScalarLike_co,
453
+ out1: EllipsisType | None = ...,
454
+ out2: None = None,
455
+ /,
456
+ *,
457
+ out: EllipsisType | None = ...,
458
+ dtype: DTypeLike | None = None,
459
+ where: _ArrayLikeBool_co | None = True,
460
+ casting: _CastingKind = ...,
461
+ order: _OrderKACF = ...,
462
+ subok: bool = ...,
463
+ signature: str | _4Tuple[str | None] = ...,
464
+ ) -> _2Tuple[Incomplete]: ...
465
+ @overload
466
+ def __call__(
467
+ self,
468
+ x1: ArrayLike,
469
+ x2: ArrayLike,
470
+ out1: np.ndarray | EllipsisType | None = ...,
471
+ out2: np.ndarray | None = ...,
472
+ /,
473
+ *,
474
+ out: _2Tuple[np.ndarray] | EllipsisType = ...,
475
+ dtype: DTypeLike | None = None,
476
+ where: _ArrayLikeBool_co | None = True,
477
+ casting: _CastingKind = ...,
478
+ order: _OrderKACF = ...,
479
+ subok: bool = ...,
480
+ signature: str | _4Tuple[str | None] = ...,
481
+ ) -> _2Tuple[NDArray[Incomplete]]: ...
482
+
483
+ def accumulate(self, array: Never, /) -> NoReturn: ... # type: ignore[override]
484
+ def reduce(self, array: Never, /) -> NoReturn: ... # type: ignore[override]
485
+ def reduceat(self, array: Never, /, indices: Never) -> NoReturn: ... # type: ignore[override]
486
+ def outer(self, A: Never, B: Never, /) -> NoReturn: ... # type: ignore[override]
487
+ def at(self, a: Never, indices: Never, b: Never, /) -> NoReturn: ... # type: ignore[override]
488
+
489
+ @type_check_only
490
+ class _GUFunc_Nin2_Nout1(ufunc, Generic[_NameType, _NTypes, _IDType, _Signature]): # type: ignore[misc]
491
+ @property
492
+ def __name__(self) -> _NameType: ...
493
+ @property
494
+ def __qualname__(self) -> _NameType: ... # pyright: ignore[reportIncompatibleVariableOverride]
495
+ @property
496
+ def ntypes(self) -> _NTypes: ...
497
+ @property
498
+ def identity(self) -> _IDType: ...
499
+ @property
500
+ def nin(self) -> Literal[2]: ...
501
+ @property
502
+ def nout(self) -> Literal[1]: ...
503
+ @property
504
+ def nargs(self) -> Literal[3]: ...
505
+ @property
506
+ def signature(self) -> _Signature: ...
507
+
508
+ # Scalar for 1D array-likes; ndarray otherwise
509
+ @overload
510
+ def __call__(
511
+ self,
512
+ x1: ArrayLike,
513
+ x2: ArrayLike,
514
+ /,
515
+ out: EllipsisType | None = None,
516
+ *,
517
+ dtype: DTypeLike | None = None,
518
+ casting: _CastingKind = ...,
519
+ order: _OrderKACF = ...,
520
+ subok: bool = ...,
521
+ signature: str | _3Tuple[str | None] = ...,
522
+ axes: list[_2Tuple[SupportsIndex]] = ...,
523
+ ) -> Incomplete: ...
524
+ @overload
525
+ def __call__(
526
+ self,
527
+ x1: ArrayLike,
528
+ x2: ArrayLike,
529
+ /,
530
+ out: np.ndarray | tuple[np.ndarray] | EllipsisType,
531
+ *,
532
+ dtype: DTypeLike | None = None,
533
+ casting: _CastingKind = ...,
534
+ order: _OrderKACF = ...,
535
+ subok: bool = ...,
536
+ signature: str | _3Tuple[str | None] = ...,
537
+ axes: list[_2Tuple[SupportsIndex]] = ...,
538
+ ) -> NDArray[Incomplete]: ...
539
+
540
+ def accumulate(self, array: Never, /) -> NoReturn: ... # type: ignore[override]
541
+ def reduce(self, array: Never, /) -> NoReturn: ... # type: ignore[override]
542
+ def reduceat(self, array: Never, /, indices: Never) -> NoReturn: ... # type: ignore[override]
543
+ def outer(self, A: Never, B: Never, /) -> NoReturn: ... # type: ignore[override]
544
+ def at(self, a: Never, indices: Never, b: Never, /) -> NoReturn: ... # type: ignore[override]
545
+
546
+ @type_check_only
547
+ class _PyFunc_Kwargs_Nargs2(TypedDict, total=False):
548
+ where: _ArrayLikeBool_co | None
549
+ casting: _CastingKind
550
+ order: _OrderKACF
551
+ dtype: DTypeLike
552
+ subok: bool
553
+ signature: str | tuple[DTypeLike, DTypeLike]
554
+
555
+ @type_check_only
556
+ class _PyFunc_Kwargs_Nargs3(TypedDict, total=False):
557
+ where: _ArrayLikeBool_co | None
558
+ casting: _CastingKind
559
+ order: _OrderKACF
560
+ dtype: DTypeLike
561
+ subok: bool
562
+ signature: str | tuple[DTypeLike, DTypeLike, DTypeLike]
563
+
564
+ @type_check_only
565
+ class _PyFunc_Kwargs_Nargs3P(TypedDict, total=False):
566
+ where: _ArrayLikeBool_co | None
567
+ casting: _CastingKind
568
+ order: _OrderKACF
569
+ dtype: DTypeLike
570
+ subok: bool
571
+ signature: str | _3PTuple[DTypeLike]
572
+
573
+ @type_check_only
574
+ class _PyFunc_Kwargs_Nargs4P(TypedDict, total=False):
575
+ where: _ArrayLikeBool_co | None
576
+ casting: _CastingKind
577
+ order: _OrderKACF
578
+ dtype: DTypeLike
579
+ subok: bool
580
+ signature: str | _4PTuple[DTypeLike]
581
+
582
+ @type_check_only
583
+ class _PyFunc_Nin1_Nout1(ufunc, Generic[_ReturnType_co, _IDType]): # type: ignore[misc]
584
+ @property
585
+ def identity(self) -> _IDType: ...
586
+ @property
587
+ def nin(self) -> Literal[1]: ...
588
+ @property
589
+ def nout(self) -> Literal[1]: ...
590
+ @property
591
+ def nargs(self) -> Literal[2]: ...
592
+ @property
593
+ def ntypes(self) -> Literal[1]: ...
594
+ @property
595
+ def signature(self) -> None: ...
596
+
597
+ @overload
598
+ def __call__(
599
+ self,
600
+ x1: _ScalarLike_co,
601
+ /,
602
+ out: EllipsisType | None = None,
603
+ **kwargs: Unpack[_PyFunc_Kwargs_Nargs2],
604
+ ) -> _ReturnType_co: ...
605
+ @overload
606
+ def __call__(
607
+ self,
608
+ x1: ArrayLike,
609
+ /,
610
+ out: EllipsisType | None = None,
611
+ **kwargs: Unpack[_PyFunc_Kwargs_Nargs2],
612
+ ) -> _ReturnType_co | NDArray[np.object_]: ...
613
+ @overload
614
+ def __call__(
615
+ self,
616
+ x1: ArrayLike,
617
+ /,
618
+ out: _ArrayT | tuple[_ArrayT],
619
+ **kwargs: Unpack[_PyFunc_Kwargs_Nargs2],
620
+ ) -> _ArrayT: ...
621
+ @overload
622
+ def __call__(
623
+ self,
624
+ x1: _SupportsArrayUFunc,
625
+ /,
626
+ out: np.ndarray | tuple[np.ndarray] | EllipsisType | None = None,
627
+ **kwargs: Unpack[_PyFunc_Kwargs_Nargs2],
628
+ ) -> Incomplete: ...
629
+
630
+ def accumulate(self, array: Never, /) -> NoReturn: ... # type: ignore[override]
631
+ def reduce(self, array: Never, /) -> NoReturn: ... # type: ignore[override]
632
+ def reduceat(self, array: Never, /, indices: Never) -> NoReturn: ... # type: ignore[override]
633
+ def outer(self, A: Never, B: Never, /) -> NoReturn: ... # type: ignore[override]
634
+
635
+ def at(self, a: np.ndarray | _SupportsArrayUFunc, indices: _ArrayLikeInt_co, /) -> None: ... # type: ignore[override]
636
+
637
+ @type_check_only
638
+ class _PyFunc_Nin2_Nout1(ufunc, Generic[_ReturnType_co, _IDType]): # type: ignore[misc]
639
+ @property
640
+ def identity(self) -> _IDType: ...
641
+ @property
642
+ def nin(self) -> Literal[2]: ...
643
+ @property
644
+ def nout(self) -> Literal[1]: ...
645
+ @property
646
+ def nargs(self) -> Literal[3]: ...
647
+ @property
648
+ def ntypes(self) -> Literal[1]: ...
649
+ @property
650
+ def signature(self) -> None: ...
651
+
652
+ @overload
653
+ def __call__(
654
+ self,
655
+ x1: _ScalarLike_co,
656
+ x2: _ScalarLike_co,
657
+ /,
658
+ out: EllipsisType | None = None,
659
+ **kwargs: Unpack[_PyFunc_Kwargs_Nargs3],
660
+ ) -> _ReturnType_co: ...
661
+ @overload
662
+ def __call__(
663
+ self,
664
+ x1: ArrayLike,
665
+ x2: ArrayLike,
666
+ /,
667
+ out: EllipsisType | None = ...,
668
+ **kwargs: Unpack[_PyFunc_Kwargs_Nargs3],
669
+ ) -> _ReturnType_co | NDArray[np.object_]: ...
670
+ @overload
671
+ def __call__(
672
+ self,
673
+ x1: ArrayLike,
674
+ x2: ArrayLike,
675
+ /,
676
+ out: _ArrayT | tuple[_ArrayT],
677
+ **kwargs: Unpack[_PyFunc_Kwargs_Nargs3],
678
+ ) -> _ArrayT: ...
679
+ @overload
680
+ def __call__(
681
+ self,
682
+ x1: _SupportsArrayUFunc,
683
+ x2: _SupportsArrayUFunc | ArrayLike,
684
+ /,
685
+ out: np.ndarray | tuple[np.ndarray] | EllipsisType | None = None,
686
+ **kwargs: Unpack[_PyFunc_Kwargs_Nargs3],
687
+ ) -> Incomplete: ...
688
+ @overload
689
+ def __call__(
690
+ self,
691
+ x1: ArrayLike,
692
+ x2: _SupportsArrayUFunc,
693
+ /,
694
+ out: np.ndarray | tuple[np.ndarray] | EllipsisType | None = None,
695
+ **kwargs: Unpack[_PyFunc_Kwargs_Nargs3],
696
+ ) -> Incomplete: ...
697
+
698
+ @overload # type: ignore[override]
699
+ def accumulate(
700
+ self,
701
+ array: ArrayLike,
702
+ /,
703
+ axis: SupportsIndex = 0,
704
+ dtype: DTypeLike | None = None,
705
+ out: EllipsisType | None = None,
706
+ ) -> NDArray[np.object_]: ...
707
+ @overload
708
+ def accumulate(
709
+ self,
710
+ array: ArrayLike,
711
+ /,
712
+ axis: SupportsIndex = 0,
713
+ dtype: DTypeLike | None = None,
714
+ *,
715
+ out: _ArrayT,
716
+ ) -> _ArrayT: ...
717
+
718
+ @overload # type: ignore[override]
719
+ def reduce( # out=array
720
+ self,
721
+ array: ArrayLike,
722
+ /,
723
+ axis: _ShapeLike | None = 0,
724
+ dtype: DTypeLike | None = None,
725
+ *,
726
+ out: _ArrayT | tuple[_ArrayT],
727
+ keepdims: bool = False,
728
+ **kwargs: Unpack[_ReduceKwargs],
729
+ ) -> _ArrayT: ...
730
+ @overload # out=...
731
+ def reduce(
732
+ self,
733
+ array: ArrayLike,
734
+ /,
735
+ axis: _ShapeLike | None = 0,
736
+ dtype: DTypeLike | None = None,
737
+ *,
738
+ out: EllipsisType,
739
+ keepdims: bool = False,
740
+ **kwargs: Unpack[_ReduceKwargs],
741
+ ) -> NDArray[np.object_]: ...
742
+ @overload # keepdims=True
743
+ def reduce(
744
+ self,
745
+ array: ArrayLike,
746
+ /,
747
+ axis: _ShapeLike | None = 0,
748
+ dtype: DTypeLike | None = None,
749
+ out: EllipsisType | None = None,
750
+ *,
751
+ keepdims: Literal[True],
752
+ **kwargs: Unpack[_ReduceKwargs],
753
+ ) -> NDArray[np.object_]: ...
754
+ @overload
755
+ def reduce(
756
+ self,
757
+ array: ArrayLike,
758
+ /,
759
+ axis: _ShapeLike | None = 0,
760
+ dtype: DTypeLike | None = None,
761
+ out: EllipsisType | None = None,
762
+ keepdims: bool = False,
763
+ **kwargs: Unpack[_ReduceKwargs],
764
+ ) -> _ReturnType_co | NDArray[np.object_]: ...
765
+
766
+ @overload # type: ignore[override]
767
+ def reduceat(
768
+ self,
769
+ array: ArrayLike,
770
+ /,
771
+ indices: _ArrayLikeInt_co,
772
+ axis: SupportsIndex = 0,
773
+ dtype: DTypeLike | None = None,
774
+ *,
775
+ out: _ArrayT | tuple[_ArrayT],
776
+ ) -> _ArrayT: ...
777
+ @overload
778
+ def reduceat(
779
+ self,
780
+ array: ArrayLike,
781
+ /,
782
+ indices: _ArrayLikeInt_co,
783
+ axis: SupportsIndex = 0,
784
+ dtype: DTypeLike | None = None,
785
+ out: EllipsisType | None = None,
786
+ ) -> NDArray[np.object_]: ...
787
+ @overload
788
+ def reduceat(
789
+ self,
790
+ array: _SupportsArrayUFunc,
791
+ /,
792
+ indices: _ArrayLikeInt_co,
793
+ axis: SupportsIndex = 0,
794
+ dtype: DTypeLike | None = None,
795
+ out: np.ndarray | tuple[np.ndarray] | EllipsisType | None = None,
796
+ ) -> Incomplete: ...
797
+
798
+ @overload # type: ignore[override]
799
+ def outer(
800
+ self,
801
+ A: _ScalarLike_co,
802
+ B: _ScalarLike_co,
803
+ /,
804
+ *,
805
+ out: EllipsisType | None = None,
806
+ **kwargs: Unpack[_PyFunc_Kwargs_Nargs3],
807
+ ) -> _ReturnType_co: ...
808
+ @overload
809
+ def outer(
810
+ self,
811
+ A: ArrayLike,
812
+ B: ArrayLike,
813
+ /,
814
+ *,
815
+ out: EllipsisType | None = None,
816
+ **kwargs: Unpack[_PyFunc_Kwargs_Nargs3],
817
+ ) -> _ReturnType_co | NDArray[np.object_]: ...
818
+ @overload
819
+ def outer(
820
+ self,
821
+ A: ArrayLike,
822
+ B: ArrayLike,
823
+ /,
824
+ *,
825
+ out: _ArrayT,
826
+ **kwargs: Unpack[_PyFunc_Kwargs_Nargs3],
827
+ ) -> _ArrayT: ...
828
+ @overload
829
+ def outer(
830
+ self,
831
+ A: _SupportsArrayUFunc,
832
+ B: _SupportsArrayUFunc | ArrayLike,
833
+ /,
834
+ *,
835
+ out: EllipsisType | None = None,
836
+ **kwargs: Unpack[_PyFunc_Kwargs_Nargs3],
837
+ ) -> Incomplete: ...
838
+ @overload
839
+ def outer(
840
+ self,
841
+ A: _ScalarLike_co,
842
+ B: _SupportsArrayUFunc | ArrayLike,
843
+ /,
844
+ *,
845
+ out: EllipsisType | None = None,
846
+ **kwargs: Unpack[_PyFunc_Kwargs_Nargs3],
847
+ ) -> Incomplete: ...
848
+
849
+ def at( # type: ignore[override]
850
+ self,
851
+ a: np.ndarray | _SupportsArrayUFunc,
852
+ indices: _ArrayLikeInt_co,
853
+ b: ArrayLike,
854
+ /,
855
+ ) -> None: ...
856
+
857
+ @type_check_only
858
+ class _PyFunc_Nin3P_Nout1(ufunc, Generic[_ReturnType_co, _IDType, _NIn]): # type: ignore[misc]
859
+ @property
860
+ def identity(self) -> _IDType: ...
861
+ @property
862
+ def nin(self) -> _NIn: ...
863
+ @property
864
+ def nout(self) -> Literal[1]: ...
865
+ @property
866
+ def ntypes(self) -> Literal[1]: ...
867
+ @property
868
+ def signature(self) -> None: ...
869
+
870
+ @overload
871
+ def __call__(
872
+ self,
873
+ x1: _ScalarLike_co,
874
+ x2: _ScalarLike_co,
875
+ x3: _ScalarLike_co,
876
+ /,
877
+ *xs: _ScalarLike_co,
878
+ out: EllipsisType | None = ...,
879
+ **kwargs: Unpack[_PyFunc_Kwargs_Nargs4P],
880
+ ) -> _ReturnType_co: ...
881
+ @overload
882
+ def __call__(
883
+ self,
884
+ x1: ArrayLike,
885
+ x2: ArrayLike,
886
+ x3: ArrayLike,
887
+ /,
888
+ *xs: ArrayLike,
889
+ out: EllipsisType | None = ...,
890
+ **kwargs: Unpack[_PyFunc_Kwargs_Nargs4P],
891
+ ) -> _ReturnType_co | NDArray[np.object_]: ...
892
+ @overload
893
+ def __call__(
894
+ self,
895
+ x1: ArrayLike,
896
+ x2: ArrayLike,
897
+ x3: ArrayLike,
898
+ /,
899
+ *xs: ArrayLike,
900
+ out: _ArrayT | tuple[_ArrayT],
901
+ **kwargs: Unpack[_PyFunc_Kwargs_Nargs4P],
902
+ ) -> _ArrayT: ...
903
+ @overload
904
+ def __call__(
905
+ self,
906
+ x1: _SupportsArrayUFunc | ArrayLike,
907
+ x2: _SupportsArrayUFunc | ArrayLike,
908
+ x3: _SupportsArrayUFunc | ArrayLike,
909
+ /,
910
+ *xs: _SupportsArrayUFunc | ArrayLike,
911
+ out: np.ndarray | tuple[np.ndarray] | EllipsisType | None = ...,
912
+ **kwargs: Unpack[_PyFunc_Kwargs_Nargs4P],
913
+ ) -> Incomplete: ...
914
+
915
+ def accumulate(self, array: Never, /) -> NoReturn: ... # type: ignore[override]
916
+ def reduce(self, array: Never, /) -> NoReturn: ... # type: ignore[override]
917
+ def reduceat(self, array: Never, /, indices: Never) -> NoReturn: ... # type: ignore[override]
918
+ def outer(self, A: Never, B: Never, /) -> NoReturn: ... # type: ignore[override]
919
+ def at(self, a: Never, indices: Never, /, *args: Never) -> NoReturn: ... # type: ignore[override]
920
+
921
+ @type_check_only
922
+ class _PyFunc_Nin1P_Nout2P(ufunc, Generic[_ReturnType_co, _IDType, _NIn, _NOut]): # type: ignore[misc]
923
+ @property
924
+ def identity(self) -> _IDType: ...
925
+ @property
926
+ def nin(self) -> _NIn: ...
927
+ @property
928
+ def nout(self) -> _NOut: ...
929
+ @property
930
+ def ntypes(self) -> Literal[1]: ...
931
+ @property
932
+ def signature(self) -> None: ...
933
+
934
+ @overload
935
+ def __call__(
936
+ self,
937
+ x1: _ScalarLike_co,
938
+ /,
939
+ *xs: _ScalarLike_co,
940
+ out: EllipsisType | None = ...,
941
+ **kwargs: Unpack[_PyFunc_Kwargs_Nargs3P],
942
+ ) -> _2PTuple[_ReturnType_co]: ...
943
+ @overload
944
+ def __call__(
945
+ self,
946
+ x1: ArrayLike,
947
+ /,
948
+ *xs: ArrayLike,
949
+ out: EllipsisType | None = ...,
950
+ **kwargs: Unpack[_PyFunc_Kwargs_Nargs3P],
951
+ ) -> _2PTuple[_ReturnType_co | NDArray[np.object_]]: ...
952
+ @overload
953
+ def __call__(
954
+ self,
955
+ x1: ArrayLike,
956
+ /,
957
+ *xs: ArrayLike,
958
+ out: _2PTuple[_ArrayT],
959
+ **kwargs: Unpack[_PyFunc_Kwargs_Nargs3P],
960
+ ) -> _2PTuple[_ArrayT]: ...
961
+ @overload
962
+ def __call__(
963
+ self,
964
+ x1: _SupportsArrayUFunc | ArrayLike,
965
+ /,
966
+ *xs: _SupportsArrayUFunc | ArrayLike,
967
+ out: _2PTuple[np.ndarray] | EllipsisType | None = ...,
968
+ **kwargs: Unpack[_PyFunc_Kwargs_Nargs3P],
969
+ ) -> Incomplete: ...
970
+
971
+ def accumulate(self, array: Never, /) -> NoReturn: ... # type: ignore[override]
972
+ def reduce(self, array: Never, /) -> NoReturn: ... # type: ignore[override]
973
+ def reduceat(self, array: Never, /, indices: Never) -> NoReturn: ... # type: ignore[override]
974
+ def outer(self, A: Never, B: Never, /) -> NoReturn: ... # type: ignore[override]
975
+ def at(self, a: Never, indices: Never, /, *args: Never) -> NoReturn: ... # type: ignore[override]
.venv_haddock/lib/python3.12/site-packages/numpy/_utils/.___init__.py ADDED
Binary file (4.1 kB). View file
 
.venv_haddock/lib/python3.12/site-packages/numpy/_utils/.___init__.pyi ADDED
Binary file (4.1 kB). View file
 
.venv_haddock/lib/python3.12/site-packages/numpy/_utils/.___pycache__ ADDED
Binary file (4.1 kB). View file
 
.venv_haddock/lib/python3.12/site-packages/numpy/_utils/.__convertions.py ADDED
Binary file (4.1 kB). View file
 
.venv_haddock/lib/python3.12/site-packages/numpy/_utils/.__convertions.pyi ADDED
Binary file (4.1 kB). View file
 
.venv_haddock/lib/python3.12/site-packages/numpy/_utils/.__inspect.py ADDED
Binary file (4.1 kB). View file
 
.venv_haddock/lib/python3.12/site-packages/numpy/_utils/.__inspect.pyi ADDED
Binary file (4.1 kB). View file
 
.venv_haddock/lib/python3.12/site-packages/numpy/_utils/.__pep440.py ADDED
Binary file (4.1 kB). View file
 
.venv_haddock/lib/python3.12/site-packages/numpy/_utils/.__pep440.pyi ADDED
Binary file (4.1 kB). View file
 
.venv_haddock/lib/python3.12/site-packages/numpy/_utils/__init__.py ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ This is a module for defining private helpers which do not depend on the
3
+ rest of NumPy.
4
+
5
+ Everything in here must be self-contained so that it can be
6
+ imported anywhere else without creating circular imports.
7
+ If a utility requires the import of NumPy, it probably belongs
8
+ in ``numpy._core``.
9
+ """
10
+
11
+ import functools
12
+ import warnings
13
+
14
+ from ._convertions import asbytes, asunicode
15
+
16
+
17
+ def set_module(module):
18
+ """Private decorator for overriding __module__ on a function or class.
19
+
20
+ Example usage::
21
+
22
+ @set_module('numpy')
23
+ def example():
24
+ pass
25
+
26
+ assert example.__module__ == 'numpy'
27
+ """
28
+ def decorator(func):
29
+ if module is not None:
30
+ if isinstance(func, type):
31
+ try:
32
+ func._module_source = func.__module__
33
+ except (AttributeError):
34
+ pass
35
+
36
+ func.__module__ = module
37
+ return func
38
+ return decorator
39
+
40
+
41
+ def _rename_parameter(old_names, new_names, dep_version=None):
42
+ """
43
+ Generate decorator for backward-compatible keyword renaming.
44
+
45
+ Apply the decorator generated by `_rename_parameter` to functions with a
46
+ renamed parameter to maintain backward-compatibility.
47
+
48
+ After decoration, the function behaves as follows:
49
+ If only the new parameter is passed into the function, behave as usual.
50
+ If only the old parameter is passed into the function (as a keyword), raise
51
+ a DeprecationWarning if `dep_version` is provided, and behave as usual
52
+ otherwise.
53
+ If both old and new parameters are passed into the function, raise a
54
+ DeprecationWarning if `dep_version` is provided, and raise the appropriate
55
+ TypeError (function got multiple values for argument).
56
+
57
+ Parameters
58
+ ----------
59
+ old_names : list of str
60
+ Old names of parameters
61
+ new_name : list of str
62
+ New names of parameters
63
+ dep_version : str, optional
64
+ Version of NumPy in which old parameter was deprecated in the format
65
+ 'X.Y.Z'. If supplied, the deprecation message will indicate that
66
+ support for the old parameter will be removed in version 'X.Y+2.Z'
67
+
68
+ Notes
69
+ -----
70
+ Untested with functions that accept *args. Probably won't work as written.
71
+
72
+ """
73
+ def decorator(fun):
74
+ @functools.wraps(fun)
75
+ def wrapper(*args, **kwargs):
76
+ __tracebackhide__ = True # Hide traceback for py.test
77
+ for old_name, new_name in zip(old_names, new_names):
78
+ if old_name in kwargs:
79
+ if dep_version:
80
+ end_version = dep_version.split('.')
81
+ end_version[1] = str(int(end_version[1]) + 2)
82
+ end_version = '.'.join(end_version)
83
+ msg = (f"Use of keyword argument `{old_name}` is "
84
+ f"deprecated and replaced by `{new_name}`. "
85
+ f"Support for `{old_name}` will be removed "
86
+ f"in NumPy {end_version}.")
87
+ warnings.warn(msg, DeprecationWarning, stacklevel=2)
88
+ if new_name in kwargs:
89
+ msg = (f"{fun.__name__}() got multiple values for "
90
+ f"argument now known as `{new_name}`")
91
+ raise TypeError(msg)
92
+ kwargs[new_name] = kwargs.pop(old_name)
93
+ return fun(*args, **kwargs)
94
+ return wrapper
95
+ return decorator
.venv_haddock/lib/python3.12/site-packages/numpy/_utils/__init__.pyi ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from _typeshed import IdentityFunction
2
+ from collections.abc import Callable, Iterable
3
+ from typing import Protocol, TypeVar, overload, type_check_only
4
+
5
+ from ._convertions import asbytes as asbytes, asunicode as asunicode
6
+
7
+ ###
8
+
9
+ _T = TypeVar("_T")
10
+ _HasModuleT = TypeVar("_HasModuleT", bound=_HasModule)
11
+
12
+ @type_check_only
13
+ class _HasModule(Protocol):
14
+ __module__: str
15
+
16
+ ###
17
+
18
+ @overload
19
+ def set_module(module: None) -> IdentityFunction: ...
20
+ @overload
21
+ def set_module(module: str) -> Callable[[_HasModuleT], _HasModuleT]: ...
22
+
23
+ #
24
+ def _rename_parameter(
25
+ old_names: Iterable[str],
26
+ new_names: Iterable[str],
27
+ dep_version: str | None = None,
28
+ ) -> Callable[[Callable[..., _T]], Callable[..., _T]]: ...
.venv_haddock/lib/python3.12/site-packages/numpy/_utils/_convertions.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ A set of methods retained from np.compat module that
3
+ are still used across codebase.
4
+ """
5
+
6
+ __all__ = ["asunicode", "asbytes"]
7
+
8
+
9
+ def asunicode(s):
10
+ if isinstance(s, bytes):
11
+ return s.decode('latin1')
12
+ return str(s)
13
+
14
+
15
+ def asbytes(s):
16
+ if isinstance(s, bytes):
17
+ return s
18
+ return str(s).encode('latin1')
.venv_haddock/lib/python3.12/site-packages/numpy/_utils/_convertions.pyi ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ __all__ = ["asbytes", "asunicode"]
2
+
3
+ def asunicode(s: bytes | str) -> str: ...
4
+ def asbytes(s: bytes | str) -> str: ...
.venv_haddock/lib/python3.12/site-packages/numpy/_utils/_inspect.py ADDED
@@ -0,0 +1,192 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Subset of inspect module from upstream python
2
+
3
+ We use this instead of upstream because upstream inspect is slow to import, and
4
+ significantly contributes to numpy import times. Importing this copy has almost
5
+ no overhead.
6
+
7
+ """
8
+ import types
9
+
10
+ __all__ = ['getargspec', 'formatargspec']
11
+
12
+ # ----------------------------------------------------------- type-checking
13
+ def ismethod(object):
14
+ """Return true if the object is an instance method.
15
+
16
+ Instance method objects provide these attributes:
17
+ __doc__ documentation string
18
+ __name__ name with which this method was defined
19
+ im_class class object in which this method belongs
20
+ im_func function object containing implementation of method
21
+ im_self instance to which this method is bound, or None
22
+
23
+ """
24
+ return isinstance(object, types.MethodType)
25
+
26
+ def isfunction(object):
27
+ """Return true if the object is a user-defined function.
28
+
29
+ Function objects provide these attributes:
30
+ __doc__ documentation string
31
+ __name__ name with which this function was defined
32
+ func_code code object containing compiled function bytecode
33
+ func_defaults tuple of any default values for arguments
34
+ func_doc (same as __doc__)
35
+ func_globals global namespace in which this function was defined
36
+ func_name (same as __name__)
37
+
38
+ """
39
+ return isinstance(object, types.FunctionType)
40
+
41
+ def iscode(object):
42
+ """Return true if the object is a code object.
43
+
44
+ Code objects provide these attributes:
45
+ co_argcount number of arguments (not including * or ** args)
46
+ co_code string of raw compiled bytecode
47
+ co_consts tuple of constants used in the bytecode
48
+ co_filename name of file in which this code object was created
49
+ co_firstlineno number of first line in Python source code
50
+ co_flags bitmap: 1=optimized | 2=newlocals | 4=*arg | 8=**arg
51
+ co_lnotab encoded mapping of line numbers to bytecode indices
52
+ co_name name with which this code object was defined
53
+ co_names tuple of names of local variables
54
+ co_nlocals number of local variables
55
+ co_stacksize virtual machine stack space required
56
+ co_varnames tuple of names of arguments and local variables
57
+
58
+ """
59
+ return isinstance(object, types.CodeType)
60
+
61
+
62
+ # ------------------------------------------------ argument list extraction
63
+ # These constants are from Python's compile.h.
64
+ CO_OPTIMIZED, CO_NEWLOCALS, CO_VARARGS, CO_VARKEYWORDS = 1, 2, 4, 8
65
+
66
+ def getargs(co):
67
+ """Get information about the arguments accepted by a code object.
68
+
69
+ Three things are returned: (args, varargs, varkw), where 'args' is
70
+ a list of argument names (possibly containing nested lists), and
71
+ 'varargs' and 'varkw' are the names of the * and ** arguments or None.
72
+
73
+ """
74
+
75
+ if not iscode(co):
76
+ raise TypeError('arg is not a code object')
77
+
78
+ nargs = co.co_argcount
79
+ names = co.co_varnames
80
+ args = list(names[:nargs])
81
+
82
+ # The following acrobatics are for anonymous (tuple) arguments.
83
+ # Which we do not need to support, so remove to avoid importing
84
+ # the dis module.
85
+ for i in range(nargs):
86
+ if args[i][:1] in ['', '.']:
87
+ raise TypeError("tuple function arguments are not supported")
88
+ varargs = None
89
+ if co.co_flags & CO_VARARGS:
90
+ varargs = co.co_varnames[nargs]
91
+ nargs = nargs + 1
92
+ varkw = None
93
+ if co.co_flags & CO_VARKEYWORDS:
94
+ varkw = co.co_varnames[nargs]
95
+ return args, varargs, varkw
96
+
97
+ def getargspec(func):
98
+ """Get the names and default values of a function's arguments.
99
+
100
+ A tuple of four things is returned: (args, varargs, varkw, defaults).
101
+ 'args' is a list of the argument names (it may contain nested lists).
102
+ 'varargs' and 'varkw' are the names of the * and ** arguments or None.
103
+ 'defaults' is an n-tuple of the default values of the last n arguments.
104
+
105
+ """
106
+
107
+ if ismethod(func):
108
+ func = func.__func__
109
+ if not isfunction(func):
110
+ raise TypeError('arg is not a Python function')
111
+ args, varargs, varkw = getargs(func.__code__)
112
+ return args, varargs, varkw, func.__defaults__
113
+
114
+ def getargvalues(frame):
115
+ """Get information about arguments passed into a particular frame.
116
+
117
+ A tuple of four things is returned: (args, varargs, varkw, locals).
118
+ 'args' is a list of the argument names (it may contain nested lists).
119
+ 'varargs' and 'varkw' are the names of the * and ** arguments or None.
120
+ 'locals' is the locals dictionary of the given frame.
121
+
122
+ """
123
+ args, varargs, varkw = getargs(frame.f_code)
124
+ return args, varargs, varkw, frame.f_locals
125
+
126
+ def joinseq(seq):
127
+ if len(seq) == 1:
128
+ return '(' + seq[0] + ',)'
129
+ else:
130
+ return '(' + ', '.join(seq) + ')'
131
+
132
+ def strseq(object, convert, join=joinseq):
133
+ """Recursively walk a sequence, stringifying each element.
134
+
135
+ """
136
+ if type(object) in [list, tuple]:
137
+ return join([strseq(_o, convert, join) for _o in object])
138
+ else:
139
+ return convert(object)
140
+
141
+ def formatargspec(args, varargs=None, varkw=None, defaults=None,
142
+ formatarg=str,
143
+ formatvarargs=lambda name: '*' + name,
144
+ formatvarkw=lambda name: '**' + name,
145
+ formatvalue=lambda value: '=' + repr(value),
146
+ join=joinseq):
147
+ """Format an argument spec from the 4 values returned by getargspec.
148
+
149
+ The first four arguments are (args, varargs, varkw, defaults). The
150
+ other four arguments are the corresponding optional formatting functions
151
+ that are called to turn names and values into strings. The ninth
152
+ argument is an optional function to format the sequence of arguments.
153
+
154
+ """
155
+ specs = []
156
+ if defaults:
157
+ firstdefault = len(args) - len(defaults)
158
+ for i in range(len(args)):
159
+ spec = strseq(args[i], formatarg, join)
160
+ if defaults and i >= firstdefault:
161
+ spec = spec + formatvalue(defaults[i - firstdefault])
162
+ specs.append(spec)
163
+ if varargs is not None:
164
+ specs.append(formatvarargs(varargs))
165
+ if varkw is not None:
166
+ specs.append(formatvarkw(varkw))
167
+ return '(' + ', '.join(specs) + ')'
168
+
169
+ def formatargvalues(args, varargs, varkw, locals,
170
+ formatarg=str,
171
+ formatvarargs=lambda name: '*' + name,
172
+ formatvarkw=lambda name: '**' + name,
173
+ formatvalue=lambda value: '=' + repr(value),
174
+ join=joinseq):
175
+ """Format an argument spec from the 4 values returned by getargvalues.
176
+
177
+ The first four arguments are (args, varargs, varkw, locals). The
178
+ next four arguments are the corresponding optional formatting functions
179
+ that are called to turn names and values into strings. The ninth
180
+ argument is an optional function to format the sequence of arguments.
181
+
182
+ """
183
+ def convert(name, locals=locals,
184
+ formatarg=formatarg, formatvalue=formatvalue):
185
+ return formatarg(name) + formatvalue(locals[name])
186
+ specs = [strseq(arg, convert, join) for arg in args]
187
+
188
+ if varargs:
189
+ specs.append(formatvarargs(varargs) + formatvalue(locals[varargs]))
190
+ if varkw:
191
+ specs.append(formatvarkw(varkw) + formatvalue(locals[varkw]))
192
+ return '(' + ', '.join(specs) + ')'
.venv_haddock/lib/python3.12/site-packages/numpy/_utils/_inspect.pyi ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import types
2
+ from _typeshed import SupportsLenAndGetItem
3
+ from collections.abc import Callable, Mapping
4
+ from typing import Any, Final, TypeAlias, TypeVar, overload
5
+ from typing_extensions import TypeIs
6
+
7
+ __all__ = ["formatargspec", "getargspec"]
8
+
9
+ ###
10
+
11
+ _T = TypeVar("_T")
12
+ _RT = TypeVar("_RT")
13
+
14
+ _StrSeq: TypeAlias = SupportsLenAndGetItem[str]
15
+ _NestedSeq: TypeAlias = list[_T | _NestedSeq[_T]] | tuple[_T | _NestedSeq[_T], ...]
16
+
17
+ _JoinFunc: TypeAlias = Callable[[list[_T]], _T]
18
+ _FormatFunc: TypeAlias = Callable[[_T], str]
19
+
20
+ ###
21
+
22
+ CO_OPTIMIZED: Final = 1
23
+ CO_NEWLOCALS: Final = 2
24
+ CO_VARARGS: Final = 4
25
+ CO_VARKEYWORDS: Final = 8
26
+
27
+ ###
28
+
29
+ def ismethod(object: object) -> TypeIs[types.MethodType]: ...
30
+ def isfunction(object: object) -> TypeIs[types.FunctionType]: ...
31
+ def iscode(object: object) -> TypeIs[types.CodeType]: ...
32
+
33
+ ###
34
+
35
+ def getargs(co: types.CodeType) -> tuple[list[str], str | None, str | None]: ...
36
+ def getargspec(func: types.MethodType | types.FunctionType) -> tuple[list[str], str | None, str | None, tuple[Any, ...]]: ...
37
+ def getargvalues(frame: types.FrameType) -> tuple[list[str], str | None, str | None, dict[str, Any]]: ...
38
+
39
+ #
40
+ def joinseq(seq: _StrSeq) -> str: ...
41
+
42
+ #
43
+ @overload
44
+ def strseq(object: _NestedSeq[str], convert: Callable[[Any], Any], join: _JoinFunc[str] = ...) -> str: ...
45
+ @overload
46
+ def strseq(object: _NestedSeq[_T], convert: Callable[[_T], _RT], join: _JoinFunc[_RT]) -> _RT: ...
47
+
48
+ #
49
+ def formatargspec(
50
+ args: _StrSeq,
51
+ varargs: str | None = None,
52
+ varkw: str | None = None,
53
+ defaults: SupportsLenAndGetItem[object] | None = None,
54
+ formatarg: _FormatFunc[str] = ..., # str
55
+ formatvarargs: _FormatFunc[str] = ..., # "*{}".format
56
+ formatvarkw: _FormatFunc[str] = ..., # "**{}".format
57
+ formatvalue: _FormatFunc[object] = ..., # "={!r}".format
58
+ join: _JoinFunc[str] = ..., # joinseq
59
+ ) -> str: ...
60
+ def formatargvalues(
61
+ args: _StrSeq,
62
+ varargs: str | None,
63
+ varkw: str | None,
64
+ locals: Mapping[str, object] | None,
65
+ formatarg: _FormatFunc[str] = ..., # str
66
+ formatvarargs: _FormatFunc[str] = ..., # "*{}".format
67
+ formatvarkw: _FormatFunc[str] = ..., # "**{}".format
68
+ formatvalue: _FormatFunc[object] = ..., # "={!r}".format
69
+ join: _JoinFunc[str] = ..., # joinseq
70
+ ) -> str: ...
.venv_haddock/lib/python3.12/site-packages/numpy/_utils/_pep440.py ADDED
@@ -0,0 +1,486 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Utility to compare pep440 compatible version strings.
2
+
3
+ The LooseVersion and StrictVersion classes that distutils provides don't
4
+ work; they don't recognize anything like alpha/beta/rc/dev versions.
5
+ """
6
+
7
+ # Copyright (c) Donald Stufft and individual contributors.
8
+ # All rights reserved.
9
+
10
+ # Redistribution and use in source and binary forms, with or without
11
+ # modification, are permitted provided that the following conditions are met:
12
+
13
+ # 1. Redistributions of source code must retain the above copyright notice,
14
+ # this list of conditions and the following disclaimer.
15
+
16
+ # 2. Redistributions in binary form must reproduce the above copyright
17
+ # notice, this list of conditions and the following disclaimer in the
18
+ # documentation and/or other materials provided with the distribution.
19
+
20
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
+ # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
+ # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23
+ # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
24
+ # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25
+ # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26
+ # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27
+ # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28
+ # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29
+ # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30
+ # POSSIBILITY OF SUCH DAMAGE.
31
+
32
+ import collections
33
+ import itertools
34
+ import re
35
+
36
+ __all__ = [
37
+ "parse", "Version", "LegacyVersion", "InvalidVersion", "VERSION_PATTERN",
38
+ ]
39
+
40
+
41
+ # BEGIN packaging/_structures.py
42
+
43
+
44
+ class Infinity:
45
+ def __repr__(self):
46
+ return "Infinity"
47
+
48
+ def __hash__(self):
49
+ return hash(repr(self))
50
+
51
+ def __lt__(self, other):
52
+ return False
53
+
54
+ def __le__(self, other):
55
+ return False
56
+
57
+ def __eq__(self, other):
58
+ return isinstance(other, self.__class__)
59
+
60
+ def __ne__(self, other):
61
+ return not isinstance(other, self.__class__)
62
+
63
+ def __gt__(self, other):
64
+ return True
65
+
66
+ def __ge__(self, other):
67
+ return True
68
+
69
+ def __neg__(self):
70
+ return NegativeInfinity
71
+
72
+
73
+ Infinity = Infinity()
74
+
75
+
76
+ class NegativeInfinity:
77
+ def __repr__(self):
78
+ return "-Infinity"
79
+
80
+ def __hash__(self):
81
+ return hash(repr(self))
82
+
83
+ def __lt__(self, other):
84
+ return True
85
+
86
+ def __le__(self, other):
87
+ return True
88
+
89
+ def __eq__(self, other):
90
+ return isinstance(other, self.__class__)
91
+
92
+ def __ne__(self, other):
93
+ return not isinstance(other, self.__class__)
94
+
95
+ def __gt__(self, other):
96
+ return False
97
+
98
+ def __ge__(self, other):
99
+ return False
100
+
101
+ def __neg__(self):
102
+ return Infinity
103
+
104
+
105
+ # BEGIN packaging/version.py
106
+
107
+
108
+ NegativeInfinity = NegativeInfinity()
109
+
110
+ _Version = collections.namedtuple(
111
+ "_Version",
112
+ ["epoch", "release", "dev", "pre", "post", "local"],
113
+ )
114
+
115
+
116
+ def parse(version):
117
+ """
118
+ Parse the given version string and return either a :class:`Version` object
119
+ or a :class:`LegacyVersion` object depending on if the given version is
120
+ a valid PEP 440 version or a legacy version.
121
+ """
122
+ try:
123
+ return Version(version)
124
+ except InvalidVersion:
125
+ return LegacyVersion(version)
126
+
127
+
128
+ class InvalidVersion(ValueError):
129
+ """
130
+ An invalid version was found, users should refer to PEP 440.
131
+ """
132
+
133
+
134
+ class _BaseVersion:
135
+
136
+ def __hash__(self):
137
+ return hash(self._key)
138
+
139
+ def __lt__(self, other):
140
+ return self._compare(other, lambda s, o: s < o)
141
+
142
+ def __le__(self, other):
143
+ return self._compare(other, lambda s, o: s <= o)
144
+
145
+ def __eq__(self, other):
146
+ return self._compare(other, lambda s, o: s == o)
147
+
148
+ def __ge__(self, other):
149
+ return self._compare(other, lambda s, o: s >= o)
150
+
151
+ def __gt__(self, other):
152
+ return self._compare(other, lambda s, o: s > o)
153
+
154
+ def __ne__(self, other):
155
+ return self._compare(other, lambda s, o: s != o)
156
+
157
+ def _compare(self, other, method):
158
+ if not isinstance(other, _BaseVersion):
159
+ return NotImplemented
160
+
161
+ return method(self._key, other._key)
162
+
163
+
164
+ class LegacyVersion(_BaseVersion):
165
+
166
+ def __init__(self, version):
167
+ self._version = str(version)
168
+ self._key = _legacy_cmpkey(self._version)
169
+
170
+ def __str__(self):
171
+ return self._version
172
+
173
+ def __repr__(self):
174
+ return f"<LegacyVersion({str(self)!r})>"
175
+
176
+ @property
177
+ def public(self):
178
+ return self._version
179
+
180
+ @property
181
+ def base_version(self):
182
+ return self._version
183
+
184
+ @property
185
+ def local(self):
186
+ return None
187
+
188
+ @property
189
+ def is_prerelease(self):
190
+ return False
191
+
192
+ @property
193
+ def is_postrelease(self):
194
+ return False
195
+
196
+
197
+ _legacy_version_component_re = re.compile(
198
+ r"(\d+ | [a-z]+ | \.| -)", re.VERBOSE,
199
+ )
200
+
201
+ _legacy_version_replacement_map = {
202
+ "pre": "c", "preview": "c", "-": "final-", "rc": "c", "dev": "@",
203
+ }
204
+
205
+
206
+ def _parse_version_parts(s):
207
+ for part in _legacy_version_component_re.split(s):
208
+ part = _legacy_version_replacement_map.get(part, part)
209
+
210
+ if not part or part == ".":
211
+ continue
212
+
213
+ if part[:1] in "0123456789":
214
+ # pad for numeric comparison
215
+ yield part.zfill(8)
216
+ else:
217
+ yield "*" + part
218
+
219
+ # ensure that alpha/beta/candidate are before final
220
+ yield "*final"
221
+
222
+
223
+ def _legacy_cmpkey(version):
224
+ # We hardcode an epoch of -1 here. A PEP 440 version can only have an epoch
225
+ # greater than or equal to 0. This will effectively put the LegacyVersion,
226
+ # which uses the defacto standard originally implemented by setuptools,
227
+ # as before all PEP 440 versions.
228
+ epoch = -1
229
+
230
+ # This scheme is taken from pkg_resources.parse_version setuptools prior to
231
+ # its adoption of the packaging library.
232
+ parts = []
233
+ for part in _parse_version_parts(version.lower()):
234
+ if part.startswith("*"):
235
+ # remove "-" before a prerelease tag
236
+ if part < "*final":
237
+ while parts and parts[-1] == "*final-":
238
+ parts.pop()
239
+
240
+ # remove trailing zeros from each series of numeric parts
241
+ while parts and parts[-1] == "00000000":
242
+ parts.pop()
243
+
244
+ parts.append(part)
245
+ parts = tuple(parts)
246
+
247
+ return epoch, parts
248
+
249
+
250
+ # Deliberately not anchored to the start and end of the string, to make it
251
+ # easier for 3rd party code to reuse
252
+ VERSION_PATTERN = r"""
253
+ v?
254
+ (?:
255
+ (?:(?P<epoch>[0-9]+)!)? # epoch
256
+ (?P<release>[0-9]+(?:\.[0-9]+)*) # release segment
257
+ (?P<pre> # pre-release
258
+ [-_\.]?
259
+ (?P<pre_l>(a|b|c|rc|alpha|beta|pre|preview))
260
+ [-_\.]?
261
+ (?P<pre_n>[0-9]+)?
262
+ )?
263
+ (?P<post> # post release
264
+ (?:-(?P<post_n1>[0-9]+))
265
+ |
266
+ (?:
267
+ [-_\.]?
268
+ (?P<post_l>post|rev|r)
269
+ [-_\.]?
270
+ (?P<post_n2>[0-9]+)?
271
+ )
272
+ )?
273
+ (?P<dev> # dev release
274
+ [-_\.]?
275
+ (?P<dev_l>dev)
276
+ [-_\.]?
277
+ (?P<dev_n>[0-9]+)?
278
+ )?
279
+ )
280
+ (?:\+(?P<local>[a-z0-9]+(?:[-_\.][a-z0-9]+)*))? # local version
281
+ """
282
+
283
+
284
+ class Version(_BaseVersion):
285
+
286
+ _regex = re.compile(
287
+ r"^\s*" + VERSION_PATTERN + r"\s*$",
288
+ re.VERBOSE | re.IGNORECASE,
289
+ )
290
+
291
+ def __init__(self, version):
292
+ # Validate the version and parse it into pieces
293
+ match = self._regex.search(version)
294
+ if not match:
295
+ raise InvalidVersion(f"Invalid version: '{version}'")
296
+
297
+ # Store the parsed out pieces of the version
298
+ self._version = _Version(
299
+ epoch=int(match.group("epoch")) if match.group("epoch") else 0,
300
+ release=tuple(int(i) for i in match.group("release").split(".")),
301
+ pre=_parse_letter_version(
302
+ match.group("pre_l"),
303
+ match.group("pre_n"),
304
+ ),
305
+ post=_parse_letter_version(
306
+ match.group("post_l"),
307
+ match.group("post_n1") or match.group("post_n2"),
308
+ ),
309
+ dev=_parse_letter_version(
310
+ match.group("dev_l"),
311
+ match.group("dev_n"),
312
+ ),
313
+ local=_parse_local_version(match.group("local")),
314
+ )
315
+
316
+ # Generate a key which will be used for sorting
317
+ self._key = _cmpkey(
318
+ self._version.epoch,
319
+ self._version.release,
320
+ self._version.pre,
321
+ self._version.post,
322
+ self._version.dev,
323
+ self._version.local,
324
+ )
325
+
326
+ def __repr__(self):
327
+ return f"<Version({str(self)!r})>"
328
+
329
+ def __str__(self):
330
+ parts = []
331
+
332
+ # Epoch
333
+ if self._version.epoch != 0:
334
+ parts.append(f"{self._version.epoch}!")
335
+
336
+ # Release segment
337
+ parts.append(".".join(str(x) for x in self._version.release))
338
+
339
+ # Pre-release
340
+ if self._version.pre is not None:
341
+ parts.append("".join(str(x) for x in self._version.pre))
342
+
343
+ # Post-release
344
+ if self._version.post is not None:
345
+ parts.append(f".post{self._version.post[1]}")
346
+
347
+ # Development release
348
+ if self._version.dev is not None:
349
+ parts.append(f".dev{self._version.dev[1]}")
350
+
351
+ # Local version segment
352
+ if self._version.local is not None:
353
+ parts.append(
354
+ f"+{'.'.join(str(x) for x in self._version.local)}"
355
+ )
356
+
357
+ return "".join(parts)
358
+
359
+ @property
360
+ def public(self):
361
+ return str(self).split("+", 1)[0]
362
+
363
+ @property
364
+ def base_version(self):
365
+ parts = []
366
+
367
+ # Epoch
368
+ if self._version.epoch != 0:
369
+ parts.append(f"{self._version.epoch}!")
370
+
371
+ # Release segment
372
+ parts.append(".".join(str(x) for x in self._version.release))
373
+
374
+ return "".join(parts)
375
+
376
+ @property
377
+ def local(self):
378
+ version_string = str(self)
379
+ if "+" in version_string:
380
+ return version_string.split("+", 1)[1]
381
+
382
+ @property
383
+ def is_prerelease(self):
384
+ return bool(self._version.dev or self._version.pre)
385
+
386
+ @property
387
+ def is_postrelease(self):
388
+ return bool(self._version.post)
389
+
390
+
391
+ def _parse_letter_version(letter, number):
392
+ if letter:
393
+ # We assume there is an implicit 0 in a pre-release if there is
394
+ # no numeral associated with it.
395
+ if number is None:
396
+ number = 0
397
+
398
+ # We normalize any letters to their lower-case form
399
+ letter = letter.lower()
400
+
401
+ # We consider some words to be alternate spellings of other words and
402
+ # in those cases we want to normalize the spellings to our preferred
403
+ # spelling.
404
+ if letter == "alpha":
405
+ letter = "a"
406
+ elif letter == "beta":
407
+ letter = "b"
408
+ elif letter in ["c", "pre", "preview"]:
409
+ letter = "rc"
410
+ elif letter in ["rev", "r"]:
411
+ letter = "post"
412
+
413
+ return letter, int(number)
414
+ if not letter and number:
415
+ # We assume that if we are given a number but not given a letter,
416
+ # then this is using the implicit post release syntax (e.g., 1.0-1)
417
+ letter = "post"
418
+
419
+ return letter, int(number)
420
+
421
+
422
+ _local_version_seperators = re.compile(r"[\._-]")
423
+
424
+
425
+ def _parse_local_version(local):
426
+ """
427
+ Takes a string like abc.1.twelve and turns it into ("abc", 1, "twelve").
428
+ """
429
+ if local is not None:
430
+ return tuple(
431
+ part.lower() if not part.isdigit() else int(part)
432
+ for part in _local_version_seperators.split(local)
433
+ )
434
+
435
+
436
+ def _cmpkey(epoch, release, pre, post, dev, local):
437
+ # When we compare a release version, we want to compare it with all of the
438
+ # trailing zeros removed. So we'll use a reverse the list, drop all the now
439
+ # leading zeros until we come to something non-zero, then take the rest,
440
+ # re-reverse it back into the correct order, and make it a tuple and use
441
+ # that for our sorting key.
442
+ release = tuple(
443
+ reversed(list(
444
+ itertools.dropwhile(
445
+ lambda x: x == 0,
446
+ reversed(release),
447
+ )
448
+ ))
449
+ )
450
+
451
+ # We need to "trick" the sorting algorithm to put 1.0.dev0 before 1.0a0.
452
+ # We'll do this by abusing the pre-segment, but we _only_ want to do this
453
+ # if there is no pre- or a post-segment. If we have one of those, then
454
+ # the normal sorting rules will handle this case correctly.
455
+ if pre is None and post is None and dev is not None:
456
+ pre = -Infinity
457
+ # Versions without a pre-release (except as noted above) should sort after
458
+ # those with one.
459
+ elif pre is None:
460
+ pre = Infinity
461
+
462
+ # Versions without a post-segment should sort before those with one.
463
+ if post is None:
464
+ post = -Infinity
465
+
466
+ # Versions without a development segment should sort after those with one.
467
+ if dev is None:
468
+ dev = Infinity
469
+
470
+ if local is None:
471
+ # Versions without a local segment should sort before those with one.
472
+ local = -Infinity
473
+ else:
474
+ # Versions with a local segment need that segment parsed to implement
475
+ # the sorting rules in PEP440.
476
+ # - Alphanumeric segments sort before numeric segments
477
+ # - Alphanumeric segments sort lexicographically
478
+ # - Numeric segments sort numerically
479
+ # - Shorter versions sort before longer versions when the prefixes
480
+ # match exactly
481
+ local = tuple(
482
+ (i, "") if isinstance(i, int) else (-Infinity, i)
483
+ for i in local
484
+ )
485
+
486
+ return epoch, release, pre, post, dev, local
.venv_haddock/lib/python3.12/site-packages/numpy/_utils/_pep440.pyi ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import re
2
+ from collections.abc import Callable
3
+ from typing import (
4
+ Any,
5
+ ClassVar,
6
+ Final,
7
+ Generic,
8
+ Literal as L,
9
+ NamedTuple,
10
+ TypeVar,
11
+ final,
12
+ type_check_only,
13
+ )
14
+ from typing_extensions import TypeIs
15
+
16
+ __all__ = ["VERSION_PATTERN", "InvalidVersion", "LegacyVersion", "Version", "parse"]
17
+
18
+ ###
19
+
20
+ _CmpKeyT = TypeVar("_CmpKeyT", bound=tuple[object, ...])
21
+ _CmpKeyT_co = TypeVar("_CmpKeyT_co", bound=tuple[object, ...], default=tuple[Any, ...], covariant=True)
22
+
23
+ ###
24
+
25
+ VERSION_PATTERN: Final[str] = ...
26
+
27
+ class InvalidVersion(ValueError): ...
28
+
29
+ @type_check_only
30
+ @final
31
+ class _InfinityType:
32
+ def __hash__(self) -> int: ...
33
+ def __eq__(self, other: object, /) -> TypeIs[_InfinityType]: ...
34
+ def __ne__(self, other: object, /) -> bool: ...
35
+ def __lt__(self, other: object, /) -> L[False]: ...
36
+ def __le__(self, other: object, /) -> L[False]: ...
37
+ def __gt__(self, other: object, /) -> L[True]: ...
38
+ def __ge__(self, other: object, /) -> L[True]: ...
39
+ def __neg__(self) -> _NegativeInfinityType: ...
40
+
41
+ Infinity: Final[_InfinityType] = ...
42
+
43
+ @type_check_only
44
+ @final
45
+ class _NegativeInfinityType:
46
+ def __hash__(self) -> int: ...
47
+ def __eq__(self, other: object, /) -> TypeIs[_NegativeInfinityType]: ...
48
+ def __ne__(self, other: object, /) -> bool: ...
49
+ def __lt__(self, other: object, /) -> L[True]: ...
50
+ def __le__(self, other: object, /) -> L[True]: ...
51
+ def __gt__(self, other: object, /) -> L[False]: ...
52
+ def __ge__(self, other: object, /) -> L[False]: ...
53
+ def __neg__(self) -> _InfinityType: ...
54
+
55
+ NegativeInfinity: Final[_NegativeInfinityType] = ...
56
+
57
+ class _Version(NamedTuple):
58
+ epoch: int
59
+ release: tuple[int, ...]
60
+ dev: tuple[str, int] | None
61
+ pre: tuple[str, int] | None
62
+ post: tuple[str, int] | None
63
+ local: tuple[str | int, ...] | None
64
+
65
+ class _BaseVersion(Generic[_CmpKeyT_co]):
66
+ _key: _CmpKeyT_co
67
+ def __hash__(self) -> int: ...
68
+ def __eq__(self, other: _BaseVersion, /) -> bool: ... # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride]
69
+ def __ne__(self, other: _BaseVersion, /) -> bool: ... # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride]
70
+ def __lt__(self, other: _BaseVersion, /) -> bool: ...
71
+ def __le__(self, other: _BaseVersion, /) -> bool: ...
72
+ def __ge__(self, other: _BaseVersion, /) -> bool: ...
73
+ def __gt__(self, other: _BaseVersion, /) -> bool: ...
74
+ def _compare(self, /, other: _BaseVersion[_CmpKeyT], method: Callable[[_CmpKeyT_co, _CmpKeyT], bool]) -> bool: ...
75
+
76
+ class LegacyVersion(_BaseVersion[tuple[L[-1], tuple[str, ...]]]):
77
+ _version: Final[str]
78
+ def __init__(self, /, version: str) -> None: ...
79
+ @property
80
+ def public(self) -> str: ...
81
+ @property
82
+ def base_version(self) -> str: ...
83
+ @property
84
+ def local(self) -> None: ...
85
+ @property
86
+ def is_prerelease(self) -> L[False]: ...
87
+ @property
88
+ def is_postrelease(self) -> L[False]: ...
89
+
90
+ class Version(
91
+ _BaseVersion[
92
+ tuple[
93
+ int, # epoch
94
+ tuple[int, ...], # release
95
+ tuple[str, int] | _InfinityType | _NegativeInfinityType, # pre
96
+ tuple[str, int] | _NegativeInfinityType, # post
97
+ tuple[str, int] | _InfinityType, # dev
98
+ tuple[tuple[int, L[""]] | tuple[_NegativeInfinityType, str], ...] | _NegativeInfinityType, # local
99
+ ],
100
+ ],
101
+ ):
102
+ _regex: ClassVar[re.Pattern[str]] = ...
103
+ _version: Final[str]
104
+
105
+ def __init__(self, /, version: str) -> None: ...
106
+ @property
107
+ def public(self) -> str: ...
108
+ @property
109
+ def base_version(self) -> str: ...
110
+ @property
111
+ def local(self) -> str | None: ...
112
+ @property
113
+ def is_prerelease(self) -> bool: ...
114
+ @property
115
+ def is_postrelease(self) -> bool: ...
116
+
117
+ #
118
+ def parse(version: str) -> Version | LegacyVersion: ...
.venv_haddock/lib/python3.12/site-packages/numpy/char/.___init__.py ADDED
Binary file (4.1 kB). View file
 
.venv_haddock/lib/python3.12/site-packages/numpy/char/.___init__.pyi ADDED
Binary file (4.1 kB). View file
 
.venv_haddock/lib/python3.12/site-packages/numpy/char/.___pycache__ ADDED
Binary file (4.1 kB). View file
 
.venv_haddock/lib/python3.12/site-packages/numpy/char/__init__.py ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ from numpy._core.defchararray import *
2
+ from numpy._core.defchararray import __all__, __doc__
.venv_haddock/lib/python3.12/site-packages/numpy/char/__init__.pyi ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from numpy._core.defchararray import (
2
+ add,
3
+ array,
4
+ asarray,
5
+ capitalize,
6
+ center,
7
+ chararray,
8
+ compare_chararrays,
9
+ count,
10
+ decode,
11
+ encode,
12
+ endswith,
13
+ equal,
14
+ expandtabs,
15
+ find,
16
+ greater,
17
+ greater_equal,
18
+ index,
19
+ isalnum,
20
+ isalpha,
21
+ isdecimal,
22
+ isdigit,
23
+ islower,
24
+ isnumeric,
25
+ isspace,
26
+ istitle,
27
+ isupper,
28
+ join,
29
+ less,
30
+ less_equal,
31
+ ljust,
32
+ lower,
33
+ lstrip,
34
+ mod,
35
+ multiply,
36
+ not_equal,
37
+ partition,
38
+ replace,
39
+ rfind,
40
+ rindex,
41
+ rjust,
42
+ rpartition,
43
+ rsplit,
44
+ rstrip,
45
+ split,
46
+ splitlines,
47
+ startswith,
48
+ str_len,
49
+ strip,
50
+ swapcase,
51
+ title,
52
+ translate,
53
+ upper,
54
+ zfill,
55
+ )
56
+
57
+ __all__ = [
58
+ "equal",
59
+ "not_equal",
60
+ "greater_equal",
61
+ "less_equal",
62
+ "greater",
63
+ "less",
64
+ "str_len",
65
+ "add",
66
+ "multiply",
67
+ "mod",
68
+ "capitalize",
69
+ "center",
70
+ "count",
71
+ "decode",
72
+ "encode",
73
+ "endswith",
74
+ "expandtabs",
75
+ "find",
76
+ "index",
77
+ "isalnum",
78
+ "isalpha",
79
+ "isdigit",
80
+ "islower",
81
+ "isspace",
82
+ "istitle",
83
+ "isupper",
84
+ "join",
85
+ "ljust",
86
+ "lower",
87
+ "lstrip",
88
+ "partition",
89
+ "replace",
90
+ "rfind",
91
+ "rindex",
92
+ "rjust",
93
+ "rpartition",
94
+ "rsplit",
95
+ "rstrip",
96
+ "split",
97
+ "splitlines",
98
+ "startswith",
99
+ "strip",
100
+ "swapcase",
101
+ "title",
102
+ "translate",
103
+ "upper",
104
+ "zfill",
105
+ "isnumeric",
106
+ "isdecimal",
107
+ "array",
108
+ "asarray",
109
+ "compare_chararrays",
110
+ "chararray",
111
+ ]
.venv_haddock/lib/python3.12/site-packages/numpy/conftest.py ADDED
@@ -0,0 +1,248 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Pytest configuration and fixtures for the Numpy test suite.
3
+ """
4
+ import os
5
+ import sys
6
+ import tempfile
7
+ import warnings
8
+ from contextlib import contextmanager
9
+ from pathlib import Path
10
+
11
+ import hypothesis
12
+ import pytest
13
+
14
+ import numpy
15
+ from numpy._core._multiarray_tests import get_fpu_mode
16
+ from numpy.testing._private.utils import NOGIL_BUILD
17
+
18
+ try:
19
+ from scipy_doctest.conftest import dt_config
20
+ HAVE_SCPDT = True
21
+ except ModuleNotFoundError:
22
+ HAVE_SCPDT = False
23
+
24
+ try:
25
+ import pytest_run_parallel # noqa: F401
26
+ PARALLEL_RUN_AVALIABLE = True
27
+ except ModuleNotFoundError:
28
+ PARALLEL_RUN_AVALIABLE = False
29
+
30
+ _old_fpu_mode = None
31
+ _collect_results = {}
32
+
33
+ # Use a known and persistent tmpdir for hypothesis' caches, which
34
+ # can be automatically cleared by the OS or user.
35
+ hypothesis.configuration.set_hypothesis_home_dir(
36
+ os.path.join(tempfile.gettempdir(), ".hypothesis")
37
+ )
38
+
39
+ # We register two custom profiles for Numpy - for details see
40
+ # https://hypothesis.readthedocs.io/en/latest/settings.html
41
+ # The first is designed for our own CI runs; the latter also
42
+ # forces determinism and is designed for use via np.test()
43
+ hypothesis.settings.register_profile(
44
+ name="numpy-profile", deadline=None, print_blob=True,
45
+ )
46
+ hypothesis.settings.register_profile(
47
+ name="np.test() profile",
48
+ deadline=None, print_blob=True, database=None, derandomize=True,
49
+ suppress_health_check=list(hypothesis.HealthCheck),
50
+ )
51
+ # Note that the default profile is chosen based on the presence
52
+ # of pytest.ini, but can be overridden by passing the
53
+ # --hypothesis-profile=NAME argument to pytest.
54
+ _pytest_ini = os.path.join(os.path.dirname(__file__), "..", "pytest.ini")
55
+ hypothesis.settings.load_profile(
56
+ "numpy-profile" if os.path.isfile(_pytest_ini) else "np.test() profile"
57
+ )
58
+
59
+ # The experimentalAPI is used in _umath_tests
60
+ os.environ["NUMPY_EXPERIMENTAL_DTYPE_API"] = "1"
61
+
62
+ def pytest_configure(config):
63
+ config.addinivalue_line("markers",
64
+ "valgrind_error: Tests that are known to error under valgrind.")
65
+ config.addinivalue_line("markers",
66
+ "leaks_references: Tests that are known to leak references.")
67
+ config.addinivalue_line("markers",
68
+ "slow: Tests that are very slow.")
69
+ config.addinivalue_line("markers",
70
+ "slow_pypy: Tests that are very slow on pypy.")
71
+ if not PARALLEL_RUN_AVALIABLE:
72
+ config.addinivalue_line("markers",
73
+ "parallel_threads(n): run the given test function in parallel "
74
+ "using `n` threads.",
75
+ )
76
+ config.addinivalue_line("markers",
77
+ "iterations(n): run the given test function `n` times in each thread",
78
+ )
79
+ config.addinivalue_line("markers",
80
+ "thread_unsafe: mark the test function as single-threaded",
81
+ )
82
+
83
+
84
+ def pytest_addoption(parser):
85
+ parser.addoption("--available-memory", action="store", default=None,
86
+ help=("Set amount of memory available for running the "
87
+ "test suite. This can result to tests requiring "
88
+ "especially large amounts of memory to be skipped. "
89
+ "Equivalent to setting environment variable "
90
+ "NPY_AVAILABLE_MEM. Default: determined"
91
+ "automatically."))
92
+
93
+
94
+ gil_enabled_at_start = True
95
+ if NOGIL_BUILD:
96
+ gil_enabled_at_start = sys._is_gil_enabled()
97
+
98
+
99
+ def pytest_sessionstart(session):
100
+ available_mem = session.config.getoption('available_memory')
101
+ if available_mem is not None:
102
+ os.environ['NPY_AVAILABLE_MEM'] = available_mem
103
+
104
+
105
+ def pytest_terminal_summary(terminalreporter, exitstatus, config):
106
+ if NOGIL_BUILD and not gil_enabled_at_start and sys._is_gil_enabled():
107
+ tr = terminalreporter
108
+ tr.ensure_newline()
109
+ tr.section("GIL re-enabled", sep="=", red=True, bold=True)
110
+ tr.line("The GIL was re-enabled at runtime during the tests.")
111
+ tr.line("This can happen with no test failures if the RuntimeWarning")
112
+ tr.line("raised by Python when this happens is filtered by a test.")
113
+ tr.line("")
114
+ tr.line("Please ensure all new C modules declare support for running")
115
+ tr.line("without the GIL. Any new tests that intentionally imports ")
116
+ tr.line("code that re-enables the GIL should do so in a subprocess.")
117
+ pytest.exit("GIL re-enabled during tests", returncode=1)
118
+
119
+ # FIXME when yield tests are gone.
120
+ @pytest.hookimpl(tryfirst=True)
121
+ def pytest_itemcollected(item):
122
+ """
123
+ Check FPU precision mode was not changed during test collection.
124
+
125
+ The clumsy way we do it here is mainly necessary because numpy
126
+ still uses yield tests, which can execute code at test collection
127
+ time.
128
+ """
129
+ global _old_fpu_mode
130
+
131
+ mode = get_fpu_mode()
132
+
133
+ if _old_fpu_mode is None:
134
+ _old_fpu_mode = mode
135
+ elif mode != _old_fpu_mode:
136
+ _collect_results[item] = (_old_fpu_mode, mode)
137
+ _old_fpu_mode = mode
138
+
139
+ # mark f2py tests as thread unsafe
140
+ if Path(item.fspath).parent == Path(__file__).parent / 'f2py' / 'tests':
141
+ item.add_marker(pytest.mark.thread_unsafe(
142
+ reason="f2py tests are thread-unsafe"))
143
+
144
+
145
+ @pytest.fixture(scope="function", autouse=True)
146
+ def check_fpu_mode(request):
147
+ """
148
+ Check FPU precision mode was not changed during the test.
149
+ """
150
+ old_mode = get_fpu_mode()
151
+ yield
152
+ new_mode = get_fpu_mode()
153
+
154
+ if old_mode != new_mode:
155
+ raise AssertionError(f"FPU precision mode changed from {old_mode:#x} to "
156
+ f"{new_mode:#x} during the test")
157
+
158
+ collect_result = _collect_results.get(request.node)
159
+ if collect_result is not None:
160
+ old_mode, new_mode = collect_result
161
+ raise AssertionError(f"FPU precision mode changed from {old_mode:#x} to "
162
+ f"{new_mode:#x} when collecting the test")
163
+
164
+
165
+ @pytest.fixture(autouse=True)
166
+ def add_np(doctest_namespace):
167
+ doctest_namespace['np'] = numpy
168
+
169
+
170
+ if HAVE_SCPDT:
171
+
172
+ @contextmanager
173
+ def warnings_errors_and_rng(test=None):
174
+ """Filter out the wall of DeprecationWarnings.
175
+ """
176
+ msgs = ["The numpy.linalg.linalg",
177
+ "The numpy.fft.helper",
178
+ "dep_util",
179
+ "pkg_resources",
180
+ "numpy.core.umath",
181
+ "msvccompiler",
182
+ "Deprecated call",
183
+ "numpy.core",
184
+ "Importing from numpy.matlib",
185
+ "This function is deprecated.", # random_integers
186
+ "Data type alias 'a'", # numpy.rec.fromfile
187
+ "Arrays of 2-dimensional vectors", # matlib.cross
188
+ "NumPy warning suppression and assertion utilities are deprecated."
189
+ ]
190
+ msg = "|".join(msgs)
191
+
192
+ msgs_r = [
193
+ "invalid value encountered",
194
+ "divide by zero encountered"
195
+ ]
196
+ msg_r = "|".join(msgs_r)
197
+
198
+ with warnings.catch_warnings():
199
+ warnings.filterwarnings(
200
+ 'ignore', category=DeprecationWarning, message=msg
201
+ )
202
+ warnings.filterwarnings(
203
+ 'ignore', category=RuntimeWarning, message=msg_r
204
+ )
205
+ yield
206
+
207
+ # find and check doctests under this context manager
208
+ dt_config.user_context_mgr = warnings_errors_and_rng
209
+
210
+ # numpy specific tweaks from refguide-check
211
+ dt_config.rndm_markers.add('#uninitialized')
212
+ dt_config.rndm_markers.add('# uninitialized')
213
+
214
+ # make the checker pick on mismatched dtypes
215
+ dt_config.strict_check = True
216
+
217
+ import doctest
218
+ dt_config.optionflags = doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS
219
+
220
+ # recognize the StringDType repr
221
+ dt_config.check_namespace['StringDType'] = numpy.dtypes.StringDType
222
+
223
+ # temporary skips
224
+ dt_config.skiplist = {
225
+ 'numpy.savez', # unclosed file
226
+ 'numpy.matlib.savez',
227
+ 'numpy.__array_namespace_info__',
228
+ 'numpy.matlib.__array_namespace_info__',
229
+ }
230
+
231
+ # xfail problematic tutorials
232
+ dt_config.pytest_extra_xfail = {
233
+ 'how-to-verify-bug.rst': '',
234
+ 'c-info.ufunc-tutorial.rst': '',
235
+ 'basics.interoperability.rst': 'needs pandas',
236
+ 'basics.dispatch.rst': 'errors out in /testing/overrides.py',
237
+ 'basics.subclassing.rst': '.. testcode:: admonitions not understood',
238
+ 'misc.rst': 'manipulates warnings',
239
+ }
240
+
241
+ # ignores are for things fail doctest collection (optionals etc)
242
+ dt_config.pytest_extra_ignore = [
243
+ 'numpy/distutils',
244
+ 'numpy/_core/cversions.py',
245
+ 'numpy/_pyinstaller',
246
+ 'numpy/random/_examples',
247
+ 'numpy/f2py/_backends/_distutils.py',
248
+ ]
.venv_haddock/lib/python3.12/site-packages/numpy/core/.___init__.py ADDED
Binary file (4.1 kB). View file
 
.venv_haddock/lib/python3.12/site-packages/numpy/core/.___init__.pyi ADDED
Binary file (4.1 kB). View file
 
.venv_haddock/lib/python3.12/site-packages/numpy/core/.___pycache__ ADDED
Binary file (4.1 kB). View file
 
.venv_haddock/lib/python3.12/site-packages/numpy/core/.__dtype.py ADDED
Binary file (4.1 kB). View file
 
.venv_haddock/lib/python3.12/site-packages/numpy/core/.__dtype.pyi ADDED
Binary file (4.1 kB). View file
 
.venv_haddock/lib/python3.12/site-packages/numpy/core/.__dtype_ctypes.py ADDED
Binary file (4.1 kB). View file
 
.venv_haddock/lib/python3.12/site-packages/numpy/core/.__dtype_ctypes.pyi ADDED
Binary file (4.1 kB). View file
 
.venv_haddock/lib/python3.12/site-packages/numpy/core/.__internal.py ADDED
Binary file (4.1 kB). View file
 
.venv_haddock/lib/python3.12/site-packages/numpy/core/.__multiarray_umath.py ADDED
Binary file (4.1 kB). View file
 
.venv_haddock/lib/python3.12/site-packages/numpy/core/.__utils.py ADDED
Binary file (4.1 kB). View file
 
.venv_haddock/lib/python3.12/site-packages/numpy/core/._arrayprint.py ADDED
Binary file (4.1 kB). View file
 
.venv_haddock/lib/python3.12/site-packages/numpy/core/._defchararray.py ADDED
Binary file (4.1 kB). View file
 
.venv_haddock/lib/python3.12/site-packages/numpy/core/._einsumfunc.py ADDED
Binary file (4.1 kB). View file
 
.venv_haddock/lib/python3.12/site-packages/numpy/core/._fromnumeric.py ADDED
Binary file (4.1 kB). View file