numpy 2.3.2__cp313-cp313t-win_arm64.whl → 2.3.4__cp313-cp313t-win_arm64.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 +10 -10
- numpy/__init__.py +4 -4
- numpy/__init__.pyi +1101 -340
- numpy/_core/_multiarray_tests.cp313t-win_arm64.pyd +0 -0
- numpy/_core/_multiarray_umath.cp313t-win_arm64.pyd +0 -0
- numpy/_core/_operand_flag_tests.cp313t-win_arm64.pyd +0 -0
- numpy/_core/_rational_tests.cp313t-win_arm64.pyd +0 -0
- numpy/_core/_simd.cp313t-win_arm64.pyd +0 -0
- numpy/_core/_struct_ufunc_tests.cp313t-win_arm64.pyd +0 -0
- numpy/_core/_ufunc_config.py +2 -0
- numpy/_core/_ufunc_config.pyi +52 -6
- numpy/_core/_umath_tests.cp313t-win_arm64.pyd +0 -0
- numpy/_core/lib/{libnpymath.a → 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.cp313t-win_arm64.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.cp313t-win_arm64.pyd +0 -0
- numpy/linalg/lapack_lite.cp313t-win_arm64.pyd +0 -0
- numpy/linalg/tests/test_linalg.py +14 -1
- numpy/ma/extras.pyi +4 -0
- numpy/random/_bounded_integers.cp313t-win_arm64.pyd +0 -0
- numpy/random/_common.cp313t-win_arm64.pyd +0 -0
- numpy/random/_generator.cp313t-win_arm64.pyd +0 -0
- numpy/random/_mt19937.cp313t-win_arm64.pyd +0 -0
- numpy/random/_pcg64.cp313t-win_arm64.pyd +0 -0
- numpy/random/_philox.cp313t-win_arm64.pyd +0 -0
- numpy/random/_sfc64.cp313t-win_arm64.pyd +0 -0
- numpy/random/bit_generator.cp313t-win_arm64.pyd +0 -0
- numpy/random/lib/{libnpyrandom.a → npyrandom.lib} +0 -0
- numpy/random/mtrand.cp313t-win_arm64.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.4.dist-info/DELVEWHEEL +2 -0
- {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 +64 -65
- numpy/_typing/_callable.pyi +0 -366
- numpy-2.3.2.dist-info/DELVEWHEEL +0 -2
- {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
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
numpy/_core/_ufunc_config.py
CHANGED
numpy/_core/_ufunc_config.pyi
CHANGED
|
@@ -1,13 +1,31 @@
|
|
|
1
1
|
from collections.abc import Callable
|
|
2
|
-
from
|
|
2
|
+
from types import TracebackType
|
|
3
|
+
from typing import (
|
|
4
|
+
Any,
|
|
5
|
+
Final,
|
|
6
|
+
Literal,
|
|
7
|
+
TypeAlias,
|
|
8
|
+
TypedDict,
|
|
9
|
+
TypeVar,
|
|
10
|
+
type_check_only,
|
|
11
|
+
)
|
|
3
12
|
|
|
4
13
|
from _typeshed import SupportsWrite
|
|
5
14
|
|
|
6
|
-
|
|
15
|
+
__all__ = [
|
|
16
|
+
"seterr",
|
|
17
|
+
"geterr",
|
|
18
|
+
"setbufsize",
|
|
19
|
+
"getbufsize",
|
|
20
|
+
"seterrcall",
|
|
21
|
+
"geterrcall",
|
|
22
|
+
"errstate",
|
|
23
|
+
]
|
|
7
24
|
|
|
8
25
|
_ErrKind: TypeAlias = Literal["ignore", "warn", "raise", "call", "print", "log"]
|
|
9
|
-
|
|
10
|
-
|
|
26
|
+
_ErrCall: TypeAlias = Callable[[str, int], Any] | SupportsWrite[str]
|
|
27
|
+
|
|
28
|
+
_CallableT = TypeVar("_CallableT", bound=Callable[..., object])
|
|
11
29
|
|
|
12
30
|
@type_check_only
|
|
13
31
|
class _ErrDict(TypedDict):
|
|
@@ -16,6 +34,36 @@ class _ErrDict(TypedDict):
|
|
|
16
34
|
under: _ErrKind
|
|
17
35
|
invalid: _ErrKind
|
|
18
36
|
|
|
37
|
+
###
|
|
38
|
+
|
|
39
|
+
class _unspecified: ...
|
|
40
|
+
|
|
41
|
+
_Unspecified: Final[_unspecified]
|
|
42
|
+
|
|
43
|
+
class errstate:
|
|
44
|
+
__slots__ = "_all", "_call", "_divide", "_invalid", "_over", "_token", "_under"
|
|
45
|
+
|
|
46
|
+
def __init__(
|
|
47
|
+
self,
|
|
48
|
+
/,
|
|
49
|
+
*,
|
|
50
|
+
call: _ErrCall | _unspecified = ..., # = _Unspecified
|
|
51
|
+
all: _ErrKind | None = None,
|
|
52
|
+
divide: _ErrKind | None = None,
|
|
53
|
+
over: _ErrKind | None = None,
|
|
54
|
+
under: _ErrKind | None = None,
|
|
55
|
+
invalid: _ErrKind | None = None,
|
|
56
|
+
) -> None: ...
|
|
57
|
+
def __call__(self, /, func: _CallableT) -> _CallableT: ...
|
|
58
|
+
def __enter__(self) -> None: ...
|
|
59
|
+
def __exit__(
|
|
60
|
+
self,
|
|
61
|
+
exc_type: type[BaseException] | None,
|
|
62
|
+
exc_value: BaseException | None,
|
|
63
|
+
traceback: TracebackType | None,
|
|
64
|
+
/,
|
|
65
|
+
) -> None: ...
|
|
66
|
+
|
|
19
67
|
def seterr(
|
|
20
68
|
all: _ErrKind | None = ...,
|
|
21
69
|
divide: _ErrKind | None = ...,
|
|
@@ -28,5 +76,3 @@ def setbufsize(size: int) -> int: ...
|
|
|
28
76
|
def getbufsize() -> int: ...
|
|
29
77
|
def seterrcall(func: _ErrCall | None) -> _ErrCall | None: ...
|
|
30
78
|
def geterrcall() -> _ErrCall | None: ...
|
|
31
|
-
|
|
32
|
-
# See `numpy/__init__.pyi` for the `errstate` class and `no_nep5_warnings`
|
|
Binary file
|
|
Binary file
|
numpy/_core/numerictypes.py
CHANGED
|
@@ -598,7 +598,7 @@ def _scalar_type_key(typ):
|
|
|
598
598
|
|
|
599
599
|
|
|
600
600
|
ScalarType = [int, float, complex, bool, bytes, str, memoryview]
|
|
601
|
-
ScalarType += sorted(
|
|
601
|
+
ScalarType += sorted(dict.fromkeys(sctypeDict.values()), key=_scalar_type_key)
|
|
602
602
|
ScalarType = tuple(ScalarType)
|
|
603
603
|
|
|
604
604
|
|
numpy/_core/tests/test_api.py
CHANGED
|
@@ -91,7 +91,7 @@ def test_array_array():
|
|
|
91
91
|
# instead we get a array([...], dtype=">V18")
|
|
92
92
|
assert_equal(bytes(np.array(o).data), bytes(a.data))
|
|
93
93
|
|
|
94
|
-
# test
|
|
94
|
+
# test __array__
|
|
95
95
|
def custom__array__(self, dtype=None, copy=None):
|
|
96
96
|
return np.array(100.0, dtype=dtype, copy=copy)
|
|
97
97
|
|
|
@@ -157,6 +157,39 @@ def test_array_array():
|
|
|
157
157
|
assert_equal(np.array([(1.0,) * 10] * 10, dtype=np.float64),
|
|
158
158
|
np.ones((10, 10), dtype=np.float64))
|
|
159
159
|
|
|
160
|
+
|
|
161
|
+
@pytest.mark.skipif(not HAS_REFCOUNT, reason="Python lacks refcounts")
|
|
162
|
+
def test___array___refcount():
|
|
163
|
+
class MyArray:
|
|
164
|
+
def __init__(self, dtype):
|
|
165
|
+
self.val = np.array(-1, dtype=dtype)
|
|
166
|
+
|
|
167
|
+
def __array__(self, dtype=None, copy=None):
|
|
168
|
+
return self.val.__array__(dtype=dtype, copy=copy)
|
|
169
|
+
|
|
170
|
+
# test all possible scenarios:
|
|
171
|
+
# dtype(none | same | different) x copy(true | false | none)
|
|
172
|
+
dt = np.dtype(np.int32)
|
|
173
|
+
old_refcount = sys.getrefcount(dt)
|
|
174
|
+
np.array(MyArray(dt))
|
|
175
|
+
assert_equal(old_refcount, sys.getrefcount(dt))
|
|
176
|
+
np.array(MyArray(dt), dtype=dt)
|
|
177
|
+
assert_equal(old_refcount, sys.getrefcount(dt))
|
|
178
|
+
np.array(MyArray(dt), copy=None)
|
|
179
|
+
assert_equal(old_refcount, sys.getrefcount(dt))
|
|
180
|
+
np.array(MyArray(dt), dtype=dt, copy=None)
|
|
181
|
+
assert_equal(old_refcount, sys.getrefcount(dt))
|
|
182
|
+
dt2 = np.dtype(np.int16)
|
|
183
|
+
old_refcount2 = sys.getrefcount(dt2)
|
|
184
|
+
np.array(MyArray(dt), dtype=dt2)
|
|
185
|
+
assert_equal(old_refcount2, sys.getrefcount(dt2))
|
|
186
|
+
np.array(MyArray(dt), dtype=dt2, copy=None)
|
|
187
|
+
assert_equal(old_refcount2, sys.getrefcount(dt2))
|
|
188
|
+
with pytest.raises(ValueError):
|
|
189
|
+
np.array(MyArray(dt), dtype=dt2, copy=False)
|
|
190
|
+
assert_equal(old_refcount2, sys.getrefcount(dt2))
|
|
191
|
+
|
|
192
|
+
|
|
160
193
|
@pytest.mark.parametrize("array", [True, False])
|
|
161
194
|
def test_array_impossible_casts(array):
|
|
162
195
|
# All builtin types can be forcibly cast, at least theoretically,
|
|
@@ -844,6 +844,21 @@ class TestDateTime:
|
|
|
844
844
|
a = np.array([-1, 'NaT', 1234567], dtype='<m')
|
|
845
845
|
assert_equal(str(a), "[ -1 'NaT' 1234567]")
|
|
846
846
|
|
|
847
|
+
def test_timedelta_array_with_nats(self):
|
|
848
|
+
# Regression test for gh-29497.
|
|
849
|
+
x = np.array([np.timedelta64('nat'),
|
|
850
|
+
np.timedelta64('nat', 's'),
|
|
851
|
+
np.timedelta64('nat', 'ms'),
|
|
852
|
+
np.timedelta64(123, 'ms')])
|
|
853
|
+
for td in x[:3]:
|
|
854
|
+
assert np.isnat(td)
|
|
855
|
+
|
|
856
|
+
def test_timedelta_array_nat_assignment(self):
|
|
857
|
+
# Regression test for gh-29497.
|
|
858
|
+
x = np.zeros(3, dtype='m8[ms]')
|
|
859
|
+
x[1] = np.timedelta64('nat', 's')
|
|
860
|
+
assert np.isnat(x[1])
|
|
861
|
+
|
|
847
862
|
def test_pickle(self):
|
|
848
863
|
# Check that pickle roundtripping works
|
|
849
864
|
for proto in range(2, pickle.HIGHEST_PROTOCOL + 1):
|
|
@@ -872,6 +887,15 @@ class TestDateTime:
|
|
|
872
887
|
b"I1\nI1\nI1\ntp7\ntp8\ntp9\nb."
|
|
873
888
|
assert_equal(pickle.loads(pkl), np.dtype('>M8[us]'))
|
|
874
889
|
|
|
890
|
+
def test_gh_29555(self):
|
|
891
|
+
# check that dtype metadata round-trips when none
|
|
892
|
+
dt = np.dtype('>M8[us]')
|
|
893
|
+
assert dt.metadata is None
|
|
894
|
+
for proto in range(2, pickle.HIGHEST_PROTOCOL + 1):
|
|
895
|
+
res = pickle.loads(pickle.dumps(dt, protocol=proto))
|
|
896
|
+
assert_equal(res, dt)
|
|
897
|
+
assert res.metadata is None
|
|
898
|
+
|
|
875
899
|
def test_setstate(self):
|
|
876
900
|
"Verify that datetime dtype __setstate__ can handle bad arguments"
|
|
877
901
|
dt = np.dtype('>M8[us]')
|
|
@@ -617,6 +617,35 @@ class TestScalarTypeNames:
|
|
|
617
617
|
assert np.dtype(t.__name__).type is t
|
|
618
618
|
|
|
619
619
|
|
|
620
|
+
class TestScalarTypeOrder:
|
|
621
|
+
@pytest.mark.parametrize(('a', 'b'), [
|
|
622
|
+
# signedinteger
|
|
623
|
+
(np.byte, np.short),
|
|
624
|
+
(np.short, np.intc),
|
|
625
|
+
(np.intc, np.long),
|
|
626
|
+
(np.long, np.longlong),
|
|
627
|
+
# unsignedinteger
|
|
628
|
+
(np.ubyte, np.ushort),
|
|
629
|
+
(np.ushort, np.uintc),
|
|
630
|
+
(np.uintc, np.ulong),
|
|
631
|
+
(np.ulong, np.ulonglong),
|
|
632
|
+
# floating
|
|
633
|
+
(np.half, np.single),
|
|
634
|
+
(np.single, np.double),
|
|
635
|
+
(np.double, np.longdouble),
|
|
636
|
+
# complexfloating
|
|
637
|
+
(np.csingle, np.cdouble),
|
|
638
|
+
(np.cdouble, np.clongdouble),
|
|
639
|
+
# flexible
|
|
640
|
+
(np.bytes_, np.str_),
|
|
641
|
+
(np.str_, np.void),
|
|
642
|
+
# bouncy castles
|
|
643
|
+
(np.datetime64, np.timedelta64),
|
|
644
|
+
])
|
|
645
|
+
def test_stable_ordering(self, a: type[np.generic], b: type[np.generic]):
|
|
646
|
+
assert np.ScalarType.index(a) <= np.ScalarType.index(b)
|
|
647
|
+
|
|
648
|
+
|
|
620
649
|
class TestBoolDefinition:
|
|
621
650
|
def test_bool_definition(self):
|
|
622
651
|
assert nt.bool is np.bool
|
|
@@ -531,6 +531,13 @@ def test_fancy_indexing(string_list):
|
|
|
531
531
|
assert_array_equal(sarr[ind], uarr[ind])
|
|
532
532
|
|
|
533
533
|
|
|
534
|
+
def test_flatiter_indexing():
|
|
535
|
+
# see gh-29659
|
|
536
|
+
arr = np.array(['hello', 'world'], dtype='T')
|
|
537
|
+
arr.flat[:] = 9223372036854775
|
|
538
|
+
assert_array_equal(arr, np.array([9223372036854775] * 2, dtype='T'))
|
|
539
|
+
|
|
540
|
+
|
|
534
541
|
def test_creation_functions():
|
|
535
542
|
assert_array_equal(np.zeros(3, dtype="T"), ["", "", ""])
|
|
536
543
|
assert_array_equal(np.empty(3, dtype="T"), ["", "", ""])
|
|
@@ -1624,17 +1631,17 @@ class TestImplementation:
|
|
|
1624
1631
|
"""
|
|
1625
1632
|
|
|
1626
1633
|
@classmethod
|
|
1627
|
-
def setup_class(
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
sp =
|
|
1634
|
+
def setup_class(cls):
|
|
1635
|
+
cls.MISSING = 0x80
|
|
1636
|
+
cls.INITIALIZED = 0x40
|
|
1637
|
+
cls.OUTSIDE_ARENA = 0x20
|
|
1638
|
+
cls.LONG = 0x10
|
|
1639
|
+
cls.dtype = StringDType(na_object=np.nan)
|
|
1640
|
+
cls.sizeofstr = cls.dtype.itemsize
|
|
1641
|
+
sp = cls.dtype.itemsize // 2 # pointer size = sizeof(size_t)
|
|
1635
1642
|
# Below, size is not strictly correct, since it really uses
|
|
1636
1643
|
# 7 (or 3) bytes, but good enough for the tests here.
|
|
1637
|
-
|
|
1644
|
+
cls.view_dtype = np.dtype([
|
|
1638
1645
|
('offset', f'u{sp}'),
|
|
1639
1646
|
('size', f'u{sp // 2}'),
|
|
1640
1647
|
('xsiz', f'V{sp // 2 - 1}'),
|
|
@@ -1645,13 +1652,13 @@ class TestImplementation:
|
|
|
1645
1652
|
('size', f'u{sp // 2}'),
|
|
1646
1653
|
('offset', f'u{sp}'),
|
|
1647
1654
|
])
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
[
|
|
1654
|
-
|
|
1655
|
+
cls.s_empty = ""
|
|
1656
|
+
cls.s_short = "01234"
|
|
1657
|
+
cls.s_medium = "abcdefghijklmnopqrstuvwxyz"
|
|
1658
|
+
cls.s_long = "-=+" * 100
|
|
1659
|
+
cls.a = np.array(
|
|
1660
|
+
[cls.s_empty, cls.s_short, cls.s_medium, cls.s_long],
|
|
1661
|
+
cls.dtype)
|
|
1655
1662
|
|
|
1656
1663
|
def get_view(self, a):
|
|
1657
1664
|
# Cannot view a StringDType as anything else directly, since
|
|
@@ -4,6 +4,7 @@ import sys
|
|
|
4
4
|
import pytest
|
|
5
5
|
|
|
6
6
|
import numpy as np
|
|
7
|
+
from numpy._core._exceptions import _UFuncNoLoopError
|
|
7
8
|
from numpy.testing import IS_PYPY, assert_array_equal, assert_raises
|
|
8
9
|
from numpy.testing._private.utils import requires_memory
|
|
9
10
|
|
|
@@ -821,6 +822,20 @@ class TestMethods:
|
|
|
821
822
|
np.strings.expandtabs(np.array("\ta\n\tb", dtype=dt), sys.maxsize)
|
|
822
823
|
np.strings.expandtabs(np.array("\ta\n\tb", dtype=dt), 2**61)
|
|
823
824
|
|
|
825
|
+
def test_expandtabs_length_not_cause_segfault(self, dt):
|
|
826
|
+
# see gh-28829
|
|
827
|
+
with pytest.raises(
|
|
828
|
+
_UFuncNoLoopError,
|
|
829
|
+
match="did not contain a loop with signature matching types",
|
|
830
|
+
):
|
|
831
|
+
np._core.strings._expandtabs_length.reduce(np.zeros(200))
|
|
832
|
+
|
|
833
|
+
with pytest.raises(
|
|
834
|
+
_UFuncNoLoopError,
|
|
835
|
+
match="did not contain a loop with signature matching types",
|
|
836
|
+
):
|
|
837
|
+
np.strings.expandtabs(np.zeros(200))
|
|
838
|
+
|
|
824
839
|
FILL_ERROR = "The fill character must be exactly one character long"
|
|
825
840
|
|
|
826
841
|
def test_center_raises_multiple_character_fill(self, dt):
|
numpy/_core/tests/test_umath.py
CHANGED
|
@@ -4704,6 +4704,18 @@ def test_reduceat():
|
|
|
4704
4704
|
np.setbufsize(ncu.UFUNC_BUFSIZE_DEFAULT)
|
|
4705
4705
|
assert_array_almost_equal(h1, h2)
|
|
4706
4706
|
|
|
4707
|
+
def test_negative_value_raises():
|
|
4708
|
+
with pytest.raises(ValueError, match="buffer size must be non-negative"):
|
|
4709
|
+
np.setbufsize(-5)
|
|
4710
|
+
|
|
4711
|
+
old = np.getbufsize()
|
|
4712
|
+
try:
|
|
4713
|
+
prev = np.setbufsize(4096)
|
|
4714
|
+
assert prev == old
|
|
4715
|
+
assert np.getbufsize() == 4096
|
|
4716
|
+
finally:
|
|
4717
|
+
np.setbufsize(old)
|
|
4718
|
+
|
|
4707
4719
|
def test_reduceat_empty():
|
|
4708
4720
|
"""Reduceat should work with empty arrays"""
|
|
4709
4721
|
indices = np.array([], 'i4')
|
numpy/exceptions.pyi
CHANGED
|
Binary file
|
numpy/lib/_arraysetops_impl.pyi
CHANGED
|
@@ -102,6 +102,7 @@ def unique(
|
|
|
102
102
|
axis: SupportsIndex | None = None,
|
|
103
103
|
*,
|
|
104
104
|
equal_nan: bool = True,
|
|
105
|
+
sorted: bool = True,
|
|
105
106
|
) -> NDArray[_ScalarT]: ...
|
|
106
107
|
@overload # unknown scalar-type, FFF
|
|
107
108
|
def unique(
|
|
@@ -112,6 +113,7 @@ def unique(
|
|
|
112
113
|
axis: SupportsIndex | None = None,
|
|
113
114
|
*,
|
|
114
115
|
equal_nan: bool = True,
|
|
116
|
+
sorted: bool = True,
|
|
115
117
|
) -> _AnyArray: ...
|
|
116
118
|
@overload # known scalar-type, TFF
|
|
117
119
|
def unique(
|
|
@@ -122,6 +124,7 @@ def unique(
|
|
|
122
124
|
axis: SupportsIndex | None = None,
|
|
123
125
|
*,
|
|
124
126
|
equal_nan: bool = True,
|
|
127
|
+
sorted: bool = True,
|
|
125
128
|
) -> tuple[NDArray[_ScalarT], _IntArray]: ...
|
|
126
129
|
@overload # unknown scalar-type, TFF
|
|
127
130
|
def unique(
|
|
@@ -132,6 +135,7 @@ def unique(
|
|
|
132
135
|
axis: SupportsIndex | None = None,
|
|
133
136
|
*,
|
|
134
137
|
equal_nan: bool = True,
|
|
138
|
+
sorted: bool = True,
|
|
135
139
|
) -> tuple[_AnyArray, _IntArray]: ...
|
|
136
140
|
@overload # known scalar-type, FTF (positional)
|
|
137
141
|
def unique(
|
|
@@ -142,6 +146,7 @@ def unique(
|
|
|
142
146
|
axis: SupportsIndex | None = None,
|
|
143
147
|
*,
|
|
144
148
|
equal_nan: bool = True,
|
|
149
|
+
sorted: bool = True,
|
|
145
150
|
) -> tuple[NDArray[_ScalarT], _IntArray]: ...
|
|
146
151
|
@overload # known scalar-type, FTF (keyword)
|
|
147
152
|
def unique(
|
|
@@ -152,6 +157,7 @@ def unique(
|
|
|
152
157
|
return_counts: L[False] = False,
|
|
153
158
|
axis: SupportsIndex | None = None,
|
|
154
159
|
equal_nan: bool = True,
|
|
160
|
+
sorted: bool = True,
|
|
155
161
|
) -> tuple[NDArray[_ScalarT], _IntArray]: ...
|
|
156
162
|
@overload # unknown scalar-type, FTF (positional)
|
|
157
163
|
def unique(
|
|
@@ -162,6 +168,7 @@ def unique(
|
|
|
162
168
|
axis: SupportsIndex | None = None,
|
|
163
169
|
*,
|
|
164
170
|
equal_nan: bool = True,
|
|
171
|
+
sorted: bool = True,
|
|
165
172
|
) -> tuple[_AnyArray, _IntArray]: ...
|
|
166
173
|
@overload # unknown scalar-type, FTF (keyword)
|
|
167
174
|
def unique(
|
|
@@ -172,6 +179,7 @@ def unique(
|
|
|
172
179
|
return_counts: L[False] = False,
|
|
173
180
|
axis: SupportsIndex | None = None,
|
|
174
181
|
equal_nan: bool = True,
|
|
182
|
+
sorted: bool = True,
|
|
175
183
|
) -> tuple[_AnyArray, _IntArray]: ...
|
|
176
184
|
@overload # known scalar-type, FFT (positional)
|
|
177
185
|
def unique(
|
|
@@ -182,6 +190,7 @@ def unique(
|
|
|
182
190
|
axis: SupportsIndex | None = None,
|
|
183
191
|
*,
|
|
184
192
|
equal_nan: bool = True,
|
|
193
|
+
sorted: bool = True,
|
|
185
194
|
) -> tuple[NDArray[_ScalarT], _IntArray]: ...
|
|
186
195
|
@overload # known scalar-type, FFT (keyword)
|
|
187
196
|
def unique(
|
|
@@ -192,6 +201,7 @@ def unique(
|
|
|
192
201
|
return_counts: L[True],
|
|
193
202
|
axis: SupportsIndex | None = None,
|
|
194
203
|
equal_nan: bool = True,
|
|
204
|
+
sorted: bool = True,
|
|
195
205
|
) -> tuple[NDArray[_ScalarT], _IntArray]: ...
|
|
196
206
|
@overload # unknown scalar-type, FFT (positional)
|
|
197
207
|
def unique(
|
|
@@ -202,6 +212,7 @@ def unique(
|
|
|
202
212
|
axis: SupportsIndex | None = None,
|
|
203
213
|
*,
|
|
204
214
|
equal_nan: bool = True,
|
|
215
|
+
sorted: bool = True,
|
|
205
216
|
) -> tuple[_AnyArray, _IntArray]: ...
|
|
206
217
|
@overload # unknown scalar-type, FFT (keyword)
|
|
207
218
|
def unique(
|
|
@@ -212,6 +223,7 @@ def unique(
|
|
|
212
223
|
return_counts: L[True],
|
|
213
224
|
axis: SupportsIndex | None = None,
|
|
214
225
|
equal_nan: bool = True,
|
|
226
|
+
sorted: bool = True,
|
|
215
227
|
) -> tuple[_AnyArray, _IntArray]: ...
|
|
216
228
|
@overload # known scalar-type, TTF
|
|
217
229
|
def unique(
|
|
@@ -222,6 +234,7 @@ def unique(
|
|
|
222
234
|
axis: SupportsIndex | None = None,
|
|
223
235
|
*,
|
|
224
236
|
equal_nan: bool = True,
|
|
237
|
+
sorted: bool = True,
|
|
225
238
|
) -> tuple[NDArray[_ScalarT], _IntArray, _IntArray]: ...
|
|
226
239
|
@overload # unknown scalar-type, TTF
|
|
227
240
|
def unique(
|
|
@@ -232,6 +245,7 @@ def unique(
|
|
|
232
245
|
axis: SupportsIndex | None = None,
|
|
233
246
|
*,
|
|
234
247
|
equal_nan: bool = True,
|
|
248
|
+
sorted: bool = True,
|
|
235
249
|
) -> tuple[_AnyArray, _IntArray, _IntArray]: ...
|
|
236
250
|
@overload # known scalar-type, TFT (positional)
|
|
237
251
|
def unique(
|
|
@@ -242,6 +256,7 @@ def unique(
|
|
|
242
256
|
axis: SupportsIndex | None = None,
|
|
243
257
|
*,
|
|
244
258
|
equal_nan: bool = True,
|
|
259
|
+
sorted: bool = True,
|
|
245
260
|
) -> tuple[NDArray[_ScalarT], _IntArray, _IntArray]: ...
|
|
246
261
|
@overload # known scalar-type, TFT (keyword)
|
|
247
262
|
def unique(
|
|
@@ -252,6 +267,7 @@ def unique(
|
|
|
252
267
|
return_counts: L[True],
|
|
253
268
|
axis: SupportsIndex | None = None,
|
|
254
269
|
equal_nan: bool = True,
|
|
270
|
+
sorted: bool = True,
|
|
255
271
|
) -> tuple[NDArray[_ScalarT], _IntArray, _IntArray]: ...
|
|
256
272
|
@overload # unknown scalar-type, TFT (positional)
|
|
257
273
|
def unique(
|
|
@@ -262,6 +278,7 @@ def unique(
|
|
|
262
278
|
axis: SupportsIndex | None = None,
|
|
263
279
|
*,
|
|
264
280
|
equal_nan: bool = True,
|
|
281
|
+
sorted: bool = True,
|
|
265
282
|
) -> tuple[_AnyArray, _IntArray, _IntArray]: ...
|
|
266
283
|
@overload # unknown scalar-type, TFT (keyword)
|
|
267
284
|
def unique(
|
|
@@ -272,6 +289,7 @@ def unique(
|
|
|
272
289
|
return_counts: L[True],
|
|
273
290
|
axis: SupportsIndex | None = None,
|
|
274
291
|
equal_nan: bool = True,
|
|
292
|
+
sorted: bool = True,
|
|
275
293
|
) -> tuple[_AnyArray, _IntArray, _IntArray]: ...
|
|
276
294
|
@overload # known scalar-type, FTT (positional)
|
|
277
295
|
def unique(
|
|
@@ -282,6 +300,7 @@ def unique(
|
|
|
282
300
|
axis: SupportsIndex | None = None,
|
|
283
301
|
*,
|
|
284
302
|
equal_nan: bool = True,
|
|
303
|
+
sorted: bool = True,
|
|
285
304
|
) -> tuple[NDArray[_ScalarT], _IntArray, _IntArray]: ...
|
|
286
305
|
@overload # known scalar-type, FTT (keyword)
|
|
287
306
|
def unique(
|
|
@@ -292,6 +311,7 @@ def unique(
|
|
|
292
311
|
return_counts: L[True],
|
|
293
312
|
axis: SupportsIndex | None = None,
|
|
294
313
|
equal_nan: bool = True,
|
|
314
|
+
sorted: bool = True,
|
|
295
315
|
) -> tuple[NDArray[_ScalarT], _IntArray, _IntArray]: ...
|
|
296
316
|
@overload # unknown scalar-type, FTT (positional)
|
|
297
317
|
def unique(
|
|
@@ -302,6 +322,7 @@ def unique(
|
|
|
302
322
|
axis: SupportsIndex | None = None,
|
|
303
323
|
*,
|
|
304
324
|
equal_nan: bool = True,
|
|
325
|
+
sorted: bool = True,
|
|
305
326
|
) -> tuple[_AnyArray, _IntArray, _IntArray]: ...
|
|
306
327
|
@overload # unknown scalar-type, FTT (keyword)
|
|
307
328
|
def unique(
|
|
@@ -312,6 +333,7 @@ def unique(
|
|
|
312
333
|
return_counts: L[True],
|
|
313
334
|
axis: SupportsIndex | None = None,
|
|
314
335
|
equal_nan: bool = True,
|
|
336
|
+
sorted: bool = True,
|
|
315
337
|
) -> tuple[_AnyArray, _IntArray, _IntArray]: ...
|
|
316
338
|
@overload # known scalar-type, TTT
|
|
317
339
|
def unique(
|
|
@@ -322,6 +344,7 @@ def unique(
|
|
|
322
344
|
axis: SupportsIndex | None = None,
|
|
323
345
|
*,
|
|
324
346
|
equal_nan: bool = True,
|
|
347
|
+
sorted: bool = True,
|
|
325
348
|
) -> tuple[NDArray[_ScalarT], _IntArray, _IntArray, _IntArray]: ...
|
|
326
349
|
@overload # unknown scalar-type, TTT
|
|
327
350
|
def unique(
|
|
@@ -332,6 +355,7 @@ def unique(
|
|
|
332
355
|
axis: SupportsIndex | None = None,
|
|
333
356
|
*,
|
|
334
357
|
equal_nan: bool = True,
|
|
358
|
+
sorted: bool = True,
|
|
335
359
|
) -> tuple[_AnyArray, _IntArray, _IntArray, _IntArray]: ...
|
|
336
360
|
|
|
337
361
|
#
|
numpy/lib/_histograms_impl.pyi
CHANGED
|
@@ -35,16 +35,16 @@ def histogram_bin_edges(
|
|
|
35
35
|
|
|
36
36
|
def histogram(
|
|
37
37
|
a: ArrayLike,
|
|
38
|
-
bins: _BinKind | SupportsIndex | ArrayLike =
|
|
39
|
-
range: tuple[float, float] | None =
|
|
40
|
-
density: bool =
|
|
41
|
-
weights: ArrayLike | None =
|
|
38
|
+
bins: _BinKind | SupportsIndex | ArrayLike = 10,
|
|
39
|
+
range: tuple[float, float] | None = None,
|
|
40
|
+
density: bool | None = None,
|
|
41
|
+
weights: ArrayLike | None = None,
|
|
42
42
|
) -> tuple[NDArray[Any], NDArray[Any]]: ...
|
|
43
43
|
|
|
44
44
|
def histogramdd(
|
|
45
45
|
sample: ArrayLike,
|
|
46
|
-
bins: SupportsIndex | ArrayLike =
|
|
47
|
-
range: Sequence[tuple[float, float]] =
|
|
48
|
-
density: bool | None =
|
|
49
|
-
weights: ArrayLike | None =
|
|
46
|
+
bins: SupportsIndex | ArrayLike = 10,
|
|
47
|
+
range: Sequence[tuple[float, float]] | None = None,
|
|
48
|
+
density: bool | None = None,
|
|
49
|
+
weights: ArrayLike | None = None,
|
|
50
50
|
) -> tuple[NDArray[Any], tuple[NDArray[Any], ...]]: ...
|
numpy/lib/_index_tricks_impl.pyi
CHANGED
|
@@ -98,6 +98,8 @@ class ndindex:
|
|
|
98
98
|
def ndincr(self, /) -> None: ...
|
|
99
99
|
|
|
100
100
|
class nd_grid(Generic[_BoolT_co]):
|
|
101
|
+
__slots__ = ("sparse",)
|
|
102
|
+
|
|
101
103
|
sparse: _BoolT_co
|
|
102
104
|
def __init__(self, sparse: _BoolT_co = ...) -> None: ...
|
|
103
105
|
@overload
|
|
@@ -107,10 +109,14 @@ class nd_grid(Generic[_BoolT_co]):
|
|
|
107
109
|
|
|
108
110
|
@final
|
|
109
111
|
class MGridClass(nd_grid[L[False]]):
|
|
112
|
+
__slots__ = ()
|
|
113
|
+
|
|
110
114
|
def __init__(self) -> None: ...
|
|
111
115
|
|
|
112
116
|
@final
|
|
113
117
|
class OGridClass(nd_grid[L[True]]):
|
|
118
|
+
__slots__ = ()
|
|
119
|
+
|
|
114
120
|
def __init__(self) -> None: ...
|
|
115
121
|
|
|
116
122
|
class AxisConcatenator(Generic[_AxisT_co, _MatrixT_co, _NDMinT_co, _Trans1DT_co]):
|
|
@@ -147,13 +153,19 @@ class AxisConcatenator(Generic[_AxisT_co, _MatrixT_co, _NDMinT_co, _Trans1DT_co]
|
|
|
147
153
|
|
|
148
154
|
@final
|
|
149
155
|
class RClass(AxisConcatenator[L[0], L[False], L[1], L[-1]]):
|
|
156
|
+
__slots__ = ()
|
|
157
|
+
|
|
150
158
|
def __init__(self, /) -> None: ...
|
|
151
159
|
|
|
152
160
|
@final
|
|
153
161
|
class CClass(AxisConcatenator[L[-1], L[False], L[2], L[0]]):
|
|
162
|
+
__slots__ = ()
|
|
163
|
+
|
|
154
164
|
def __init__(self, /) -> None: ...
|
|
155
165
|
|
|
156
166
|
class IndexExpression(Generic[_BoolT_co]):
|
|
167
|
+
__slots__ = ("maketuple",)
|
|
168
|
+
|
|
157
169
|
maketuple: _BoolT_co
|
|
158
170
|
def __init__(self, maketuple: _BoolT_co) -> None: ...
|
|
159
171
|
@overload
|
numpy/lib/_polynomial_impl.pyi
CHANGED
|
@@ -137,20 +137,22 @@ def polyfit(
|
|
|
137
137
|
x: _ArrayLikeFloat_co,
|
|
138
138
|
y: _ArrayLikeFloat_co,
|
|
139
139
|
deg: SupportsIndex | SupportsInt,
|
|
140
|
-
rcond: float | None =
|
|
141
|
-
full: L[False] =
|
|
142
|
-
w: _ArrayLikeFloat_co | None =
|
|
143
|
-
|
|
140
|
+
rcond: float | None = None,
|
|
141
|
+
full: L[False] = False,
|
|
142
|
+
w: _ArrayLikeFloat_co | None = None,
|
|
143
|
+
*,
|
|
144
|
+
cov: L[True, "unscaled"],
|
|
144
145
|
) -> _2Tup[NDArray[float64]]: ...
|
|
145
146
|
@overload
|
|
146
147
|
def polyfit(
|
|
147
148
|
x: _ArrayLikeComplex_co,
|
|
148
149
|
y: _ArrayLikeComplex_co,
|
|
149
150
|
deg: SupportsIndex | SupportsInt,
|
|
150
|
-
rcond: float | None =
|
|
151
|
-
full: L[False] =
|
|
152
|
-
w: _ArrayLikeFloat_co | None =
|
|
153
|
-
|
|
151
|
+
rcond: float | None = None,
|
|
152
|
+
full: L[False] = False,
|
|
153
|
+
w: _ArrayLikeFloat_co | None = None,
|
|
154
|
+
*,
|
|
155
|
+
cov: L[True, "unscaled"],
|
|
154
156
|
) -> _2Tup[NDArray[complex128]]: ...
|
|
155
157
|
@overload
|
|
156
158
|
def polyfit(
|
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]
|