numpy 2.3.2__cp313-cp313t-win32.whl → 2.3.4__cp313-cp313t-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.

Files changed (82) hide show
  1. numpy/__config__.py +4 -4
  2. numpy/__init__.pyi +1101 -340
  3. numpy/_core/_multiarray_tests.cp313t-win32.lib +0 -0
  4. numpy/_core/_multiarray_tests.cp313t-win32.pyd +0 -0
  5. numpy/_core/_multiarray_umath.cp313t-win32.lib +0 -0
  6. numpy/_core/_multiarray_umath.cp313t-win32.pyd +0 -0
  7. numpy/_core/_operand_flag_tests.cp313t-win32.lib +0 -0
  8. numpy/_core/_operand_flag_tests.cp313t-win32.pyd +0 -0
  9. numpy/_core/_rational_tests.cp313t-win32.lib +0 -0
  10. numpy/_core/_rational_tests.cp313t-win32.pyd +0 -0
  11. numpy/_core/_simd.cp313t-win32.lib +0 -0
  12. numpy/_core/_simd.cp313t-win32.pyd +0 -0
  13. numpy/_core/_struct_ufunc_tests.cp313t-win32.lib +0 -0
  14. numpy/_core/_struct_ufunc_tests.cp313t-win32.pyd +0 -0
  15. numpy/_core/_ufunc_config.py +2 -0
  16. numpy/_core/_ufunc_config.pyi +52 -6
  17. numpy/_core/_umath_tests.cp313t-win32.lib +0 -0
  18. numpy/_core/_umath_tests.cp313t-win32.pyd +0 -0
  19. numpy/_core/lib/npymath.lib +0 -0
  20. numpy/_core/lib/pkgconfig/numpy.pc +1 -1
  21. numpy/_core/numerictypes.py +1 -1
  22. numpy/_core/tests/test_api.py +34 -1
  23. numpy/_core/tests/test_datetime.py +24 -0
  24. numpy/_core/tests/test_numerictypes.py +29 -0
  25. numpy/_core/tests/test_stringdtype.py +23 -16
  26. numpy/_core/tests/test_strings.py +15 -0
  27. numpy/_core/tests/test_umath.py +12 -0
  28. numpy/exceptions.pyi +2 -0
  29. numpy/fft/_pocketfft_umath.cp313t-win32.lib +0 -0
  30. numpy/fft/_pocketfft_umath.cp313t-win32.pyd +0 -0
  31. numpy/lib/_arraysetops_impl.pyi +24 -0
  32. numpy/lib/_histograms_impl.pyi +8 -8
  33. numpy/lib/_index_tricks_impl.pyi +12 -0
  34. numpy/lib/_polynomial_impl.pyi +10 -8
  35. numpy/lib/mixins.pyi +2 -0
  36. numpy/lib/tests/test_index_tricks.py +5 -0
  37. numpy/linalg/_linalg.py +1 -0
  38. numpy/linalg/_linalg.pyi +32 -39
  39. numpy/linalg/_umath_linalg.cp313t-win32.lib +0 -0
  40. numpy/linalg/_umath_linalg.cp313t-win32.pyd +0 -0
  41. numpy/linalg/lapack_lite.cp313t-win32.lib +0 -0
  42. numpy/linalg/lapack_lite.cp313t-win32.pyd +0 -0
  43. numpy/linalg/tests/test_linalg.py +14 -1
  44. numpy/ma/extras.pyi +4 -0
  45. numpy/random/_bounded_integers.cp313t-win32.lib +0 -0
  46. numpy/random/_bounded_integers.cp313t-win32.pyd +0 -0
  47. numpy/random/_common.cp313t-win32.lib +0 -0
  48. numpy/random/_common.cp313t-win32.pyd +0 -0
  49. numpy/random/_generator.cp313t-win32.lib +0 -0
  50. numpy/random/_generator.cp313t-win32.pyd +0 -0
  51. numpy/random/_mt19937.cp313t-win32.lib +0 -0
  52. numpy/random/_mt19937.cp313t-win32.pyd +0 -0
  53. numpy/random/_pcg64.cp313t-win32.lib +0 -0
  54. numpy/random/_pcg64.cp313t-win32.pyd +0 -0
  55. numpy/random/_philox.cp313t-win32.lib +0 -0
  56. numpy/random/_philox.cp313t-win32.pyd +0 -0
  57. numpy/random/_sfc64.cp313t-win32.lib +0 -0
  58. numpy/random/_sfc64.cp313t-win32.pyd +0 -0
  59. numpy/random/bit_generator.cp313t-win32.lib +0 -0
  60. numpy/random/bit_generator.cp313t-win32.pyd +0 -0
  61. numpy/random/lib/npyrandom.lib +0 -0
  62. numpy/random/mtrand.cp313t-win32.lib +0 -0
  63. numpy/random/mtrand.cp313t-win32.pyd +0 -0
  64. numpy/random/tests/test_generator_mt19937.py +5 -0
  65. numpy/testing/_private/extbuild.pyi +3 -3
  66. numpy/testing/_private/utils.pyi +1 -1
  67. numpy/tests/test_configtool.py +1 -1
  68. numpy/typing/tests/data/fail/arithmetic.pyi +1 -1
  69. numpy/typing/tests/data/fail/bitwise_ops.pyi +4 -4
  70. numpy/typing/tests/data/fail/scalars.pyi +6 -6
  71. numpy/typing/tests/data/reveal/arithmetic.pyi +29 -29
  72. numpy/typing/tests/data/reveal/array_constructors.pyi +5 -5
  73. numpy/typing/tests/data/reveal/bitwise_ops.pyi +10 -11
  74. numpy/typing/tests/data/reveal/linalg.pyi +6 -6
  75. numpy/typing/tests/data/reveal/mod.pyi +18 -19
  76. numpy/version.py +2 -2
  77. {numpy-2.3.2.dist-info → numpy-2.3.4.dist-info}/LICENSE.txt +881 -881
  78. {numpy-2.3.2.dist-info → numpy-2.3.4.dist-info}/METADATA +1 -1
  79. {numpy-2.3.2.dist-info → numpy-2.3.4.dist-info}/RECORD +81 -82
  80. numpy/_typing/_callable.pyi +0 -366
  81. {numpy-2.3.2.dist-info → numpy-2.3.4.dist-info}/WHEEL +0 -0
  82. {numpy-2.3.2.dist-info → numpy-2.3.4.dist-info}/entry_points.txt +0 -0
