numpy 2.3.2__cp313-cp313-win32.whl → 2.3.4__cp313-cp313-win32.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of numpy might be problematic. Click here for more details.
- numpy/__config__.py +4 -4
- numpy/__init__.pyi +1101 -340
- numpy/_core/_multiarray_tests.cp313-win32.lib +0 -0
- numpy/_core/_multiarray_tests.cp313-win32.pyd +0 -0
- numpy/_core/_multiarray_umath.cp313-win32.lib +0 -0
- numpy/_core/_multiarray_umath.cp313-win32.pyd +0 -0
- numpy/_core/_operand_flag_tests.cp313-win32.lib +0 -0
- numpy/_core/_operand_flag_tests.cp313-win32.pyd +0 -0
- numpy/_core/_rational_tests.cp313-win32.lib +0 -0
- numpy/_core/_rational_tests.cp313-win32.pyd +0 -0
- numpy/_core/_simd.cp313-win32.lib +0 -0
- numpy/_core/_simd.cp313-win32.pyd +0 -0
- numpy/_core/_struct_ufunc_tests.cp313-win32.lib +0 -0
- numpy/_core/_struct_ufunc_tests.cp313-win32.pyd +0 -0
- numpy/_core/_ufunc_config.py +2 -0
- numpy/_core/_ufunc_config.pyi +52 -6
- numpy/_core/_umath_tests.cp313-win32.lib +0 -0
- numpy/_core/_umath_tests.cp313-win32.pyd +0 -0
- numpy/_core/lib/npymath.lib +0 -0
- numpy/_core/lib/pkgconfig/numpy.pc +1 -1
- numpy/_core/numerictypes.py +1 -1
- numpy/_core/tests/test_api.py +34 -1
- numpy/_core/tests/test_datetime.py +24 -0
- numpy/_core/tests/test_numerictypes.py +29 -0
- numpy/_core/tests/test_stringdtype.py +23 -16
- numpy/_core/tests/test_strings.py +15 -0
- numpy/_core/tests/test_umath.py +12 -0
- numpy/exceptions.pyi +2 -0
- numpy/fft/_pocketfft_umath.cp313-win32.lib +0 -0
- numpy/fft/_pocketfft_umath.cp313-win32.pyd +0 -0
- numpy/lib/_arraysetops_impl.pyi +24 -0
- numpy/lib/_histograms_impl.pyi +8 -8
- numpy/lib/_index_tricks_impl.pyi +12 -0
- numpy/lib/_polynomial_impl.pyi +10 -8
- numpy/lib/mixins.pyi +2 -0
- numpy/lib/tests/test_index_tricks.py +5 -0
- numpy/linalg/_linalg.py +1 -0
- numpy/linalg/_linalg.pyi +32 -39
- numpy/linalg/_umath_linalg.cp313-win32.lib +0 -0
- numpy/linalg/_umath_linalg.cp313-win32.pyd +0 -0
- numpy/linalg/lapack_lite.cp313-win32.lib +0 -0
- numpy/linalg/lapack_lite.cp313-win32.pyd +0 -0
- numpy/linalg/tests/test_linalg.py +14 -1
- numpy/ma/extras.pyi +4 -0
- numpy/random/_bounded_integers.cp313-win32.lib +0 -0
- numpy/random/_bounded_integers.cp313-win32.pyd +0 -0
- numpy/random/_common.cp313-win32.lib +0 -0
- numpy/random/_common.cp313-win32.pyd +0 -0
- numpy/random/_generator.cp313-win32.lib +0 -0
- numpy/random/_generator.cp313-win32.pyd +0 -0
- numpy/random/_mt19937.cp313-win32.lib +0 -0
- numpy/random/_mt19937.cp313-win32.pyd +0 -0
- numpy/random/_pcg64.cp313-win32.lib +0 -0
- numpy/random/_pcg64.cp313-win32.pyd +0 -0
- numpy/random/_philox.cp313-win32.lib +0 -0
- numpy/random/_philox.cp313-win32.pyd +0 -0
- numpy/random/_sfc64.cp313-win32.lib +0 -0
- numpy/random/_sfc64.cp313-win32.pyd +0 -0
- numpy/random/bit_generator.cp313-win32.lib +0 -0
- numpy/random/bit_generator.cp313-win32.pyd +0 -0
- numpy/random/lib/npyrandom.lib +0 -0
- numpy/random/mtrand.cp313-win32.lib +0 -0
- numpy/random/mtrand.cp313-win32.pyd +0 -0
- numpy/random/tests/test_generator_mt19937.py +5 -0
- numpy/testing/_private/extbuild.pyi +3 -3
- numpy/testing/_private/utils.pyi +1 -1
- numpy/tests/test_configtool.py +1 -1
- numpy/typing/tests/data/fail/arithmetic.pyi +1 -1
- numpy/typing/tests/data/fail/bitwise_ops.pyi +4 -4
- numpy/typing/tests/data/fail/scalars.pyi +6 -6
- numpy/typing/tests/data/reveal/arithmetic.pyi +29 -29
- numpy/typing/tests/data/reveal/array_constructors.pyi +5 -5
- numpy/typing/tests/data/reveal/bitwise_ops.pyi +10 -11
- numpy/typing/tests/data/reveal/linalg.pyi +6 -6
- numpy/typing/tests/data/reveal/mod.pyi +18 -19
- numpy/version.py +2 -2
- {numpy-2.3.2.dist-info → numpy-2.3.4.dist-info}/LICENSE.txt +881 -881
- {numpy-2.3.2.dist-info → numpy-2.3.4.dist-info}/METADATA +1 -1
- {numpy-2.3.2.dist-info → numpy-2.3.4.dist-info}/RECORD +81 -82
- numpy/_typing/_callable.pyi +0 -366
- {numpy-2.3.2.dist-info → numpy-2.3.4.dist-info}/WHEEL +0 -0
- {numpy-2.3.2.dist-info → numpy-2.3.4.dist-info}/entry_points.txt +0 -0
numpy/lib/mixins.pyi
CHANGED
|
@@ -199,6 +199,11 @@ class TestRavelUnravelIndex:
|
|
|
199
199
|
with assert_raises(ValueError):
|
|
200
200
|
np.unravel_index([1], (2, 1, 0))
|
|
201
201
|
|
|
202
|
+
def test_regression_size_1_index(self):
|
|
203
|
+
# actually tests the nditer size one index tracking
|
|
204
|
+
# regression test for gh-29690
|
|
205
|
+
np.unravel_index(np.array([[1, 0, 1, 0]], dtype=np.uint32), (4,))
|
|
206
|
+
|
|
202
207
|
class TestGrid:
|
|
203
208
|
def test_basic(self):
|
|
204
209
|
a = mgrid[-1:1:10j]
|
numpy/linalg/_linalg.py
CHANGED
|
@@ -2029,6 +2029,7 @@ def cond(x, p=None):
|
|
|
2029
2029
|
# contain nans in the entries where inversion failed.
|
|
2030
2030
|
_assert_stacked_square(x)
|
|
2031
2031
|
t, result_t = _commonType(x)
|
|
2032
|
+
result_t = _realType(result_t) # condition number is always real
|
|
2032
2033
|
signature = 'D->D' if isComplexType(t) else 'd->d'
|
|
2033
2034
|
with errstate(all='ignore'):
|
|
2034
2035
|
invx = _umath_linalg.inv(x, signature=signature)
|
numpy/linalg/_linalg.pyi
CHANGED
|
@@ -28,6 +28,7 @@ from numpy import (
|
|
|
28
28
|
)
|
|
29
29
|
from numpy._core.fromnumeric import matrix_transpose
|
|
30
30
|
from numpy._core.numeric import tensordot
|
|
31
|
+
from numpy._globals import _NoValueType
|
|
31
32
|
from numpy._typing import (
|
|
32
33
|
ArrayLike,
|
|
33
34
|
DTypeLike,
|
|
@@ -78,7 +79,7 @@ __all__ = [
|
|
|
78
79
|
"vecdot",
|
|
79
80
|
]
|
|
80
81
|
|
|
81
|
-
|
|
82
|
+
_NumberT = TypeVar("_NumberT", bound=np.number)
|
|
82
83
|
|
|
83
84
|
_ModeKind: TypeAlias = L["reduced", "complete", "r", "raw"]
|
|
84
85
|
|
|
@@ -182,33 +183,29 @@ def cholesky(a: _ArrayLikeFloat_co, /, *, upper: bool = False) -> NDArray[floati
|
|
|
182
183
|
def cholesky(a: _ArrayLikeComplex_co, /, *, upper: bool = False) -> NDArray[complexfloating]: ...
|
|
183
184
|
|
|
184
185
|
@overload
|
|
185
|
-
def outer(x1: _ArrayLike[Never], x2: _ArrayLike[Never]) -> NDArray[Any]: ...
|
|
186
|
+
def outer(x1: _ArrayLike[Never], x2: _ArrayLike[Never], /) -> NDArray[Any]: ...
|
|
186
187
|
@overload
|
|
187
|
-
def outer(x1: _ArrayLikeBool_co, x2: _ArrayLikeBool_co) -> NDArray[np.bool]: ...
|
|
188
|
+
def outer(x1: _ArrayLikeBool_co, x2: _ArrayLikeBool_co, /) -> NDArray[np.bool]: ...
|
|
188
189
|
@overload
|
|
189
|
-
def outer(x1:
|
|
190
|
+
def outer(x1: _ArrayLike[_NumberT], x2: _ArrayLike[_NumberT], /) -> NDArray[_NumberT]: ...
|
|
190
191
|
@overload
|
|
191
|
-
def outer(x1:
|
|
192
|
+
def outer(x1: _ArrayLikeUInt_co, x2: _ArrayLikeUInt_co, /) -> NDArray[unsignedinteger]: ...
|
|
192
193
|
@overload
|
|
193
|
-
def outer(x1:
|
|
194
|
+
def outer(x1: _ArrayLikeInt_co, x2: _ArrayLikeInt_co, /) -> NDArray[signedinteger]: ...
|
|
194
195
|
@overload
|
|
195
|
-
def outer(
|
|
196
|
-
x1: _ArrayLikeComplex_co,
|
|
197
|
-
x2: _ArrayLikeComplex_co,
|
|
198
|
-
) -> NDArray[complexfloating]: ...
|
|
196
|
+
def outer(x1: _ArrayLikeFloat_co, x2: _ArrayLikeFloat_co, /) -> NDArray[floating]: ...
|
|
199
197
|
@overload
|
|
200
|
-
def outer(
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
out: None = ...,
|
|
204
|
-
) -> NDArray[timedelta64]: ...
|
|
198
|
+
def outer(x1: _ArrayLikeComplex_co, x2: _ArrayLikeComplex_co, /) -> NDArray[complexfloating]: ...
|
|
199
|
+
@overload
|
|
200
|
+
def outer(x1: _ArrayLikeTD64_co, x2: _ArrayLikeTD64_co, /) -> NDArray[timedelta64]: ...
|
|
205
201
|
@overload
|
|
206
|
-
def outer(x1: _ArrayLikeObject_co, x2: _ArrayLikeObject_co) -> NDArray[object_]: ...
|
|
202
|
+
def outer(x1: _ArrayLikeObject_co, x2: _ArrayLikeObject_co, /) -> NDArray[object_]: ...
|
|
207
203
|
@overload
|
|
208
204
|
def outer(
|
|
209
205
|
x1: _ArrayLikeComplex_co | _ArrayLikeTD64_co | _ArrayLikeObject_co,
|
|
210
206
|
x2: _ArrayLikeComplex_co | _ArrayLikeTD64_co | _ArrayLikeObject_co,
|
|
211
|
-
|
|
207
|
+
/,
|
|
208
|
+
) -> NDArray[Any]: ...
|
|
212
209
|
|
|
213
210
|
@overload
|
|
214
211
|
def qr(a: _ArrayLikeInt_co, mode: _ModeKind = ...) -> QRResult: ...
|
|
@@ -308,20 +305,26 @@ def matrix_rank(
|
|
|
308
305
|
@overload
|
|
309
306
|
def pinv(
|
|
310
307
|
a: _ArrayLikeInt_co,
|
|
311
|
-
rcond: _ArrayLikeFloat_co =
|
|
312
|
-
hermitian: bool =
|
|
308
|
+
rcond: _ArrayLikeFloat_co | None = None,
|
|
309
|
+
hermitian: bool = False,
|
|
310
|
+
*,
|
|
311
|
+
rtol: _ArrayLikeFloat_co | _NoValueType = ...,
|
|
313
312
|
) -> NDArray[float64]: ...
|
|
314
313
|
@overload
|
|
315
314
|
def pinv(
|
|
316
315
|
a: _ArrayLikeFloat_co,
|
|
317
|
-
rcond: _ArrayLikeFloat_co =
|
|
318
|
-
hermitian: bool =
|
|
316
|
+
rcond: _ArrayLikeFloat_co | None = None,
|
|
317
|
+
hermitian: bool = False,
|
|
318
|
+
*,
|
|
319
|
+
rtol: _ArrayLikeFloat_co | _NoValueType = ...,
|
|
319
320
|
) -> NDArray[floating]: ...
|
|
320
321
|
@overload
|
|
321
322
|
def pinv(
|
|
322
323
|
a: _ArrayLikeComplex_co,
|
|
323
|
-
rcond: _ArrayLikeFloat_co =
|
|
324
|
-
hermitian: bool =
|
|
324
|
+
rcond: _ArrayLikeFloat_co | None = None,
|
|
325
|
+
hermitian: bool = False,
|
|
326
|
+
*,
|
|
327
|
+
rtol: _ArrayLikeFloat_co | _NoValueType = ...,
|
|
325
328
|
) -> NDArray[complexfloating]: ...
|
|
326
329
|
|
|
327
330
|
# TODO: Returns a 2-tuple of scalars for 2D arrays and
|
|
@@ -461,22 +464,12 @@ def cross(
|
|
|
461
464
|
) -> NDArray[complexfloating]: ...
|
|
462
465
|
|
|
463
466
|
@overload
|
|
464
|
-
def matmul(
|
|
465
|
-
x1: _ArrayLikeInt_co,
|
|
466
|
-
x2: _ArrayLikeInt_co,
|
|
467
|
-
) -> NDArray[signedinteger]: ...
|
|
467
|
+
def matmul(x1: _ArrayLike[_NumberT], x2: _ArrayLike[_NumberT], /) -> NDArray[_NumberT]: ...
|
|
468
468
|
@overload
|
|
469
|
-
def matmul(
|
|
470
|
-
x1: _ArrayLikeUInt_co,
|
|
471
|
-
x2: _ArrayLikeUInt_co,
|
|
472
|
-
) -> NDArray[unsignedinteger]: ...
|
|
469
|
+
def matmul(x1: _ArrayLikeInt_co, x2: _ArrayLikeInt_co, /) -> NDArray[signedinteger]: ...
|
|
473
470
|
@overload
|
|
474
|
-
def matmul(
|
|
475
|
-
x1: _ArrayLikeFloat_co,
|
|
476
|
-
x2: _ArrayLikeFloat_co,
|
|
477
|
-
) -> NDArray[floating]: ...
|
|
471
|
+
def matmul(x1: _ArrayLikeUInt_co, x2: _ArrayLikeUInt_co, /) -> NDArray[unsignedinteger]: ...
|
|
478
472
|
@overload
|
|
479
|
-
def matmul(
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
) -> NDArray[complexfloating]: ...
|
|
473
|
+
def matmul(x1: _ArrayLikeFloat_co, x2: _ArrayLikeFloat_co, /) -> NDArray[floating]: ...
|
|
474
|
+
@overload
|
|
475
|
+
def matmul(x1: _ArrayLikeComplex_co, x2: _ArrayLikeComplex_co, /) -> NDArray[complexfloating]: ...
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -793,15 +793,28 @@ class CondCases(LinalgSquareTestCase, LinalgGeneralizedSquareTestCase):
|
|
|
793
793
|
|
|
794
794
|
|
|
795
795
|
class TestCond(CondCases):
|
|
796
|
-
|
|
796
|
+
@pytest.mark.parametrize('is_complex', [False, True])
|
|
797
|
+
def test_basic_nonsvd(self, is_complex):
|
|
797
798
|
# Smoketest the non-svd norms
|
|
798
799
|
A = array([[1., 0, 1], [0, -2., 0], [0, 0, 3.]])
|
|
800
|
+
if is_complex:
|
|
801
|
+
# Since A is linearly scaled, the condition number should not change
|
|
802
|
+
A = A * (1 + 1j)
|
|
799
803
|
assert_almost_equal(linalg.cond(A, inf), 4)
|
|
800
804
|
assert_almost_equal(linalg.cond(A, -inf), 2 / 3)
|
|
801
805
|
assert_almost_equal(linalg.cond(A, 1), 4)
|
|
802
806
|
assert_almost_equal(linalg.cond(A, -1), 0.5)
|
|
803
807
|
assert_almost_equal(linalg.cond(A, 'fro'), np.sqrt(265 / 12))
|
|
804
808
|
|
|
809
|
+
@pytest.mark.parametrize('dtype', [single, double, csingle, cdouble])
|
|
810
|
+
@pytest.mark.parametrize('norm_ord', [1, -1, 2, -2, 'fro', np.inf, -np.inf])
|
|
811
|
+
def test_cond_dtypes(self, dtype, norm_ord):
|
|
812
|
+
# Check that the condition number is computed in the same dtype
|
|
813
|
+
# as the input matrix
|
|
814
|
+
A = array([[1., 0, 1], [0, -2., 0], [0, 0, 3.]], dtype=dtype)
|
|
815
|
+
out_type = get_real_dtype(dtype)
|
|
816
|
+
assert_equal(linalg.cond(A, p=norm_ord).dtype, out_type)
|
|
817
|
+
|
|
805
818
|
def test_singular(self):
|
|
806
819
|
# Singular matrices have infinite condition number for
|
|
807
820
|
# positive norms, and negative norms shouldn't raise
|
numpy/ma/extras.pyi
CHANGED
|
@@ -110,12 +110,16 @@ def cov(x, y=..., rowvar=..., bias=..., allow_masked=..., ddof=...): ...
|
|
|
110
110
|
def corrcoef(x, y=..., rowvar=..., bias=..., allow_masked=..., ddof=...): ...
|
|
111
111
|
|
|
112
112
|
class MAxisConcatenator(AxisConcatenator):
|
|
113
|
+
__slots__ = ()
|
|
114
|
+
|
|
113
115
|
@staticmethod
|
|
114
116
|
def concatenate(arrays: Incomplete, axis: int = 0) -> Incomplete: ... # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride]
|
|
115
117
|
@classmethod
|
|
116
118
|
def makemat(cls, arr: Incomplete) -> Incomplete: ... # type: ignore[override] # pyright: ignore[reportIncompatibleVariableOverride]
|
|
117
119
|
|
|
118
120
|
class mr_class(MAxisConcatenator):
|
|
121
|
+
__slots__ = ()
|
|
122
|
+
|
|
119
123
|
def __init__(self) -> None: ...
|
|
120
124
|
|
|
121
125
|
mr_: mr_class
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
numpy/random/lib/npyrandom.lib
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1858,6 +1858,11 @@ class TestRandomDist:
|
|
|
1858
1858
|
[2.07093587449261, 0.73073890064369]])
|
|
1859
1859
|
assert_array_almost_equal(actual, desired, decimal=14)
|
|
1860
1860
|
|
|
1861
|
+
def test_wald_nonnegative(self):
|
|
1862
|
+
random = Generator(MT19937(self.seed))
|
|
1863
|
+
samples = random.wald(mean=1e9, scale=2.25, size=1000)
|
|
1864
|
+
assert_(np.all(samples >= 0.0))
|
|
1865
|
+
|
|
1861
1866
|
def test_weibull(self):
|
|
1862
1867
|
random = Generator(MT19937(self.seed))
|
|
1863
1868
|
actual = random.weibull(a=1.23, size=(3, 2))
|
|
@@ -10,7 +10,7 @@ def build_and_import_extension(
|
|
|
10
10
|
*,
|
|
11
11
|
prologue: str = "",
|
|
12
12
|
build_dir: pathlib.Path | None = None,
|
|
13
|
-
include_dirs: Sequence[str] =
|
|
13
|
+
include_dirs: Sequence[str] | None = None,
|
|
14
14
|
more_init: str = "",
|
|
15
15
|
) -> types.ModuleType: ...
|
|
16
16
|
|
|
@@ -20,6 +20,6 @@ def compile_extension_module(
|
|
|
20
20
|
builddir: pathlib.Path,
|
|
21
21
|
include_dirs: Sequence[str],
|
|
22
22
|
source_string: str,
|
|
23
|
-
libraries: Sequence[str] =
|
|
24
|
-
library_dirs: Sequence[str] =
|
|
23
|
+
libraries: Sequence[str] | None = None,
|
|
24
|
+
library_dirs: Sequence[str] | None = None,
|
|
25
25
|
) -> pathlib.Path: ...
|
numpy/testing/_private/utils.pyi
CHANGED
|
@@ -170,7 +170,7 @@ else:
|
|
|
170
170
|
def memusage() -> NoReturn: ...
|
|
171
171
|
|
|
172
172
|
if sys.platform == "linux":
|
|
173
|
-
def jiffies(_proc_pid_stat: StrOrBytesPath =
|
|
173
|
+
def jiffies(_proc_pid_stat: StrOrBytesPath | None = None, _load_time: list[float] | None = None) -> int: ...
|
|
174
174
|
else:
|
|
175
175
|
def jiffies(_load_time: list[float] = []) -> int: ...
|
|
176
176
|
|
numpy/tests/test_configtool.py
CHANGED
|
@@ -33,7 +33,7 @@ class TestNumpyConfig:
|
|
|
33
33
|
|
|
34
34
|
def test_configtool_pkgconfigdir(self):
|
|
35
35
|
stdout = self.check_numpyconfig('--pkgconfigdir')
|
|
36
|
-
assert pathlib.Path(stdout) == PKG_CONFIG_DIR
|
|
36
|
+
assert pathlib.Path(stdout) == PKG_CONFIG_DIR.resolve()
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
@pytest.mark.skipif(not IS_INSTALLED, reason="numpy must be installed to check its entrypoints")
|
|
@@ -8,10 +8,10 @@ i = int()
|
|
|
8
8
|
|
|
9
9
|
f8 = np.float64()
|
|
10
10
|
|
|
11
|
-
b_ >> f8 # type: ignore[
|
|
12
|
-
i8 << f8 # type: ignore[
|
|
11
|
+
b_ >> f8 # type: ignore[operator]
|
|
12
|
+
i8 << f8 # type: ignore[operator]
|
|
13
13
|
i | f8 # type: ignore[operator]
|
|
14
|
-
i8 ^ f8 # type: ignore[
|
|
15
|
-
u8 & f8 # type: ignore[
|
|
14
|
+
i8 ^ f8 # type: ignore[operator]
|
|
15
|
+
u8 & f8 # type: ignore[operator]
|
|
16
16
|
~f8 # type: ignore[operator]
|
|
17
17
|
# TODO: Certain mixes like i4 << u8 go to float and thus should fail
|
|
@@ -47,12 +47,12 @@ np.uint64(A()) # type: ignore[arg-type]
|
|
|
47
47
|
np.void("test") # type: ignore[call-overload]
|
|
48
48
|
np.void("test", dtype=None) # type: ignore[call-overload]
|
|
49
49
|
|
|
50
|
-
np.generic(1) # type: ignore[abstract]
|
|
51
|
-
np.number(1) # type: ignore[abstract]
|
|
52
|
-
np.integer(1) # type: ignore[abstract]
|
|
53
|
-
np.inexact(1) # type: ignore[abstract]
|
|
54
|
-
np.character("test") # type: ignore[abstract]
|
|
55
|
-
np.flexible(b"test") # type: ignore[abstract]
|
|
50
|
+
np.generic(1) # type: ignore[abstract, call-arg]
|
|
51
|
+
np.number(1) # type: ignore[abstract, call-arg]
|
|
52
|
+
np.integer(1) # type: ignore[abstract, call-arg]
|
|
53
|
+
np.inexact(1) # type: ignore[abstract, call-arg]
|
|
54
|
+
np.character("test") # type: ignore[abstract, call-arg]
|
|
55
|
+
np.flexible(b"test") # type: ignore[abstract, call-arg]
|
|
56
56
|
|
|
57
57
|
np.float64(value=0.0) # type: ignore[call-arg]
|
|
58
58
|
np.int64(value=0) # type: ignore[call-arg]
|
|
@@ -3,7 +3,7 @@ from typing import Any, assert_type
|
|
|
3
3
|
|
|
4
4
|
import numpy as np
|
|
5
5
|
import numpy.typing as npt
|
|
6
|
-
from numpy._typing import
|
|
6
|
+
from numpy._typing import _64Bit, _128Bit
|
|
7
7
|
|
|
8
8
|
b: bool
|
|
9
9
|
c: complex
|
|
@@ -487,7 +487,7 @@ assert_type(c8 / b_, np.complex64)
|
|
|
487
487
|
|
|
488
488
|
# Complex
|
|
489
489
|
|
|
490
|
-
assert_type(c16 + f16, np.
|
|
490
|
+
assert_type(c16 + f16, np.complexfloating)
|
|
491
491
|
assert_type(c16 + c16, np.complex128)
|
|
492
492
|
assert_type(c16 + f8, np.complex128)
|
|
493
493
|
assert_type(c16 + i8, np.complex128)
|
|
@@ -500,12 +500,12 @@ assert_type(c16 + c, np.complex128)
|
|
|
500
500
|
assert_type(c16 + f, np.complex128)
|
|
501
501
|
assert_type(c16 + AR_f, npt.NDArray[np.complex128])
|
|
502
502
|
|
|
503
|
-
assert_type(f16 + c16, np.
|
|
503
|
+
assert_type(f16 + c16, np.complexfloating)
|
|
504
504
|
assert_type(c16 + c16, np.complex128)
|
|
505
505
|
assert_type(f8 + c16, np.complex128)
|
|
506
506
|
assert_type(i8 + c16, np.complex128)
|
|
507
507
|
assert_type(c8 + c16, np.complex128 | np.complex64)
|
|
508
|
-
assert_type(f4 + c16, np.
|
|
508
|
+
assert_type(f4 + c16, np.complexfloating)
|
|
509
509
|
assert_type(i4 + c16, np.complex128)
|
|
510
510
|
assert_type(b_ + c16, np.complex128)
|
|
511
511
|
assert_type(b + c16, np.complex128)
|
|
@@ -513,10 +513,10 @@ assert_type(c + c16, np.complex128)
|
|
|
513
513
|
assert_type(f + c16, np.complex128)
|
|
514
514
|
assert_type(AR_f + c16, npt.NDArray[np.complex128])
|
|
515
515
|
|
|
516
|
-
assert_type(c8 + f16, np.
|
|
516
|
+
assert_type(c8 + f16, np.complex64 | np.complexfloating[_128Bit, _128Bit])
|
|
517
517
|
assert_type(c8 + c16, np.complex64 | np.complex128)
|
|
518
518
|
assert_type(c8 + f8, np.complex64 | np.complex128)
|
|
519
|
-
assert_type(c8 + i8, np.
|
|
519
|
+
assert_type(c8 + i8, np.complex64 | np.complexfloating[_64Bit, _64Bit])
|
|
520
520
|
assert_type(c8 + c8, np.complex64)
|
|
521
521
|
assert_type(c8 + f4, np.complex64)
|
|
522
522
|
assert_type(c8 + i4, np.complex64)
|
|
@@ -541,7 +541,7 @@ assert_type(AR_f + c8, npt.NDArray[np.complexfloating])
|
|
|
541
541
|
|
|
542
542
|
# Float
|
|
543
543
|
|
|
544
|
-
assert_type(f8 + f16, np.
|
|
544
|
+
assert_type(f8 + f16, np.floating)
|
|
545
545
|
assert_type(f8 + f8, np.float64)
|
|
546
546
|
assert_type(f8 + i8, np.float64)
|
|
547
547
|
assert_type(f8 + f4, np.float64)
|
|
@@ -552,44 +552,44 @@ assert_type(f8 + c, np.float64 | np.complex128)
|
|
|
552
552
|
assert_type(f8 + f, np.float64)
|
|
553
553
|
assert_type(f8 + AR_f, npt.NDArray[np.float64])
|
|
554
554
|
|
|
555
|
-
assert_type(f16 + f8, np.floating
|
|
555
|
+
assert_type(f16 + f8, np.floating)
|
|
556
556
|
assert_type(f8 + f8, np.float64)
|
|
557
557
|
assert_type(i8 + f8, np.float64)
|
|
558
|
-
assert_type(f4 + f8, np.
|
|
559
|
-
assert_type(i4 + f8,np.float64)
|
|
558
|
+
assert_type(f4 + f8, np.floating)
|
|
559
|
+
assert_type(i4 + f8, np.float64)
|
|
560
560
|
assert_type(b_ + f8, np.float64)
|
|
561
561
|
assert_type(b + f8, np.float64)
|
|
562
562
|
assert_type(c + f8, np.complex128 | np.float64)
|
|
563
563
|
assert_type(f + f8, np.float64)
|
|
564
564
|
assert_type(AR_f + f8, npt.NDArray[np.float64])
|
|
565
565
|
|
|
566
|
-
assert_type(f4 + f16, np.
|
|
567
|
-
assert_type(f4 + f8, np.
|
|
568
|
-
assert_type(f4 + i8, np.
|
|
566
|
+
assert_type(f4 + f16, np.floating)
|
|
567
|
+
assert_type(f4 + f8, np.floating)
|
|
568
|
+
assert_type(f4 + i8, np.floating)
|
|
569
569
|
assert_type(f4 + f4, np.float32)
|
|
570
|
-
assert_type(f4 + i4, np.
|
|
570
|
+
assert_type(f4 + i4, np.floating)
|
|
571
571
|
assert_type(f4 + b_, np.float32)
|
|
572
572
|
assert_type(f4 + b, np.float32)
|
|
573
|
-
assert_type(f4 + c, np.
|
|
574
|
-
assert_type(f4 + f, np.float32
|
|
573
|
+
assert_type(f4 + c, np.complexfloating)
|
|
574
|
+
assert_type(f4 + f, np.float32)
|
|
575
575
|
assert_type(f4 + AR_f, npt.NDArray[np.float64])
|
|
576
576
|
|
|
577
|
-
assert_type(f16 + f4, np.floating
|
|
577
|
+
assert_type(f16 + f4, np.floating)
|
|
578
578
|
assert_type(f8 + f4, np.float64)
|
|
579
|
-
assert_type(i8 + f4, np.floating
|
|
579
|
+
assert_type(i8 + f4, np.floating)
|
|
580
580
|
assert_type(f4 + f4, np.float32)
|
|
581
|
-
assert_type(i4 + f4, np.
|
|
581
|
+
assert_type(i4 + f4, np.floating)
|
|
582
582
|
assert_type(b_ + f4, np.float32)
|
|
583
583
|
assert_type(b + f4, np.float32)
|
|
584
|
-
assert_type(c + f4, np.
|
|
585
|
-
assert_type(f + f4, np.
|
|
584
|
+
assert_type(c + f4, np.complexfloating)
|
|
585
|
+
assert_type(f + f4, np.float32)
|
|
586
586
|
assert_type(AR_f + f4, npt.NDArray[np.float64])
|
|
587
587
|
|
|
588
588
|
# Int
|
|
589
589
|
|
|
590
590
|
assert_type(i8 + i8, np.int64)
|
|
591
591
|
assert_type(i8 + u8, Any)
|
|
592
|
-
assert_type(i8 + i4, np.signedinteger
|
|
592
|
+
assert_type(i8 + i4, np.signedinteger)
|
|
593
593
|
assert_type(i8 + u4, Any)
|
|
594
594
|
assert_type(i8 + b_, np.int64)
|
|
595
595
|
assert_type(i8 + b, np.int64)
|
|
@@ -599,7 +599,7 @@ assert_type(i8 + AR_f, npt.NDArray[np.float64])
|
|
|
599
599
|
|
|
600
600
|
assert_type(u8 + u8, np.uint64)
|
|
601
601
|
assert_type(u8 + i4, Any)
|
|
602
|
-
assert_type(u8 + u4, np.unsignedinteger
|
|
602
|
+
assert_type(u8 + u4, np.unsignedinteger)
|
|
603
603
|
assert_type(u8 + b_, np.uint64)
|
|
604
604
|
assert_type(u8 + b, np.uint64)
|
|
605
605
|
assert_type(u8 + c, np.complex128)
|
|
@@ -608,7 +608,7 @@ assert_type(u8 + AR_f, npt.NDArray[np.float64])
|
|
|
608
608
|
|
|
609
609
|
assert_type(i8 + i8, np.int64)
|
|
610
610
|
assert_type(u8 + i8, Any)
|
|
611
|
-
assert_type(i4 + i8, np.signedinteger
|
|
611
|
+
assert_type(i4 + i8, np.signedinteger)
|
|
612
612
|
assert_type(u4 + i8, Any)
|
|
613
613
|
assert_type(b_ + i8, np.int64)
|
|
614
614
|
assert_type(b + i8, np.int64)
|
|
@@ -618,14 +618,14 @@ assert_type(AR_f + i8, npt.NDArray[np.float64])
|
|
|
618
618
|
|
|
619
619
|
assert_type(u8 + u8, np.uint64)
|
|
620
620
|
assert_type(i4 + u8, Any)
|
|
621
|
-
assert_type(u4 + u8, np.unsignedinteger
|
|
621
|
+
assert_type(u4 + u8, np.unsignedinteger)
|
|
622
622
|
assert_type(b_ + u8, np.uint64)
|
|
623
623
|
assert_type(b + u8, np.uint64)
|
|
624
624
|
assert_type(c + u8, np.complex128)
|
|
625
625
|
assert_type(f + u8, np.float64)
|
|
626
626
|
assert_type(AR_f + u8, npt.NDArray[np.float64])
|
|
627
627
|
|
|
628
|
-
assert_type(i4 + i8, np.signedinteger
|
|
628
|
+
assert_type(i4 + i8, np.signedinteger)
|
|
629
629
|
assert_type(i4 + i4, np.int32)
|
|
630
630
|
assert_type(i4 + b_, np.int32)
|
|
631
631
|
assert_type(i4 + b, np.int32)
|
|
@@ -633,13 +633,13 @@ assert_type(i4 + AR_f, npt.NDArray[np.float64])
|
|
|
633
633
|
|
|
634
634
|
assert_type(u4 + i8, Any)
|
|
635
635
|
assert_type(u4 + i4, Any)
|
|
636
|
-
assert_type(u4 + u8, np.unsignedinteger
|
|
636
|
+
assert_type(u4 + u8, np.unsignedinteger)
|
|
637
637
|
assert_type(u4 + u4, np.uint32)
|
|
638
638
|
assert_type(u4 + b_, np.uint32)
|
|
639
639
|
assert_type(u4 + b, np.uint32)
|
|
640
640
|
assert_type(u4 + AR_f, npt.NDArray[np.float64])
|
|
641
641
|
|
|
642
|
-
assert_type(i8 + i4, np.signedinteger
|
|
642
|
+
assert_type(i8 + i4, np.signedinteger)
|
|
643
643
|
assert_type(i4 + i4, np.int32)
|
|
644
644
|
assert_type(b_ + i4, np.int32)
|
|
645
645
|
assert_type(b + i4, np.int32)
|
|
@@ -647,7 +647,7 @@ assert_type(AR_f + i4, npt.NDArray[np.float64])
|
|
|
647
647
|
|
|
648
648
|
assert_type(i8 + u4, Any)
|
|
649
649
|
assert_type(i4 + u4, Any)
|
|
650
|
-
assert_type(u8 + u4, np.unsignedinteger
|
|
650
|
+
assert_type(u8 + u4, np.unsignedinteger)
|
|
651
651
|
assert_type(u4 + u4, np.uint32)
|
|
652
652
|
assert_type(b_ + u4, np.uint32)
|
|
653
653
|
assert_type(b + u4, np.uint32)
|
|
@@ -53,7 +53,7 @@ assert_type(np.empty([1, 5, 6], dtype='c16'), npt.NDArray[Any])
|
|
|
53
53
|
assert_type(np.empty(mixed_shape), npt.NDArray[np.float64])
|
|
54
54
|
|
|
55
55
|
assert_type(np.concatenate(A), npt.NDArray[np.float64])
|
|
56
|
-
assert_type(np.concatenate([A, A]), Any) # pyright correctly infers this as NDArray[float64]
|
|
56
|
+
assert_type(np.concatenate([A, A]), npt.NDArray[Any]) # pyright correctly infers this as NDArray[float64]
|
|
57
57
|
assert_type(np.concatenate([[1], A]), npt.NDArray[Any])
|
|
58
58
|
assert_type(np.concatenate([[1], [1]]), npt.NDArray[Any])
|
|
59
59
|
assert_type(np.concatenate((A, A)), npt.NDArray[np.float64])
|
|
@@ -222,19 +222,19 @@ assert_type(np.atleast_3d(A), npt.NDArray[np.float64])
|
|
|
222
222
|
assert_type(np.atleast_3d(A, A), tuple[npt.NDArray[np.float64], npt.NDArray[np.float64]])
|
|
223
223
|
assert_type(np.atleast_3d(A, A, A), tuple[npt.NDArray[np.float64], ...])
|
|
224
224
|
|
|
225
|
-
assert_type(np.vstack([A, A]),
|
|
225
|
+
assert_type(np.vstack([A, A]), npt.NDArray[np.float64])
|
|
226
226
|
assert_type(np.vstack([A, A], dtype=np.float32), npt.NDArray[np.float32])
|
|
227
227
|
assert_type(np.vstack([A, C]), npt.NDArray[Any])
|
|
228
228
|
assert_type(np.vstack([C, C]), npt.NDArray[Any])
|
|
229
229
|
|
|
230
|
-
assert_type(np.hstack([A, A]),
|
|
230
|
+
assert_type(np.hstack([A, A]), npt.NDArray[np.float64])
|
|
231
231
|
assert_type(np.hstack([A, A], dtype=np.float32), npt.NDArray[np.float32])
|
|
232
232
|
|
|
233
|
-
assert_type(np.stack([A, A]),
|
|
233
|
+
assert_type(np.stack([A, A]), npt.NDArray[np.float64])
|
|
234
234
|
assert_type(np.stack([A, A], dtype=np.float32), npt.NDArray[np.float32])
|
|
235
235
|
assert_type(np.stack([A, C]), npt.NDArray[Any])
|
|
236
236
|
assert_type(np.stack([C, C]), npt.NDArray[Any])
|
|
237
|
-
assert_type(np.stack([A, A], axis=0),
|
|
237
|
+
assert_type(np.stack([A, A], axis=0), npt.NDArray[np.float64])
|
|
238
238
|
assert_type(np.stack([A, A], out=B), SubClass[np.float64])
|
|
239
239
|
|
|
240
240
|
assert_type(np.block([[A, A], [A, A]]), npt.NDArray[Any]) # pyright correctly infers this as NDArray[float64]
|
|
@@ -3,7 +3,6 @@ from typing import Literal as L
|
|
|
3
3
|
|
|
4
4
|
import numpy as np
|
|
5
5
|
import numpy.typing as npt
|
|
6
|
-
from numpy._typing import _32Bit, _64Bit
|
|
7
6
|
|
|
8
7
|
FalseType: TypeAlias = L[False]
|
|
9
8
|
TrueType: TypeAlias = L[True]
|
|
@@ -44,11 +43,11 @@ assert_type(i4 | i4, np.int32)
|
|
|
44
43
|
assert_type(i4 ^ i4, np.int32)
|
|
45
44
|
assert_type(i4 & i4, np.int32)
|
|
46
45
|
|
|
47
|
-
assert_type(i8 << i4, np.signedinteger
|
|
48
|
-
assert_type(i8 >> i4, np.signedinteger
|
|
49
|
-
assert_type(i8 | i4, np.signedinteger
|
|
50
|
-
assert_type(i8 ^ i4, np.signedinteger
|
|
51
|
-
assert_type(i8 & i4, np.signedinteger
|
|
46
|
+
assert_type(i8 << i4, np.signedinteger)
|
|
47
|
+
assert_type(i8 >> i4, np.signedinteger)
|
|
48
|
+
assert_type(i8 | i4, np.signedinteger)
|
|
49
|
+
assert_type(i8 ^ i4, np.signedinteger)
|
|
50
|
+
assert_type(i8 & i4, np.signedinteger)
|
|
52
51
|
|
|
53
52
|
assert_type(i8 << b_, np.int64)
|
|
54
53
|
assert_type(i8 >> b_, np.int64)
|
|
@@ -86,11 +85,11 @@ assert_type(u4 | i4, np.signedinteger)
|
|
|
86
85
|
assert_type(u4 ^ i4, np.signedinteger)
|
|
87
86
|
assert_type(u4 & i4, np.signedinteger)
|
|
88
87
|
|
|
89
|
-
assert_type(u4 << i, np.
|
|
90
|
-
assert_type(u4 >> i, np.
|
|
91
|
-
assert_type(u4 | i, np.
|
|
92
|
-
assert_type(u4 ^ i, np.
|
|
93
|
-
assert_type(u4 & i, np.
|
|
88
|
+
assert_type(u4 << i, np.uint32)
|
|
89
|
+
assert_type(u4 >> i, np.uint32)
|
|
90
|
+
assert_type(u4 | i, np.uint32)
|
|
91
|
+
assert_type(u4 ^ i, np.uint32)
|
|
92
|
+
assert_type(u4 & i, np.uint32)
|
|
94
93
|
|
|
95
94
|
assert_type(u8 << b_, np.uint64)
|
|
96
95
|
assert_type(u8 >> b_, np.uint64)
|
|
@@ -43,9 +43,9 @@ assert_type(np.linalg.cholesky(AR_i8), npt.NDArray[np.float64])
|
|
|
43
43
|
assert_type(np.linalg.cholesky(AR_f8), npt.NDArray[np.floating])
|
|
44
44
|
assert_type(np.linalg.cholesky(AR_c16), npt.NDArray[np.complexfloating])
|
|
45
45
|
|
|
46
|
-
assert_type(np.linalg.outer(AR_i8, AR_i8), npt.NDArray[np.
|
|
47
|
-
assert_type(np.linalg.outer(AR_f8, AR_f8), npt.NDArray[np.
|
|
48
|
-
assert_type(np.linalg.outer(AR_c16, AR_c16), npt.NDArray[np.
|
|
46
|
+
assert_type(np.linalg.outer(AR_i8, AR_i8), npt.NDArray[np.int64])
|
|
47
|
+
assert_type(np.linalg.outer(AR_f8, AR_f8), npt.NDArray[np.float64])
|
|
48
|
+
assert_type(np.linalg.outer(AR_c16, AR_c16), npt.NDArray[np.complex128])
|
|
49
49
|
assert_type(np.linalg.outer(AR_b, AR_b), npt.NDArray[np.bool])
|
|
50
50
|
assert_type(np.linalg.outer(AR_O, AR_O), npt.NDArray[np.object_])
|
|
51
51
|
assert_type(np.linalg.outer(AR_i8, AR_m), npt.NDArray[np.timedelta64])
|
|
@@ -127,6 +127,6 @@ assert_type(np.linalg.cross(AR_i8, AR_i8), npt.NDArray[np.signedinteger])
|
|
|
127
127
|
assert_type(np.linalg.cross(AR_f8, AR_f8), npt.NDArray[np.floating])
|
|
128
128
|
assert_type(np.linalg.cross(AR_c16, AR_c16), npt.NDArray[np.complexfloating])
|
|
129
129
|
|
|
130
|
-
assert_type(np.linalg.matmul(AR_i8, AR_i8), npt.NDArray[np.
|
|
131
|
-
assert_type(np.linalg.matmul(AR_f8, AR_f8), npt.NDArray[np.
|
|
132
|
-
assert_type(np.linalg.matmul(AR_c16, AR_c16), npt.NDArray[np.
|
|
130
|
+
assert_type(np.linalg.matmul(AR_i8, AR_i8), npt.NDArray[np.int64])
|
|
131
|
+
assert_type(np.linalg.matmul(AR_f8, AR_f8), npt.NDArray[np.float64])
|
|
132
|
+
assert_type(np.linalg.matmul(AR_c16, AR_c16), npt.NDArray[np.complex128])
|