numpy/lib/mixins.pyi CHANGED
@@ -14,6 +14,8 @@ __all__ = ["NDArrayOperatorsMixin"]
14
14
  # As such, only little type safety can be provided here.
15
15
 
16
16
  class NDArrayOperatorsMixin(ABC):
17
+ __slots__ = ()
18
+
17
19
  @abstractmethod
18
20
  def __array_ufunc__(
19
21
  self,
@@ -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
- _ArrayT = TypeVar("_ArrayT", bound=NDArray[Any])
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: _ArrayLikeUInt_co, x2: _ArrayLikeUInt_co) -> NDArray[unsignedinteger]: ...
190
+ def outer(x1: _ArrayLike[_NumberT], x2: _ArrayLike[_NumberT], /) -> NDArray[_NumberT]: ...
190
191
  @overload
191
- def outer(x1: _ArrayLikeInt_co, x2: _ArrayLikeInt_co) -> NDArray[signedinteger]: ...
192
+ def outer(x1: _ArrayLikeUInt_co, x2: _ArrayLikeUInt_co, /) -> NDArray[unsignedinteger]: ...
192
193
  @overload
193
- def outer(x1: _ArrayLikeFloat_co, x2: _ArrayLikeFloat_co) -> NDArray[floating]: ...
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
- x1: _ArrayLikeTD64_co,
202
- x2: _ArrayLikeTD64_co,
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
- ) -> _ArrayT: ...
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
- x1: _ArrayLikeComplex_co,
481
- x2: _ArrayLikeComplex_co,
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
- def test_basic_nonsvd(self):
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
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: ...
@@ -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 = ..., _load_time: list[float] = []) -> int: ...
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
 
@@ -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")
@@ -114,7 +114,7 @@ AR_f **= AR_LIKE_c # type: ignore[arg-type]
114
114
 
115
115
  # Scalars
116
116
 
117
- b_ - b_ # type: ignore[call-overload]
117
+ b_ - b_ # type: ignore[operator]
118
118
 
119
119
  dt + dt # type: ignore[operator]
120
120
  td - dt # type: ignore[operator]
@@ -8,10 +8,10 @@ i = int()
8
8
 
9
9
  f8 = np.float64()
10
10
 
11
- b_ >> f8 # type: ignore[call-overload]
12
- i8 << f8 # type: ignore[call-overload]
11
+ b_ >> f8 # type: ignore[operator]
12
+ i8 << f8 # type: ignore[operator]
13
13
  i | f8 # type: ignore[operator]
14
- i8 ^ f8 # type: ignore[call-overload]
15
- u8 & f8 # type: ignore[call-overload]
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 _32Bit, _64Bit, _128Bit
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.complex128 | np.complexfloating[_128Bit, _128Bit])
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.complex128 | np.complexfloating[_128Bit, _128Bit])
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.complex128 | np.complex64)
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.complexfloating[_32Bit, _32Bit] | np.complexfloating[_128Bit, _128Bit])
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.complexfloating[_32Bit, _32Bit] | np.complexfloating[_64Bit, _64Bit])
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.float64 | np.floating[_128Bit])
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[_128Bit] | np.float64)
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.float32 | np.float64)
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.float32 | np.floating[_128Bit])
567
- assert_type(f4 + f8, np.float32 | np.float64)
568
- assert_type(f4 + i8, np.float32 | np.floating[_64Bit])
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.float32)
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.complex64 | np.complex128)
574
- assert_type(f4 + f, np.float32 | np.float64)
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[_128Bit] | np.float32)
577
+ assert_type(f16 + f4, np.floating)
578
578
  assert_type(f8 + f4, np.float64)
579
- assert_type(i8 + f4, np.floating[_32Bit] | np.floating[_64Bit])
579
+ assert_type(i8 + f4, np.floating)
580
580
  assert_type(f4 + f4, np.float32)
581
- assert_type(i4 + f4, np.float32)
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.complex64 | np.complex128)
585
- assert_type(f + f4, np.float64 | np.float32)
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[_32Bit] | np.signedinteger[_64Bit])
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[_32Bit] | np.unsignedinteger[_64Bit])
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[_32Bit] | np.signedinteger[_64Bit])
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[_32Bit] | np.unsignedinteger[_64Bit])
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[_32Bit] | np.signedinteger[_64Bit])
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[_32Bit] | np.unsignedinteger[_64Bit])
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[_32Bit] | np.signedinteger[_64Bit])
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[_32Bit] | np.unsignedinteger[_64Bit])
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]), np.ndarray[Any, Any]) # pyright correctly infers this as NDArray[float64]
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]), np.ndarray[Any, Any]) # pyright correctly infers this as NDArray[float64]
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]), np.ndarray[Any, Any]) # pyright correctly infers this as NDArray[float64]
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), np.ndarray[Any, Any]) # pyright correctly infers this as NDArray[float64]
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[_32Bit] | np.signedinteger[_64Bit])
48
- assert_type(i8 >> i4, np.signedinteger[_32Bit] | np.signedinteger[_64Bit])
49
- assert_type(i8 | i4, np.signedinteger[_32Bit] | np.signedinteger[_64Bit])
50
- assert_type(i8 ^ i4, np.signedinteger[_32Bit] | np.signedinteger[_64Bit])
51
- assert_type(i8 & i4, np.signedinteger[_32Bit] | np.signedinteger[_64Bit])
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.signedinteger)
90
- assert_type(u4 >> i, np.signedinteger)
91
- assert_type(u4 | i, np.signedinteger)
92
- assert_type(u4 ^ i, np.signedinteger)
93
- assert_type(u4 & i, np.signedinteger)
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.signedinteger])
47
- assert_type(np.linalg.outer(AR_f8, AR_f8), npt.NDArray[np.floating])
48
- assert_type(np.linalg.outer(AR_c16, AR_c16), npt.NDArray[np.complexfloating])
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.signedinteger])
131
- assert_type(np.linalg.matmul(AR_f8, AR_f8), npt.NDArray[np.floating])
132
- assert_type(np.linalg.matmul(AR_c16, AR_c16), npt.NDArray[np.complexfloating])
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])