From dab8d0896514417d2a9f418f728a5cb16cb30e36 Mon Sep 17 00:00:00 2001 From: jorenham Date: Tue, 23 Dec 2025 12:46:34 +0100 Subject: [PATCH 01/20] =?UTF-8?q?=F0=9F=91=BD=EF=B8=8F=20`np.array`:=20syn?= =?UTF-8?q?c=20with=20upstream?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/numpy-stubs/_core/_multiarray_umath.pyi | 40 +++++++++++++-------- tool/allowlists/todo.txt | 9 ----- 2 files changed, 26 insertions(+), 23 deletions(-) diff --git a/src/numpy-stubs/_core/_multiarray_umath.pyi b/src/numpy-stubs/_core/_multiarray_umath.pyi index 03e8cad9..ad120bab 100644 --- a/src/numpy-stubs/_core/_multiarray_umath.pyi +++ b/src/numpy-stubs/_core/_multiarray_umath.pyi @@ -185,11 +185,6 @@ class _KwargsD(TypedDict, total=False): class _KwargsL(TypedDict, total=False): like: _CanArrayFunc | None -@type_check_only -class _KwargsCL(TypedDict, total=False): - copy: _Copy | None - like: _CanArrayFunc | None - @type_check_only class _KwargsDL(TypedDict, total=False): device: _Device | None @@ -960,7 +955,9 @@ def array( order: _OrderKACF = "K", subok: L[True], ndmin: L[0] = 0, - **kwargs: Unpack[_KwargsCL], + ndmax: int = 0, + copy: _Copy | None = None, + like: _CanArrayFunc | None = None, ) -> _ArrayT: ... @overload def array( @@ -970,7 +967,9 @@ def array( order: _OrderKACF = "K", subok: L[True], ndmin: L[0, 1] = 0, - **kwargs: Unpack[_KwargsCL], + ndmax: int = 0, + copy: _Copy | None = None, + like: _CanArrayFunc | None = None, ) -> _Array1T: ... @overload def array( @@ -980,7 +979,9 @@ def array( order: _OrderKACF = "K", subok: L[True], ndmin: L[0, 1, 2] = 0, - **kwargs: Unpack[_KwargsCL], + ndmax: int = 0, + copy: _Copy | None = None, + like: _CanArrayFunc | None = None, ) -> _Array2T: ... @overload def array( @@ -990,7 +991,9 @@ def array( order: _OrderKACF = "K", subok: bool = False, ndmin: L[0] = 0, - **kwargs: Unpack[_KwargsCL], + ndmax: int = 0, + copy: _Copy | None = None, + like: _CanArrayFunc | None = None, ) -> np.ndarray[_ShapeT, _DTypeT]: ... @overload def array( @@ -1000,7 +1003,9 @@ def array( order: _OrderKACF = "K", subok: bool = False, ndmin: int = 0, - **kwargs: Unpack[_KwargsCL], + ndmax: int = 0, + copy: _Copy | None = None, + like: _CanArrayFunc | None = None, ) -> _nt.Array[_ScalarT]: ... @overload def array( @@ -1010,7 +1015,8 @@ def array( order: _OrderKACF = "K", subok: bool = False, ndmin: L[0] = 0, - **kwargs: Unpack[_KwargsCL], + copy: _Copy | None = None, + like: _CanArrayFunc | None = None, ) -> _nt.Array0D[_ScalarT]: ... @overload def array( @@ -1020,7 +1026,9 @@ def array( order: _OrderKACF = "K", subok: bool = False, ndmin: L[0] = 0, - **kwargs: Unpack[_KwargsCL], + ndmax: int = 0, + copy: _Copy | None = None, + like: _CanArrayFunc | None = None, ) -> _nt.Array0D[Incomplete]: ... @overload def array( @@ -1030,7 +1038,9 @@ def array( order: _OrderKACF = "K", subok: bool = False, ndmin: int = 0, - **kwargs: Unpack[_KwargsCL], + ndmax: int = 0, + copy: _Copy | None = None, + like: _CanArrayFunc | None = None, ) -> _nt.Array[_ScalarT]: ... @overload def array( @@ -1040,7 +1050,9 @@ def array( order: _OrderKACF = "K", subok: bool = False, ndmin: int = 0, - **kwargs: Unpack[_KwargsCL], + ndmax: int = 0, + copy: _Copy | None = None, + like: _CanArrayFunc | None = None, ) -> _nt.Array[Incomplete]: ... # diff --git a/tool/allowlists/todo.txt b/tool/allowlists/todo.txt index 69c57276..0026f66a 100644 --- a/tool/allowlists/todo.txt +++ b/tool/allowlists/todo.txt @@ -13,7 +13,6 @@ numpy._core._methods.umr_minimum numpy._core._methods.umr_prod numpy._core._methods.umr_sum numpy._core._multiarray_umath.arange -numpy._core._multiarray_umath.array numpy._core._multiarray_umath.asanyarray numpy._core._multiarray_umath.asarray numpy._core._multiarray_umath.ascontiguousarray @@ -41,7 +40,6 @@ numpy._core._type_aliases.type_group numpy._core._type_aliases.type_info numpy._core._type_aliases.v numpy._core.arange -numpy._core.array numpy._core.array2string numpy._core.arrayprint.array2string numpy._core.asanyarray @@ -63,7 +61,6 @@ numpy._core.fromnumeric.reshape numpy._core.getlimits.finfo.smallest_normal numpy._core.may_share_memory numpy._core.multiarray.arange -numpy._core.multiarray.array numpy._core.multiarray.asanyarray numpy._core.multiarray.asarray numpy._core.multiarray.ascontiguousarray @@ -82,7 +79,6 @@ numpy._core.multiarray.shares_memory numpy._core.multiarray.where numpy._core.multiarray.zeros numpy._core.numeric.arange -numpy._core.numeric.array numpy._core.numeric.array2string numpy._core.numeric.asanyarray numpy._core.numeric.asarray @@ -117,7 +113,6 @@ numpy._core.void.__new__ numpy._core.where numpy._core.zeros numpy.arange -numpy.array numpy.array2string numpy.asanyarray numpy.asarray @@ -130,7 +125,6 @@ numpy.core._internal._ctypes.get_data numpy.core._internal._ctypes.get_shape numpy.core._internal._ctypes.get_strides numpy.core._multiarray_umath.arange -numpy.core._multiarray_umath.array numpy.core._multiarray_umath.asanyarray numpy.core._multiarray_umath.asarray numpy.core._multiarray_umath.ascontiguousarray @@ -148,7 +142,6 @@ numpy.core.defchararray.chararray.argsort numpy.core.fromnumeric.reshape numpy.core.getlimits.finfo.smallest_normal numpy.core.multiarray.arange -numpy.core.multiarray.array numpy.core.multiarray.asanyarray numpy.core.multiarray.asarray numpy.core.multiarray.ascontiguousarray @@ -167,7 +160,6 @@ numpy.core.multiarray.shares_memory numpy.core.multiarray.where numpy.core.multiarray.zeros numpy.core.numeric.arange -numpy.core.numeric.array numpy.core.numeric.array2string numpy.core.numeric.asanyarray numpy.core.numeric.asarray @@ -330,7 +322,6 @@ numpy.ma.vstack numpy.ma.zeros numpy.ma.zeros_like numpy.matlib.arange -numpy.matlib.array numpy.matlib.array2string numpy.matlib.asanyarray numpy.matlib.asarray From 1dc38b816fd8d6a1f74b372a92c0e471f52be2e6 Mon Sep 17 00:00:00 2001 From: jorenham Date: Tue, 23 Dec 2025 12:49:34 +0100 Subject: [PATCH 02/20] =?UTF-8?q?=F0=9F=91=BD=EF=B8=8F=20`np.asarray`:=20s?= =?UTF-8?q?ync=20with=20upstream?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/numpy-stubs/_core/_multiarray_umath.pyi | 45 ++++++++++++++++++--- tool/allowlists/todo.txt | 9 ----- 2 files changed, 39 insertions(+), 15 deletions(-) diff --git a/src/numpy-stubs/_core/_multiarray_umath.pyi b/src/numpy-stubs/_core/_multiarray_umath.pyi index ad120bab..73bdffea 100644 --- a/src/numpy-stubs/_core/_multiarray_umath.pyi +++ b/src/numpy-stubs/_core/_multiarray_umath.pyi @@ -1061,27 +1061,60 @@ def asarray( a: _CanArray[np.ndarray[_ShapeT, _DTypeT]], dtype: None = None, order: _OrderKACF = None, - **kwargs: Unpack[_KwargsDCL], + *, + device: _Device | None = None, + copy: _Copy | None = None, + like: _CanArrayFunc | None = None, ) -> np.ndarray[_ShapeT, _DTypeT]: ... @overload def asarray( - a: _ArrayLike[_ScalarT], dtype: None = None, order: _OrderKACF = None, **kwargs: Unpack[_KwargsDCL] + a: _ArrayLike[_ScalarT], + dtype: None = None, + order: _OrderKACF = None, + *, + device: _Device | None = None, + copy: _Copy | None = None, + like: _CanArrayFunc | None = None, ) -> _nt.Array[_ScalarT]: ... @overload def asarray( - a: _ScalarLike_co, dtype: _DTypeLike[_ScalarT], order: _OrderKACF = None, **kwargs: Unpack[_KwargsDCL] + a: _ScalarLike_co, + dtype: _DTypeLike[_ScalarT], + order: _OrderKACF = None, + *, + device: _Device | None = None, + copy: _Copy | None = None, + like: _CanArrayFunc | None = None, ) -> _nt.Array0D[_ScalarT]: ... @overload def asarray( - a: _ScalarLike_co, dtype: npt.DTypeLike | None = None, order: _OrderKACF = None, **kwargs: Unpack[_KwargsDCL] + a: _ScalarLike_co, + dtype: npt.DTypeLike | None = None, + order: _OrderKACF = None, + *, + device: _Device | None = None, + copy: _Copy | None = None, + like: _CanArrayFunc | None = None, ) -> _nt.Array0D[Incomplete]: ... @overload def asarray( - a: object, dtype: _DTypeLike[_ScalarT], order: _OrderKACF = None, **kwargs: Unpack[_KwargsDCL] + a: object, + dtype: _DTypeLike[_ScalarT], + order: _OrderKACF = None, + *, + device: _Device | None = None, + copy: _Copy | None = None, + like: _CanArrayFunc | None = None, ) -> _nt.Array[_ScalarT]: ... @overload def asarray( - a: object, dtype: npt.DTypeLike | None = None, order: _OrderKACF = None, **kwargs: Unpack[_KwargsDCL] + a: object, + dtype: npt.DTypeLike | None = None, + order: _OrderKACF = None, + *, + device: _Device | None = None, + copy: _Copy | None = None, + like: _CanArrayFunc | None = None, ) -> _nt.Array[Incomplete]: ... # diff --git a/tool/allowlists/todo.txt b/tool/allowlists/todo.txt index 0026f66a..5284ba00 100644 --- a/tool/allowlists/todo.txt +++ b/tool/allowlists/todo.txt @@ -14,7 +14,6 @@ numpy._core._methods.umr_prod numpy._core._methods.umr_sum numpy._core._multiarray_umath.arange numpy._core._multiarray_umath.asanyarray -numpy._core._multiarray_umath.asarray numpy._core._multiarray_umath.ascontiguousarray numpy._core._multiarray_umath.asfortranarray numpy._core._multiarray_umath.empty @@ -43,7 +42,6 @@ numpy._core.arange numpy._core.array2string numpy._core.arrayprint.array2string numpy._core.asanyarray -numpy._core.asarray numpy._core.ascontiguousarray numpy._core.asfortranarray numpy._core.copyto @@ -62,7 +60,6 @@ numpy._core.getlimits.finfo.smallest_normal numpy._core.may_share_memory numpy._core.multiarray.arange numpy._core.multiarray.asanyarray -numpy._core.multiarray.asarray numpy._core.multiarray.ascontiguousarray numpy._core.multiarray.asfortranarray numpy._core.multiarray.copyto @@ -81,7 +78,6 @@ numpy._core.multiarray.zeros numpy._core.numeric.arange numpy._core.numeric.array2string numpy._core.numeric.asanyarray -numpy._core.numeric.asarray numpy._core.numeric.ascontiguousarray numpy._core.numeric.asfortranarray numpy._core.numeric.copyto @@ -115,7 +111,6 @@ numpy._core.zeros numpy.arange numpy.array2string numpy.asanyarray -numpy.asarray numpy.ascontiguousarray numpy.asfortranarray numpy.char.chararray.argsort @@ -126,7 +121,6 @@ numpy.core._internal._ctypes.get_shape numpy.core._internal._ctypes.get_strides numpy.core._multiarray_umath.arange numpy.core._multiarray_umath.asanyarray -numpy.core._multiarray_umath.asarray numpy.core._multiarray_umath.ascontiguousarray numpy.core._multiarray_umath.asfortranarray numpy.core._multiarray_umath.empty @@ -143,7 +137,6 @@ numpy.core.fromnumeric.reshape numpy.core.getlimits.finfo.smallest_normal numpy.core.multiarray.arange numpy.core.multiarray.asanyarray -numpy.core.multiarray.asarray numpy.core.multiarray.ascontiguousarray numpy.core.multiarray.asfortranarray numpy.core.multiarray.copyto @@ -162,7 +155,6 @@ numpy.core.multiarray.zeros numpy.core.numeric.arange numpy.core.numeric.array2string numpy.core.numeric.asanyarray -numpy.core.numeric.asarray numpy.core.numeric.ascontiguousarray numpy.core.numeric.asfortranarray numpy.core.numeric.copyto @@ -324,7 +316,6 @@ numpy.ma.zeros_like numpy.matlib.arange numpy.matlib.array2string numpy.matlib.asanyarray -numpy.matlib.asarray numpy.matlib.ascontiguousarray numpy.matlib.asfortranarray numpy.matlib.copyto From ece732c0cbdc39e517d463a78ddf260ce1f6f308 Mon Sep 17 00:00:00 2001 From: jorenham Date: Tue, 23 Dec 2025 12:53:22 +0100 Subject: [PATCH 03/20] =?UTF-8?q?=F0=9F=91=BD=EF=B8=8F=20`np.asarray`:=20s?= =?UTF-8?q?ync=20with=20upstream?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/numpy-stubs/_core/_multiarray_umath.pyi | 48 ++++++++++++++++----- tool/allowlists/todo.txt | 9 ---- 2 files changed, 37 insertions(+), 20 deletions(-) diff --git a/src/numpy-stubs/_core/_multiarray_umath.pyi b/src/numpy-stubs/_core/_multiarray_umath.pyi index 73bdffea..a14e6389 100644 --- a/src/numpy-stubs/_core/_multiarray_umath.pyi +++ b/src/numpy-stubs/_core/_multiarray_umath.pyi @@ -190,12 +190,6 @@ class _KwargsDL(TypedDict, total=False): device: _Device | None like: _CanArrayFunc | None -@type_check_only -class _KwargsDCL(TypedDict, total=False): - device: _Device | None - copy: _Copy | None - like: _CanArrayFunc | None - @type_check_only class _ExtObjDict(TypedDict): divide: _ExtObjValue @@ -1119,22 +1113,54 @@ def asarray( # @overload -def asanyarray(a: _ArrayT, dtype: None = None, order: _OrderKACF = None, **kwargs: Unpack[_KwargsDCL]) -> _ArrayT: ... +def asanyarray( + a: _ArrayT, + dtype: None = None, + order: _OrderKACF = None, + *, + device: _Device | None = None, + copy: _Copy | None = None, + like: _CanArrayFunc | None = None, +) -> _ArrayT: ... @overload def asanyarray( - a: _CanArray[_ArrayT], dtype: None = None, order: _OrderKACF = None, **kwargs: Unpack[_KwargsDCL] + a: _CanArray[_ArrayT], + dtype: None = None, + order: _OrderKACF = None, + *, + device: _Device | None = None, + copy: _Copy | None = None, + like: _CanArrayFunc | None = None, ) -> _ArrayT: ... @overload def asanyarray( - a: _ArrayLike[_ScalarT], dtype: None = None, order: _OrderKACF = None, **kwargs: Unpack[_KwargsDCL] + a: _ArrayLike[_ScalarT], + dtype: None = None, + order: _OrderKACF = None, + *, + device: _Device | None = None, + copy: _Copy | None = None, + like: _CanArrayFunc | None = None, ) -> _nt.Array[_ScalarT]: ... @overload def asanyarray( - a: object, dtype: _DTypeLike[_ScalarT], order: _OrderKACF = None, **kwargs: Unpack[_KwargsDCL] + a: object, + dtype: _DTypeLike[_ScalarT], + order: _OrderKACF = None, + *, + device: _Device | None = None, + copy: _Copy | None = None, + like: _CanArrayFunc | None = None, ) -> _nt.Array[_ScalarT]: ... @overload def asanyarray( - a: object, dtype: npt.DTypeLike | None = None, order: _OrderKACF = None, **kwargs: Unpack[_KwargsDCL] + a: object, + dtype: npt.DTypeLike | None = None, + order: _OrderKACF = None, + *, + device: _Device | None = None, + copy: _Copy | None = None, + like: _CanArrayFunc | None = None, ) -> _nt.Array[Incomplete]: ... # keep in sync with asfortranarray diff --git a/tool/allowlists/todo.txt b/tool/allowlists/todo.txt index 5284ba00..6317e156 100644 --- a/tool/allowlists/todo.txt +++ b/tool/allowlists/todo.txt @@ -13,7 +13,6 @@ numpy._core._methods.umr_minimum numpy._core._methods.umr_prod numpy._core._methods.umr_sum numpy._core._multiarray_umath.arange -numpy._core._multiarray_umath.asanyarray numpy._core._multiarray_umath.ascontiguousarray numpy._core._multiarray_umath.asfortranarray numpy._core._multiarray_umath.empty @@ -41,7 +40,6 @@ numpy._core._type_aliases.v numpy._core.arange numpy._core.array2string numpy._core.arrayprint.array2string -numpy._core.asanyarray numpy._core.ascontiguousarray numpy._core.asfortranarray numpy._core.copyto @@ -59,7 +57,6 @@ numpy._core.fromnumeric.reshape numpy._core.getlimits.finfo.smallest_normal numpy._core.may_share_memory numpy._core.multiarray.arange -numpy._core.multiarray.asanyarray numpy._core.multiarray.ascontiguousarray numpy._core.multiarray.asfortranarray numpy._core.multiarray.copyto @@ -77,7 +74,6 @@ numpy._core.multiarray.where numpy._core.multiarray.zeros numpy._core.numeric.arange numpy._core.numeric.array2string -numpy._core.numeric.asanyarray numpy._core.numeric.ascontiguousarray numpy._core.numeric.asfortranarray numpy._core.numeric.copyto @@ -110,7 +106,6 @@ numpy._core.where numpy._core.zeros numpy.arange numpy.array2string -numpy.asanyarray numpy.ascontiguousarray numpy.asfortranarray numpy.char.chararray.argsort @@ -120,7 +115,6 @@ numpy.core._internal._ctypes.get_data numpy.core._internal._ctypes.get_shape numpy.core._internal._ctypes.get_strides numpy.core._multiarray_umath.arange -numpy.core._multiarray_umath.asanyarray numpy.core._multiarray_umath.ascontiguousarray numpy.core._multiarray_umath.asfortranarray numpy.core._multiarray_umath.empty @@ -136,7 +130,6 @@ numpy.core.defchararray.chararray.argsort numpy.core.fromnumeric.reshape numpy.core.getlimits.finfo.smallest_normal numpy.core.multiarray.arange -numpy.core.multiarray.asanyarray numpy.core.multiarray.ascontiguousarray numpy.core.multiarray.asfortranarray numpy.core.multiarray.copyto @@ -154,7 +147,6 @@ numpy.core.multiarray.where numpy.core.multiarray.zeros numpy.core.numeric.arange numpy.core.numeric.array2string -numpy.core.numeric.asanyarray numpy.core.numeric.ascontiguousarray numpy.core.numeric.asfortranarray numpy.core.numeric.copyto @@ -315,7 +307,6 @@ numpy.ma.zeros numpy.ma.zeros_like numpy.matlib.arange numpy.matlib.array2string -numpy.matlib.asanyarray numpy.matlib.ascontiguousarray numpy.matlib.asfortranarray numpy.matlib.copyto From 3db0beb38d3440c39056470641f6cfc289faf0f3 Mon Sep 17 00:00:00 2001 From: jorenham Date: Tue, 23 Dec 2025 12:56:10 +0100 Subject: [PATCH 04/20] =?UTF-8?q?=F0=9F=91=BD=EF=B8=8F=20`np.ascontiguousa?= =?UTF-8?q?rray`:=20sync=20with=20upstream?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/numpy-stubs/_core/_multiarray_umath.pyi | 10 ++++++---- tool/allowlists/todo.txt | 9 --------- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/src/numpy-stubs/_core/_multiarray_umath.pyi b/src/numpy-stubs/_core/_multiarray_umath.pyi index a14e6389..5fd5bc95 100644 --- a/src/numpy-stubs/_core/_multiarray_umath.pyi +++ b/src/numpy-stubs/_core/_multiarray_umath.pyi @@ -1166,19 +1166,21 @@ def asanyarray( # keep in sync with asfortranarray @overload def ascontiguousarray( - a: _CanArray[_nt.Array[_ScalarT, _ShapeT]], dtype: None = None, **kwargs: Unpack[_KwargsL] + a: _CanArray[_nt.Array[_ScalarT, _ShapeT]], dtype: None = None, *, like: _CanArrayFunc | None = None ) -> _nt.Array[_ScalarT, _ShapeT]: ... @overload def ascontiguousarray( - a: _ArrayLike[_ScalarT], dtype: None = None, **kwargs: Unpack[_KwargsL] + a: _ArrayLike[_ScalarT], dtype: None = None, *, like: _CanArrayFunc | None = None ) -> _nt.Array[_ScalarT]: ... @overload def ascontiguousarray(a: object, dtype: None = None, *, like: _nt.Array[_ScalarT]) -> _nt.Array[_ScalarT]: ... @overload -def ascontiguousarray(a: object, dtype: _DTypeLike[_ScalarT], **kwargs: Unpack[_KwargsL]) -> _nt.Array[_ScalarT]: ... +def ascontiguousarray( + a: object, dtype: _DTypeLike[_ScalarT], *, like: _CanArrayFunc | None = None +) -> _nt.Array[_ScalarT]: ... @overload def ascontiguousarray( - a: object, dtype: npt.DTypeLike | None = None, **kwargs: Unpack[_KwargsL] + a: object, dtype: npt.DTypeLike | None = None, *, like: _CanArrayFunc | None = None ) -> _nt.Array[Incomplete]: ... # keep in sync with ascontiguousarray diff --git a/tool/allowlists/todo.txt b/tool/allowlists/todo.txt index 6317e156..f444b743 100644 --- a/tool/allowlists/todo.txt +++ b/tool/allowlists/todo.txt @@ -13,7 +13,6 @@ numpy._core._methods.umr_minimum numpy._core._methods.umr_prod numpy._core._methods.umr_sum numpy._core._multiarray_umath.arange -numpy._core._multiarray_umath.ascontiguousarray numpy._core._multiarray_umath.asfortranarray numpy._core._multiarray_umath.empty numpy._core._multiarray_umath.empty_like @@ -40,7 +39,6 @@ numpy._core._type_aliases.v numpy._core.arange numpy._core.array2string numpy._core.arrayprint.array2string -numpy._core.ascontiguousarray numpy._core.asfortranarray numpy._core.copyto numpy._core.defchararray.chararray.argsort @@ -57,7 +55,6 @@ numpy._core.fromnumeric.reshape numpy._core.getlimits.finfo.smallest_normal numpy._core.may_share_memory numpy._core.multiarray.arange -numpy._core.multiarray.ascontiguousarray numpy._core.multiarray.asfortranarray numpy._core.multiarray.copyto numpy._core.multiarray.dtype.__new__ @@ -74,7 +71,6 @@ numpy._core.multiarray.where numpy._core.multiarray.zeros numpy._core.numeric.arange numpy._core.numeric.array2string -numpy._core.numeric.ascontiguousarray numpy._core.numeric.asfortranarray numpy._core.numeric.copyto numpy._core.numeric.dtype.__new__ @@ -106,7 +102,6 @@ numpy._core.where numpy._core.zeros numpy.arange numpy.array2string -numpy.ascontiguousarray numpy.asfortranarray numpy.char.chararray.argsort numpy.copyto @@ -115,7 +110,6 @@ numpy.core._internal._ctypes.get_data numpy.core._internal._ctypes.get_shape numpy.core._internal._ctypes.get_strides numpy.core._multiarray_umath.arange -numpy.core._multiarray_umath.ascontiguousarray numpy.core._multiarray_umath.asfortranarray numpy.core._multiarray_umath.empty numpy.core._multiarray_umath.empty_like @@ -130,7 +124,6 @@ numpy.core.defchararray.chararray.argsort numpy.core.fromnumeric.reshape numpy.core.getlimits.finfo.smallest_normal numpy.core.multiarray.arange -numpy.core.multiarray.ascontiguousarray numpy.core.multiarray.asfortranarray numpy.core.multiarray.copyto numpy.core.multiarray.dtype.__new__ @@ -147,7 +140,6 @@ numpy.core.multiarray.where numpy.core.multiarray.zeros numpy.core.numeric.arange numpy.core.numeric.array2string -numpy.core.numeric.ascontiguousarray numpy.core.numeric.asfortranarray numpy.core.numeric.copyto numpy.core.numeric.dtype.__new__ @@ -307,7 +299,6 @@ numpy.ma.zeros numpy.ma.zeros_like numpy.matlib.arange numpy.matlib.array2string -numpy.matlib.ascontiguousarray numpy.matlib.asfortranarray numpy.matlib.copyto numpy.matlib.corrcoef From 4069de7ce665dd85e2c9b6261e2dee11fac6abfc Mon Sep 17 00:00:00 2001 From: jorenham Date: Tue, 23 Dec 2025 12:57:51 +0100 Subject: [PATCH 05/20] =?UTF-8?q?=F0=9F=91=BD=EF=B8=8F=20`np.asfortranarra?= =?UTF-8?q?y`:=20sync=20with=20upstream?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/numpy-stubs/_core/_multiarray_umath.pyi | 12 ++++++++---- tool/allowlists/todo.txt | 9 --------- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/numpy-stubs/_core/_multiarray_umath.pyi b/src/numpy-stubs/_core/_multiarray_umath.pyi index 5fd5bc95..3ca44b8d 100644 --- a/src/numpy-stubs/_core/_multiarray_umath.pyi +++ b/src/numpy-stubs/_core/_multiarray_umath.pyi @@ -1186,17 +1186,21 @@ def ascontiguousarray( # keep in sync with ascontiguousarray @overload def asfortranarray( - a: _CanArray[_nt.Array[_ScalarT, _ShapeT]], dtype: None = None, **kwargs: Unpack[_KwargsL] + a: _CanArray[_nt.Array[_ScalarT, _ShapeT]], dtype: None = None, *, like: _CanArrayFunc | None = None ) -> _nt.Array[_ScalarT, _ShapeT]: ... @overload -def asfortranarray(a: _ArrayLike[_ScalarT], dtype: None = None, **kwargs: Unpack[_KwargsL]) -> _nt.Array[_ScalarT]: ... +def asfortranarray( + a: _ArrayLike[_ScalarT], dtype: None = None, *, like: _CanArrayFunc | None = None +) -> _nt.Array[_ScalarT]: ... @overload def asfortranarray(a: object, dtype: None = None, *, like: _nt.Array[_ScalarT]) -> _nt.Array[_ScalarT]: ... @overload -def asfortranarray(a: object, dtype: _DTypeLike[_ScalarT], **kwargs: Unpack[_KwargsL]) -> _nt.Array[_ScalarT]: ... +def asfortranarray( + a: object, dtype: _DTypeLike[_ScalarT], *, like: _CanArrayFunc | None = None +) -> _nt.Array[_ScalarT]: ... @overload def asfortranarray( - a: object, dtype: npt.DTypeLike | None = None, **kwargs: Unpack[_KwargsL] + a: object, dtype: npt.DTypeLike | None = None, *, like: _CanArrayFunc | None = None ) -> _nt.Array[Incomplete]: ... # `sep` is a de facto mandatory argument, as its default value is deprecated diff --git a/tool/allowlists/todo.txt b/tool/allowlists/todo.txt index f444b743..76de640f 100644 --- a/tool/allowlists/todo.txt +++ b/tool/allowlists/todo.txt @@ -13,7 +13,6 @@ numpy._core._methods.umr_minimum numpy._core._methods.umr_prod numpy._core._methods.umr_sum numpy._core._multiarray_umath.arange -numpy._core._multiarray_umath.asfortranarray numpy._core._multiarray_umath.empty numpy._core._multiarray_umath.empty_like numpy._core._multiarray_umath.flatiter.__array__ @@ -39,7 +38,6 @@ numpy._core._type_aliases.v numpy._core.arange numpy._core.array2string numpy._core.arrayprint.array2string -numpy._core.asfortranarray numpy._core.copyto numpy._core.defchararray.chararray.argsort numpy._core.dtype.__new__ @@ -55,7 +53,6 @@ numpy._core.fromnumeric.reshape numpy._core.getlimits.finfo.smallest_normal numpy._core.may_share_memory numpy._core.multiarray.arange -numpy._core.multiarray.asfortranarray numpy._core.multiarray.copyto numpy._core.multiarray.dtype.__new__ numpy._core.multiarray.empty @@ -71,7 +68,6 @@ numpy._core.multiarray.where numpy._core.multiarray.zeros numpy._core.numeric.arange numpy._core.numeric.array2string -numpy._core.numeric.asfortranarray numpy._core.numeric.copyto numpy._core.numeric.dtype.__new__ numpy._core.numeric.empty @@ -102,7 +98,6 @@ numpy._core.where numpy._core.zeros numpy.arange numpy.array2string -numpy.asfortranarray numpy.char.chararray.argsort numpy.copyto numpy.core._internal._ctypes.get_as_parameter @@ -110,7 +105,6 @@ numpy.core._internal._ctypes.get_data numpy.core._internal._ctypes.get_shape numpy.core._internal._ctypes.get_strides numpy.core._multiarray_umath.arange -numpy.core._multiarray_umath.asfortranarray numpy.core._multiarray_umath.empty numpy.core._multiarray_umath.empty_like numpy.core._multiarray_umath.flatiter.__array__ @@ -124,7 +118,6 @@ numpy.core.defchararray.chararray.argsort numpy.core.fromnumeric.reshape numpy.core.getlimits.finfo.smallest_normal numpy.core.multiarray.arange -numpy.core.multiarray.asfortranarray numpy.core.multiarray.copyto numpy.core.multiarray.dtype.__new__ numpy.core.multiarray.empty @@ -140,7 +133,6 @@ numpy.core.multiarray.where numpy.core.multiarray.zeros numpy.core.numeric.arange numpy.core.numeric.array2string -numpy.core.numeric.asfortranarray numpy.core.numeric.copyto numpy.core.numeric.dtype.__new__ numpy.core.numeric.empty @@ -299,7 +291,6 @@ numpy.ma.zeros numpy.ma.zeros_like numpy.matlib.arange numpy.matlib.array2string -numpy.matlib.asfortranarray numpy.matlib.copyto numpy.matlib.corrcoef numpy.matlib.dtype.__new__ From 15beff7de129ff2be17902df620cf497aee14316 Mon Sep 17 00:00:00 2001 From: jorenham Date: Tue, 23 Dec 2025 13:15:52 +0100 Subject: [PATCH 06/20] =?UTF-8?q?=F0=9F=91=BD=EF=B8=8F=20`np.arange`:=20sy?= =?UTF-8?q?nc=20with=20upstream?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/numpy-stubs/_core/_multiarray_umath.pyi | 160 ++++++++++---------- tool/allowlists/todo.txt | 9 -- 2 files changed, 83 insertions(+), 86 deletions(-) diff --git a/src/numpy-stubs/_core/_multiarray_umath.pyi b/src/numpy-stubs/_core/_multiarray_umath.pyi index 3ca44b8d..245b0ee4 100644 --- a/src/numpy-stubs/_core/_multiarray_umath.pyi +++ b/src/numpy-stubs/_core/_multiarray_umath.pyi @@ -1279,92 +1279,98 @@ def from_dlpack(x: _CanDLPack, /, *, copy: py_bool | None = None, **kwargs: Unpa ### +_ArangeScalar: TypeAlias = np.integer | np.floating | np.datetime64 | np.timedelta64 +_ArangeScalarT = TypeVar("_ArangeScalarT", bound=_ArangeScalar) + # -@overload # (stop, dtype=_) -def arange(stop: object, *, dtype: _DTypeLike[_ScalarT], **kwargs: Unpack[_KwargsDL]) -> _nt.Array1D[_ScalarT]: ... -@overload # (start, stop step, dtype) -def arange( - start: object, stop: object, step: object, dtype: _DTypeLike[_ScalarT], **kwargs: Unpack[_KwargsDL] -) -> _nt.Array1D[_ScalarT]: ... -@overload # (start, stop, step?, dtype=) -def arange( - start: object, stop: object, step: object = ..., *, dtype: _DTypeLike[_ScalarT], **kwargs: Unpack[_KwargsDL] -) -> _nt.Array1D[_ScalarT]: ... -@overload # (stop: int) -def arange( - stop: int | np.intp, *, dtype: _nt.ToDTypeInt64 | None = None, **kwargs: Unpack[_KwargsDL] -) -> _nt.Array1D[np.intp]: ... -@overload # (start: int, stop: int, step?: int) -def arange( - start: int | np.intp, - stop: int | np.intp, - step: int | np.intp = ..., - dtype: _nt.ToDTypeInt64 | None = None, - **kwargs: Unpack[_KwargsDL], -) -> _nt.Array1D[np.intp]: ... -@overload # (stop: float, dtype=f64-like) -def arange(stop: float, *, dtype: _nt.ToDTypeFloat64, **kwargs: Unpack[_KwargsDL]) -> _nt.Array1D[np.float64]: ... -@overload # (start: float, stop: float, step?: float, dtype=f64-like) -def arange( - start: float, stop: float, step: float = ..., *, dtype: _nt.ToDTypeFloat64, **kwargs: Unpack[_KwargsDL] -) -> _nt.Array1D[np.float64]: ... -@overload # (start: float, stop: float, step: float, dtype=f64-like) +# NOTE: The `float64 | Any` return types needed to avoid incompatible overlapping overloads +@overload # (int-like, int-like?, int-like?) def arange( - start: float, stop: float, step: float, dtype: _nt.ToDTypeFloat64, **kwargs: Unpack[_KwargsDL] -) -> _nt.Array1D[np.float64]: ... -@overload # (stop: float) -def arange( - stop: _nt.JustFloat, *, dtype: _nt.ToDTypeFloat64 | None = None, **kwargs: Unpack[_KwargsDL] -) -> _nt.Array1D[np.float64]: ... -@overload # (start: float, stop: float, step?: float) -def arange( - start: _nt.JustFloat, - stop: float, - step: float = ..., - dtype: _nt.ToDTypeFloat64 | None = None, - **kwargs: Unpack[_KwargsDL], -) -> _nt.Array1D[np.float64]: ... -@overload # (start: float, stop: float, step?: float) -def arange( - start: float, - stop: _nt.JustFloat, - step: float = ..., - dtype: _nt.ToDTypeFloat64 | None = None, - **kwargs: Unpack[_KwargsDL], -) -> _nt.Array1D[np.float64]: ... -@overload # int-like -def arange(stop: _ToInt, *, dtype: None = None, **kwargs: Unpack[_KwargsDL]) -> _nt.Array1D[np.signedinteger]: ... -@overload # int-like + start_or_stop: _ToInt, + /, + stop: _ToInt | None = None, + step: _ToInt | None = 1, + *, + dtype: type[int] | _DTypeLike[np.int_] | None = None, + device: L["cpu"] | None = None, + like: _CanArrayFunc | None = None, +) -> _nt.Array1D[np.int_]: ... +@overload # (float, float-like?, float-like?) def arange( - start: _ToInt, stop: _ToInt, step: _ToInt = ..., dtype: None = None, **kwargs: Unpack[_KwargsDL] -) -> _nt.Array1D[np.signedinteger]: ... -@overload # float-like + start_or_stop: float | np.floating, + /, + stop: _ToFloat | None = None, + step: _ToFloat | None = 1, + *, + dtype: type[float] | _DTypeLike[np.float64] | None = None, + device: L["cpu"] | None = None, + like: _CanArrayFunc | None = None, +) -> _nt.Array1D[np.float64 | Any]: ... +@overload # (float-like, float, float-like?) def arange( - stop: _ToFloat, *, dtype: None = None, **kwargs: Unpack[_KwargsDL] -) -> _nt.Array1D[np.floating | np.signedinteger]: ... -@overload # float-like + start_or_stop: _ToFloat, + /, + stop: float | np.floating, + step: _ToFloat | None = 1, + *, + dtype: type[float] | _DTypeLike[np.float64] | None = None, + device: L["cpu"] | None = None, + like: _CanArrayFunc | None = None, +) -> _nt.Array1D[np.float64 | Any]: ... +@overload # (timedelta, timedelta-like?, timedelta-like?) def arange( - start: _ToFloat, stop: _ToFloat, step: _ToFloat = ..., dtype: None = None, **kwargs: Unpack[_KwargsDL] -) -> _nt.Array1D[np.floating | np.signedinteger]: ... -@overload # timedelta64 -def arange(stop: np.timedelta64, *, dtype: None = None, **kwargs: Unpack[_KwargsDL]) -> _nt.Array1D[np.timedelta64]: ... -@overload # timedelta64 + start_or_stop: np.timedelta64, + /, + stop: _ToTD64 | None = None, + step: _ToTD64 | None = 1, + *, + dtype: _DTypeLike[np.timedelta64] | None = None, + device: L["cpu"] | None = None, + like: _CanArrayFunc | None = None, +) -> _nt.Array1D[np.timedelta64[Incomplete]]: ... +@overload # (timedelta-like, timedelta, timedelta-like?) def arange( - start: _ToTD64, stop: np.timedelta64, step: _ToTD64 = ..., dtype: None = None, **kwargs: Unpack[_KwargsDL] -) -> _nt.Array1D[np.timedelta64]: ... -@overload # timedelta64 + start_or_stop: _ToTD64, + /, + stop: np.timedelta64, + step: _ToTD64 | None = 1, + *, + dtype: _DTypeLike[np.timedelta64] | None = None, + device: L["cpu"] | None = None, + like: _CanArrayFunc | None = None, +) -> _nt.Array1D[np.timedelta64[Incomplete]]: ... +@overload # (datetime, datetime, timedelta-like) (requires both start and stop) def arange( - start: np.timedelta64, stop: _ToTD64, step: _ToTD64 = ..., dtype: None = None, **kwargs: Unpack[_KwargsDL] -) -> _nt.Array1D[np.timedelta64]: ... -@overload # datetime64 (requires both start and stop) + start_or_stop: np.datetime64, + /, + stop: np.datetime64, + step: _ToTD64 | None = 1, + *, + dtype: _DTypeLike[np.datetime64] | None = None, + device: L["cpu"] | None = None, + like: _CanArrayFunc | None = None, +) -> _nt.Array1D[np.datetime64[Incomplete]]: ... +@overload # dtype= def arange( - start: np.datetime64, stop: np.datetime64, step: _ToDT64 = ..., dtype: None = None, **kwargs: Unpack[_KwargsDL] -) -> _nt.Array1D[np.datetime64]: ... -@overload # fallback -def arange(stop: object, *, dtype: npt.DTypeLike, **kwargs: Unpack[_KwargsDL]) -> _nt.Array1D[Incomplete]: ... -@overload # fallback + start_or_stop: _ArangeScalar | float, + /, + stop: _ArangeScalar | float | None = None, + step: _ArangeScalar | float | None = 1, + *, + dtype: _DTypeLike[_ArangeScalarT], + device: L["cpu"] | None = None, + like: _CanArrayFunc | None = None, +) -> _nt.Array1D[_ArangeScalarT]: ... +@overload # dtype= def arange( - start: object, stop: object, step: object = ..., dtype: npt.DTypeLike | None = None, **kwargs: Unpack[_KwargsDL] + start_or_stop: _ArangeScalar | float, + /, + stop: _ArangeScalar | float | None = None, + step: _ArangeScalar | float | None = 1, + *, + dtype: npt.DTypeLike | None = None, + device: L["cpu"] | None = None, + like: _CanArrayFunc | None = None, ) -> _nt.Array1D[Incomplete]: ... ### diff --git a/tool/allowlists/todo.txt b/tool/allowlists/todo.txt index 76de640f..00f1cb12 100644 --- a/tool/allowlists/todo.txt +++ b/tool/allowlists/todo.txt @@ -12,7 +12,6 @@ numpy._core._methods.umr_maximum numpy._core._methods.umr_minimum numpy._core._methods.umr_prod numpy._core._methods.umr_sum -numpy._core._multiarray_umath.arange numpy._core._multiarray_umath.empty numpy._core._multiarray_umath.empty_like numpy._core._multiarray_umath.flatiter.__array__ @@ -35,7 +34,6 @@ numpy._core._type_aliases.sctype_list numpy._core._type_aliases.type_group numpy._core._type_aliases.type_info numpy._core._type_aliases.v -numpy._core.arange numpy._core.array2string numpy._core.arrayprint.array2string numpy._core.copyto @@ -52,7 +50,6 @@ numpy._core.fromiter numpy._core.fromnumeric.reshape numpy._core.getlimits.finfo.smallest_normal numpy._core.may_share_memory -numpy._core.multiarray.arange numpy._core.multiarray.copyto numpy._core.multiarray.dtype.__new__ numpy._core.multiarray.empty @@ -66,7 +63,6 @@ numpy._core.multiarray.may_share_memory numpy._core.multiarray.shares_memory numpy._core.multiarray.where numpy._core.multiarray.zeros -numpy._core.numeric.arange numpy._core.numeric.array2string numpy._core.numeric.copyto numpy._core.numeric.dtype.__new__ @@ -96,7 +92,6 @@ numpy._core.umath.__all__ numpy._core.void.__new__ numpy._core.where numpy._core.zeros -numpy.arange numpy.array2string numpy.char.chararray.argsort numpy.copyto @@ -104,7 +99,6 @@ numpy.core._internal._ctypes.get_as_parameter numpy.core._internal._ctypes.get_data numpy.core._internal._ctypes.get_shape numpy.core._internal._ctypes.get_strides -numpy.core._multiarray_umath.arange numpy.core._multiarray_umath.empty numpy.core._multiarray_umath.empty_like numpy.core._multiarray_umath.flatiter.__array__ @@ -117,7 +111,6 @@ numpy.core.arrayprint.array2string numpy.core.defchararray.chararray.argsort numpy.core.fromnumeric.reshape numpy.core.getlimits.finfo.smallest_normal -numpy.core.multiarray.arange numpy.core.multiarray.copyto numpy.core.multiarray.dtype.__new__ numpy.core.multiarray.empty @@ -131,7 +124,6 @@ numpy.core.multiarray.may_share_memory numpy.core.multiarray.shares_memory numpy.core.multiarray.where numpy.core.multiarray.zeros -numpy.core.numeric.arange numpy.core.numeric.array2string numpy.core.numeric.copyto numpy.core.numeric.dtype.__new__ @@ -289,7 +281,6 @@ numpy.ma.var numpy.ma.vstack numpy.ma.zeros numpy.ma.zeros_like -numpy.matlib.arange numpy.matlib.array2string numpy.matlib.copyto numpy.matlib.corrcoef From 3b6852d0dc1085e6a5c1b18e902a9e4c7119fd76 Mon Sep 17 00:00:00 2001 From: jorenham Date: Tue, 23 Dec 2025 13:18:14 +0100 Subject: [PATCH 07/20] =?UTF-8?q?=F0=9F=91=BD=EF=B8=8F=20`np.copyto`:=20sy?= =?UTF-8?q?nc=20with=20upstream?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/numpy-stubs/_core/_multiarray_umath.pyi | 2 +- tool/allowlists/todo.txt | 7 ------- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/src/numpy-stubs/_core/_multiarray_umath.pyi b/src/numpy-stubs/_core/_multiarray_umath.pyi index 245b0ee4..9cf12d20 100644 --- a/src/numpy-stubs/_core/_multiarray_umath.pyi +++ b/src/numpy-stubs/_core/_multiarray_umath.pyi @@ -1446,7 +1446,7 @@ def packbits( ) -> _nt.Array[np.uint8]: ... # -def copyto(dst: _nt.Array, src: npt.ArrayLike, casting: _CastingKind = "same_kind") -> None: ... +def copyto(dst: _nt.Array, src: npt.ArrayLike, casting: _CastingKind = "same_kind", where: object = True) -> None: ... # @overload diff --git a/tool/allowlists/todo.txt b/tool/allowlists/todo.txt index 00f1cb12..e852f0fd 100644 --- a/tool/allowlists/todo.txt +++ b/tool/allowlists/todo.txt @@ -36,7 +36,6 @@ numpy._core._type_aliases.type_info numpy._core._type_aliases.v numpy._core.array2string numpy._core.arrayprint.array2string -numpy._core.copyto numpy._core.defchararray.chararray.argsort numpy._core.dtype.__new__ numpy._core.empty @@ -50,7 +49,6 @@ numpy._core.fromiter numpy._core.fromnumeric.reshape numpy._core.getlimits.finfo.smallest_normal numpy._core.may_share_memory -numpy._core.multiarray.copyto numpy._core.multiarray.dtype.__new__ numpy._core.multiarray.empty numpy._core.multiarray.empty_like @@ -64,7 +62,6 @@ numpy._core.multiarray.shares_memory numpy._core.multiarray.where numpy._core.multiarray.zeros numpy._core.numeric.array2string -numpy._core.numeric.copyto numpy._core.numeric.dtype.__new__ numpy._core.numeric.empty numpy._core.numeric.empty_like @@ -94,7 +91,6 @@ numpy._core.where numpy._core.zeros numpy.array2string numpy.char.chararray.argsort -numpy.copyto numpy.core._internal._ctypes.get_as_parameter numpy.core._internal._ctypes.get_data numpy.core._internal._ctypes.get_shape @@ -111,7 +107,6 @@ numpy.core.arrayprint.array2string numpy.core.defchararray.chararray.argsort numpy.core.fromnumeric.reshape numpy.core.getlimits.finfo.smallest_normal -numpy.core.multiarray.copyto numpy.core.multiarray.dtype.__new__ numpy.core.multiarray.empty numpy.core.multiarray.empty_like @@ -125,7 +120,6 @@ numpy.core.multiarray.shares_memory numpy.core.multiarray.where numpy.core.multiarray.zeros numpy.core.numeric.array2string -numpy.core.numeric.copyto numpy.core.numeric.dtype.__new__ numpy.core.numeric.empty numpy.core.numeric.empty_like @@ -282,7 +276,6 @@ numpy.ma.vstack numpy.ma.zeros numpy.ma.zeros_like numpy.matlib.array2string -numpy.matlib.copyto numpy.matlib.corrcoef numpy.matlib.dtype.__new__ numpy.matlib.empty_like From 1429f24414c51538df1bd76db3815baf7050c5d7 Mon Sep 17 00:00:00 2001 From: jorenham Date: Tue, 23 Dec 2025 13:22:20 +0100 Subject: [PATCH 08/20] =?UTF-8?q?=F0=9F=91=BD=EF=B8=8F=20`np.empty`:=20syn?= =?UTF-8?q?c=20with=20upstream?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/numpy-stubs/_core/_multiarray_umath.pyi | 84 ++++++++++++++++++--- tool/allowlists/todo.txt | 8 -- 2 files changed, 72 insertions(+), 20 deletions(-) diff --git a/src/numpy-stubs/_core/_multiarray_umath.pyi b/src/numpy-stubs/_core/_multiarray_umath.pyi index 9cf12d20..554765fe 100644 --- a/src/numpy-stubs/_core/_multiarray_umath.pyi +++ b/src/numpy-stubs/_core/_multiarray_umath.pyi @@ -501,51 +501,111 @@ def get_handler_version(a: _nt.Array = ..., /) -> int | None: ... # NOTE: Keep in sync with `zeros` and `.numeric.ones` @overload # 1d shape, default dtype (float64) def empty( - shape: _ShapeLike1D, dtype: _nt.ToDTypeFloat64 = ..., order: _OrderCF = "C", **kwargs: Unpack[_KwargsDL] + shape: _ShapeLike1D, + dtype: _nt.ToDTypeFloat64 | None = None, + order: _OrderCF = "C", + *, + device: _Device | None = None, + like: _CanArrayFunc | None = None, ) -> _nt.Array1D[np.float64]: ... @overload # 1d shape, known dtype def empty( - shape: _ShapeLike1D, dtype: _DTypeT | _HasDType[_DTypeT], order: _OrderCF = "C", **kwargs: Unpack[_KwargsDL] + shape: _ShapeLike1D, + dtype: _DTypeT | _HasDType[_DTypeT], + order: _OrderCF = "C", + *, + device: _Device | None = None, + like: _CanArrayFunc | None = None, ) -> np.ndarray[_nt.Rank1, _DTypeT]: ... @overload # 1d shape, known scalar-type def empty( - shape: _ShapeLike1D, dtype: _DTypeLike[_ScalarT], order: _OrderCF = "C", **kwargs: Unpack[_KwargsDL] + shape: _ShapeLike1D, + dtype: _DTypeLike[_ScalarT], + order: _OrderCF = "C", + *, + device: _Device | None = None, + like: _CanArrayFunc | None = None, ) -> _nt.Array1D[_ScalarT]: ... @overload # 1d shape, unknown dtype def empty( - shape: _ShapeLike1D, dtype: npt.DTypeLike = ..., order: _OrderCF = "C", **kwargs: Unpack[_KwargsDL] + shape: _ShapeLike1D, + dtype: npt.DTypeLike = None, + order: _OrderCF = "C", + *, + device: _Device | None = None, + like: _CanArrayFunc | None = None, ) -> _nt.Array1D[Incomplete]: ... @overload # known shape, default dtype (float64) def empty( - shape: _AnyShapeT, dtype: _nt.ToDTypeFloat64 = ..., order: _OrderCF = "C", **kwargs: Unpack[_KwargsDL] + shape: _AnyShapeT, + dtype: _nt.ToDTypeFloat64 | None = None, + order: _OrderCF = "C", + *, + device: _Device | None = None, + like: _CanArrayFunc | None = None, ) -> _nt.Array[np.float64, _AnyShapeT]: ... @overload # known shape, known dtype (mypy reports a false positive) def empty( # type: ignore[overload-overlap] - shape: _AnyShapeT, dtype: _DTypeT | _HasDType[_DTypeT], order: _OrderCF = "C", **kwargs: Unpack[_KwargsDL] + shape: _AnyShapeT, + dtype: _DTypeT | _HasDType[_DTypeT], + order: _OrderCF = "C", + *, + device: _Device | None = None, + like: _CanArrayFunc | None = None, ) -> np.ndarray[_AnyShapeT, _DTypeT]: ... @overload # known shape, known scalar-type def empty( - shape: _AnyShapeT, dtype: _DTypeLike[_ScalarT], order: _OrderCF = "C", **kwargs: Unpack[_KwargsDL] + shape: _AnyShapeT, + dtype: _DTypeLike[_ScalarT], + order: _OrderCF = "C", + *, + device: _Device | None = None, + like: _CanArrayFunc | None = None, ) -> _nt.Array[_ScalarT, _AnyShapeT]: ... @overload # known shape, unknown scalar-type def empty( - shape: _AnyShapeT, dtype: npt.DTypeLike = ..., order: _OrderCF = "C", **kwargs: Unpack[_KwargsDL] + shape: _AnyShapeT, + dtype: npt.DTypeLike = None, + order: _OrderCF = "C", + *, + device: _Device | None = None, + like: _CanArrayFunc | None = None, ) -> _nt.Array[Incomplete, _AnyShapeT]: ... @overload # unknown shape, default dtype def empty( - shape: _ShapeLike, dtype: _nt.ToDTypeFloat64 = ..., order: _OrderCF = "C", **kwargs: Unpack[_KwargsDL] + shape: _ShapeLike, + dtype: _nt.ToDTypeFloat64 | None = None, + order: _OrderCF = "C", + *, + device: _Device | None = None, + like: _CanArrayFunc | None = None, ) -> _nt.Array[np.float64]: ... @overload # unknown shape, known dtype def empty( - shape: _ShapeLike, dtype: _DTypeT | _HasDType[_DTypeT], order: _OrderCF = "C", **kwargs: Unpack[_KwargsDL] + shape: _ShapeLike, + dtype: _DTypeT | _HasDType[_DTypeT], + order: _OrderCF = "C", + *, + device: _Device | None = None, + like: _CanArrayFunc | None = None, ) -> np.ndarray[Incomplete, _DTypeT]: ... @overload # unknown shape, known scalar-type def empty( - shape: _ShapeLike, dtype: _DTypeLike[_ScalarT], order: _OrderCF = "C", **kwargs: Unpack[_KwargsDL] + shape: _ShapeLike, + dtype: _DTypeLike[_ScalarT], + order: _OrderCF = "C", + *, + device: _Device | None = None, + like: _CanArrayFunc | None = None, ) -> _nt.Array[_ScalarT]: ... @overload # unknown shape, unknown dtype def empty( - shape: _ShapeLike, dtype: npt.DTypeLike = ..., order: _OrderCF = "C", **kwargs: Unpack[_KwargsDL] + shape: _ShapeLike, + dtype: npt.DTypeLike = ..., + order: _OrderCF = "C", + *, + device: _Device | None = None, + like: _CanArrayFunc | None = None, ) -> _nt.Array[Incomplete]: ... # NOTE: Keep in sync with `empty` (below) and `numpy._core.numeric.ones` diff --git a/tool/allowlists/todo.txt b/tool/allowlists/todo.txt index e852f0fd..22f7db38 100644 --- a/tool/allowlists/todo.txt +++ b/tool/allowlists/todo.txt @@ -12,7 +12,6 @@ numpy._core._methods.umr_maximum numpy._core._methods.umr_minimum numpy._core._methods.umr_prod numpy._core._methods.umr_sum -numpy._core._multiarray_umath.empty numpy._core._multiarray_umath.empty_like numpy._core._multiarray_umath.flatiter.__array__ numpy._core._multiarray_umath.from_dlpack @@ -38,7 +37,6 @@ numpy._core.array2string numpy._core.arrayprint.array2string numpy._core.defchararray.chararray.argsort numpy._core.dtype.__new__ -numpy._core.empty numpy._core.empty_like numpy._core.finfo.smallest_normal numpy._core.flatiter.__array__ @@ -50,7 +48,6 @@ numpy._core.fromnumeric.reshape numpy._core.getlimits.finfo.smallest_normal numpy._core.may_share_memory numpy._core.multiarray.dtype.__new__ -numpy._core.multiarray.empty numpy._core.multiarray.empty_like numpy._core.multiarray.flatiter.__array__ numpy._core.multiarray.from_dlpack @@ -63,7 +60,6 @@ numpy._core.multiarray.where numpy._core.multiarray.zeros numpy._core.numeric.array2string numpy._core.numeric.dtype.__new__ -numpy._core.numeric.empty numpy._core.numeric.empty_like numpy._core.numeric.flatiter.__array__ numpy._core.numeric.from_dlpack @@ -95,7 +91,6 @@ numpy.core._internal._ctypes.get_as_parameter numpy.core._internal._ctypes.get_data numpy.core._internal._ctypes.get_shape numpy.core._internal._ctypes.get_strides -numpy.core._multiarray_umath.empty numpy.core._multiarray_umath.empty_like numpy.core._multiarray_umath.flatiter.__array__ numpy.core._multiarray_umath.from_dlpack @@ -108,7 +103,6 @@ numpy.core.defchararray.chararray.argsort numpy.core.fromnumeric.reshape numpy.core.getlimits.finfo.smallest_normal numpy.core.multiarray.dtype.__new__ -numpy.core.multiarray.empty numpy.core.multiarray.empty_like numpy.core.multiarray.flatiter.__array__ numpy.core.multiarray.from_dlpack @@ -121,7 +115,6 @@ numpy.core.multiarray.where numpy.core.multiarray.zeros numpy.core.numeric.array2string numpy.core.numeric.dtype.__new__ -numpy.core.numeric.empty numpy.core.numeric.empty_like numpy.core.numeric.flatiter.__array__ numpy.core.numeric.from_dlpack @@ -142,7 +135,6 @@ numpy.core.umath.__all__ numpy.core.umath.matmul numpy.corrcoef numpy.dtype.__new__ -numpy.empty numpy.empty_like numpy.f2py._backends._meson.MesonTemplate.objects_substitution numpy.fft.helper From 9d7aa0dcaab48ff54736e98e72119a04eff6100d Mon Sep 17 00:00:00 2001 From: jorenham Date: Tue, 23 Dec 2025 13:29:19 +0100 Subject: [PATCH 09/20] =?UTF-8?q?=F0=9F=91=BD=EF=B8=8F=20`np.empty=5Flike`?= =?UTF-8?q?:=20sync=20with=20upstream?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/numpy-stubs/_core/_multiarray_umath.pyi | 34 +++++++++++++++++++++ tool/allowlists/todo.txt | 9 ------ 2 files changed, 34 insertions(+), 9 deletions(-) diff --git a/src/numpy-stubs/_core/_multiarray_umath.pyi b/src/numpy-stubs/_core/_multiarray_umath.pyi index 554765fe..18289a77 100644 --- a/src/numpy-stubs/_core/_multiarray_umath.pyi +++ b/src/numpy-stubs/_core/_multiarray_umath.pyi @@ -662,6 +662,7 @@ def zeros( @overload # known array, subok=True def empty_like( prototype: _ArrayT, + /, dtype: None = None, order: _OrderKACF = "K", subok: L[True] = True, @@ -672,6 +673,7 @@ def empty_like( @overload # array-like with known shape and type def empty_like( prototype: _CanArray[np.ndarray[_ShapeT, _DTypeT]], + /, dtype: _DTypeT | _HasDType[_DTypeT] | None = None, order: _OrderKACF = "K", subok: bool = True, @@ -682,6 +684,7 @@ def empty_like( @overload # workaround for microsoft/pyright#10232 def empty_like( prototype: _nt._ToArray_nnd[np.bool_], + /, dtype: _nt.ToDTypeBool | None = None, order: _OrderKACF = "K", subok: bool = True, @@ -692,6 +695,7 @@ def empty_like( @overload # bool 0d array-like def empty_like( prototype: _nt.ToBool_0d, + /, dtype: _nt.ToDTypeBool | None = None, order: _OrderKACF = "K", subok: bool = True, @@ -702,6 +706,7 @@ def empty_like( @overload # bool 1d array-like def empty_like( prototype: _nt.ToBool_1ds, + /, dtype: _nt.ToDTypeBool | None = None, order: _OrderKACF = "K", subok: bool = True, @@ -712,6 +717,7 @@ def empty_like( @overload # bool 2d array-like def empty_like( prototype: _nt.ToBool_2ds, + /, dtype: _nt.ToDTypeBool | None = None, order: _OrderKACF = "K", subok: bool = True, @@ -722,6 +728,7 @@ def empty_like( @overload # bool 3d array-like def empty_like( prototype: _nt.ToBool_3ds, + /, dtype: _nt.ToDTypeBool | None = None, order: _OrderKACF = "K", subok: bool = True, @@ -732,6 +739,7 @@ def empty_like( @overload # workaround for microsoft/pyright#10232 def empty_like( # type: ignore[overload-overlap] # python/mypy#19908 prototype: _nt._ToArray_nnd[np.intp], + /, dtype: _nt.ToDTypeInt64 | None = None, order: _OrderKACF = "K", subok: bool = True, @@ -742,6 +750,7 @@ def empty_like( # type: ignore[overload-overlap] # python/mypy#19908 @overload # int 0d array-like def empty_like( prototype: _nt.ToInt_0d, + /, dtype: _nt.ToDTypeInt64 | None = None, order: _OrderKACF = "K", subok: bool = True, @@ -752,6 +761,7 @@ def empty_like( @overload # int 1d array-like def empty_like( prototype: _nt.ToInt_1ds, + /, dtype: _nt.ToDTypeInt64 | None = None, order: _OrderKACF = "K", subok: bool = True, @@ -762,6 +772,7 @@ def empty_like( @overload # int 2d array-like def empty_like( prototype: _nt.ToInt_2ds, + /, dtype: _nt.ToDTypeInt64 | None = None, order: _OrderKACF = "K", subok: bool = True, @@ -772,6 +783,7 @@ def empty_like( @overload # int 3d array-like def empty_like( prototype: _nt.ToInt_3ds, + /, dtype: _nt.ToDTypeInt64 | None = None, order: _OrderKACF = "K", subok: bool = True, @@ -782,6 +794,7 @@ def empty_like( @overload # workaround for microsoft/pyright#10232 def empty_like( # type: ignore[overload-overlap] # python/mypy#19908 prototype: _nt._ToArray_nnd[np.float64], + /, dtype: _nt.ToDTypeFloat64 | None = None, order: _OrderKACF = "K", subok: bool = True, @@ -792,6 +805,7 @@ def empty_like( # type: ignore[overload-overlap] # python/mypy#19908 @overload # float 0d array-like def empty_like( prototype: _nt.ToFloat64_0d, + /, dtype: _nt.ToDTypeFloat64 | None = None, order: _OrderKACF = "K", subok: bool = True, @@ -802,6 +816,7 @@ def empty_like( @overload # float 1d array-like def empty_like( prototype: _nt.ToFloat64_1ds, + /, dtype: _nt.ToDTypeFloat64 | None = None, order: _OrderKACF = "K", subok: bool = True, @@ -812,6 +827,7 @@ def empty_like( @overload # float 2d array-like def empty_like( prototype: _nt.ToFloat64_2ds, + /, dtype: _nt.ToDTypeFloat64 | None = None, order: _OrderKACF = "K", subok: bool = True, @@ -822,6 +838,7 @@ def empty_like( @overload # float 3d array-like def empty_like( prototype: _nt.ToFloat64_3ds, + /, dtype: _nt.ToDTypeFloat64 | None = None, order: _OrderKACF = "K", subok: bool = True, @@ -832,6 +849,7 @@ def empty_like( @overload # complex 0d array-like def empty_like( prototype: _nt.ToComplex128_0d, + /, dtype: _nt.ToDTypeComplex128 | None = None, order: _OrderKACF = "K", subok: bool = True, @@ -842,6 +860,7 @@ def empty_like( @overload # workaround for microsoft/pyright#10232 def empty_like( prototype: _nt._ToArray_nnd[np.complex128], + /, dtype: _nt.ToDTypeComplex128 | None = None, order: _OrderKACF = "K", subok: bool = True, @@ -852,6 +871,7 @@ def empty_like( @overload # complex 1d array-like def empty_like( prototype: _nt.ToComplex128_1ds, + /, dtype: _nt.ToDTypeComplex128 | None = None, order: _OrderKACF = "K", subok: bool = True, @@ -862,6 +882,7 @@ def empty_like( @overload # complex 2d array-like def empty_like( prototype: _nt.ToComplex128_2ds, + /, dtype: _nt.ToDTypeComplex128 | None = None, order: _OrderKACF = "K", subok: bool = True, @@ -872,6 +893,7 @@ def empty_like( @overload # complex 3d array-like def empty_like( prototype: _nt.ToComplex128_3ds, + /, dtype: _nt.ToDTypeComplex128 | None = None, order: _OrderKACF = "K", subok: bool = True, @@ -882,6 +904,7 @@ def empty_like( @overload # array-like with known scalar-type, given shape def empty_like( # type: ignore[overload-overlap] prototype: _ArrayLike[_ScalarT], + /, dtype: np.dtype[_ScalarT] | None = None, order: _OrderKACF = "K", subok: bool = True, @@ -892,6 +915,7 @@ def empty_like( # type: ignore[overload-overlap] @overload # array-like with known scalar-type, unknown shape def empty_like( prototype: _ArrayLike[_ScalarT], + /, dtype: np.dtype[_ScalarT] | None = None, order: _OrderKACF = "K", subok: bool = True, @@ -902,6 +926,7 @@ def empty_like( @overload # given shape, given dtype def empty_like( # type: ignore[overload-overlap] prototype: object, + /, dtype: _DTypeT | _HasDType[_DTypeT], order: _OrderKACF = "K", subok: bool = True, @@ -912,6 +937,7 @@ def empty_like( # type: ignore[overload-overlap] @overload # unknown shape, given dtype def empty_like( prototype: object, + /, dtype: _DTypeT | _HasDType[_DTypeT], order: _OrderKACF = "K", subok: bool = True, @@ -922,6 +948,7 @@ def empty_like( @overload # given shape, given scalar-type def empty_like( prototype: object, + /, dtype: _DTypeLike[_ScalarT], order: _OrderKACF = "K", subok: bool = True, @@ -932,6 +959,7 @@ def empty_like( @overload # unknown shape, given scalar-type def empty_like( prototype: object, + /, dtype: _DTypeLike[_ScalarT], order: _OrderKACF = "K", subok: bool = True, @@ -942,6 +970,7 @@ def empty_like( @overload # bool array-like def empty_like( prototype: _nt.ToBool_nd, + /, dtype: _nt.ToDTypeBool | None = None, order: _OrderKACF = "K", subok: bool = True, @@ -952,6 +981,7 @@ def empty_like( @overload # int array-like def empty_like( prototype: _nt.ToInt_nd, + /, dtype: _nt.ToDTypeInt64 | None = None, order: _OrderKACF = "K", subok: bool = True, @@ -962,6 +992,7 @@ def empty_like( @overload # float array-like def empty_like( prototype: _nt.ToFloat64_nd, + /, dtype: _nt.ToDTypeFloat64 | None = None, order: _OrderKACF = "K", subok: bool = True, @@ -972,6 +1003,7 @@ def empty_like( @overload # complex array-like def empty_like( prototype: _nt.ToComplex128_nd, + /, dtype: _nt.ToDTypeComplex128 | None = None, order: _OrderKACF = "K", subok: bool = True, @@ -982,6 +1014,7 @@ def empty_like( @overload # given shape, unknown scalar-type def empty_like( prototype: object, + /, dtype: npt.DTypeLike | None = None, order: _OrderKACF = "K", subok: bool = True, @@ -992,6 +1025,7 @@ def empty_like( @overload # unknown shape, unknown scalar-type def empty_like( prototype: object, + /, dtype: npt.DTypeLike | None = None, order: _OrderKACF = "K", subok: bool = True, diff --git a/tool/allowlists/todo.txt b/tool/allowlists/todo.txt index 22f7db38..ec1212b7 100644 --- a/tool/allowlists/todo.txt +++ b/tool/allowlists/todo.txt @@ -12,7 +12,6 @@ numpy._core._methods.umr_maximum numpy._core._methods.umr_minimum numpy._core._methods.umr_prod numpy._core._methods.umr_sum -numpy._core._multiarray_umath.empty_like numpy._core._multiarray_umath.flatiter.__array__ numpy._core._multiarray_umath.from_dlpack numpy._core._multiarray_umath.frombuffer @@ -37,7 +36,6 @@ numpy._core.array2string numpy._core.arrayprint.array2string numpy._core.defchararray.chararray.argsort numpy._core.dtype.__new__ -numpy._core.empty_like numpy._core.finfo.smallest_normal numpy._core.flatiter.__array__ numpy._core.from_dlpack @@ -48,7 +46,6 @@ numpy._core.fromnumeric.reshape numpy._core.getlimits.finfo.smallest_normal numpy._core.may_share_memory numpy._core.multiarray.dtype.__new__ -numpy._core.multiarray.empty_like numpy._core.multiarray.flatiter.__array__ numpy._core.multiarray.from_dlpack numpy._core.multiarray.frombuffer @@ -60,7 +57,6 @@ numpy._core.multiarray.where numpy._core.multiarray.zeros numpy._core.numeric.array2string numpy._core.numeric.dtype.__new__ -numpy._core.numeric.empty_like numpy._core.numeric.flatiter.__array__ numpy._core.numeric.from_dlpack numpy._core.numeric.frombuffer @@ -91,7 +87,6 @@ numpy.core._internal._ctypes.get_as_parameter numpy.core._internal._ctypes.get_data numpy.core._internal._ctypes.get_shape numpy.core._internal._ctypes.get_strides -numpy.core._multiarray_umath.empty_like numpy.core._multiarray_umath.flatiter.__array__ numpy.core._multiarray_umath.from_dlpack numpy.core._multiarray_umath.frombuffer @@ -103,7 +98,6 @@ numpy.core.defchararray.chararray.argsort numpy.core.fromnumeric.reshape numpy.core.getlimits.finfo.smallest_normal numpy.core.multiarray.dtype.__new__ -numpy.core.multiarray.empty_like numpy.core.multiarray.flatiter.__array__ numpy.core.multiarray.from_dlpack numpy.core.multiarray.frombuffer @@ -115,7 +109,6 @@ numpy.core.multiarray.where numpy.core.multiarray.zeros numpy.core.numeric.array2string numpy.core.numeric.dtype.__new__ -numpy.core.numeric.empty_like numpy.core.numeric.flatiter.__array__ numpy.core.numeric.from_dlpack numpy.core.numeric.frombuffer @@ -135,7 +128,6 @@ numpy.core.umath.__all__ numpy.core.umath.matmul numpy.corrcoef numpy.dtype.__new__ -numpy.empty_like numpy.f2py._backends._meson.MesonTemplate.objects_substitution numpy.fft.helper numpy.finfo.smallest_normal @@ -270,7 +262,6 @@ numpy.ma.zeros_like numpy.matlib.array2string numpy.matlib.corrcoef numpy.matlib.dtype.__new__ -numpy.matlib.empty_like numpy.matlib.finfo.smallest_normal numpy.matlib.flatiter.__array__ numpy.matlib.from_dlpack From dfc5c9c3149bdd76ed7c2f2cfcc376e6f442203c Mon Sep 17 00:00:00 2001 From: jorenham Date: Tue, 23 Dec 2025 13:32:43 +0100 Subject: [PATCH 10/20] =?UTF-8?q?=F0=9F=91=BD=EF=B8=8F=20`np.from=5Fdlpack?= =?UTF-8?q?`:=20sync=20with=20upstream?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/numpy-stubs/_core/_multiarray_umath.pyi | 6 +----- tool/allowlists/todo.txt | 9 --------- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/src/numpy-stubs/_core/_multiarray_umath.pyi b/src/numpy-stubs/_core/_multiarray_umath.pyi index 18289a77..6848e584 100644 --- a/src/numpy-stubs/_core/_multiarray_umath.pyi +++ b/src/numpy-stubs/_core/_multiarray_umath.pyi @@ -177,10 +177,6 @@ class _HasDoc(Protocol): ### -@type_check_only -class _KwargsD(TypedDict, total=False): - device: _Device | None - @type_check_only class _KwargsL(TypedDict, total=False): like: _CanArrayFunc | None @@ -1369,7 +1365,7 @@ def frombuffer( ) -> _nt.Array[Incomplete]: ... # -def from_dlpack(x: _CanDLPack, /, *, copy: py_bool | None = None, **kwargs: Unpack[_KwargsD]) -> _nt.Array: ... +def from_dlpack(x: _CanDLPack, /, *, copy: py_bool | None = None, device: _Device | None = None) -> _nt.Array: ... ### diff --git a/tool/allowlists/todo.txt b/tool/allowlists/todo.txt index ec1212b7..95e8ee56 100644 --- a/tool/allowlists/todo.txt +++ b/tool/allowlists/todo.txt @@ -13,7 +13,6 @@ numpy._core._methods.umr_minimum numpy._core._methods.umr_prod numpy._core._methods.umr_sum numpy._core._multiarray_umath.flatiter.__array__ -numpy._core._multiarray_umath.from_dlpack numpy._core._multiarray_umath.frombuffer numpy._core._multiarray_umath.fromfile numpy._core._multiarray_umath.fromiter @@ -38,7 +37,6 @@ numpy._core.defchararray.chararray.argsort numpy._core.dtype.__new__ numpy._core.finfo.smallest_normal numpy._core.flatiter.__array__ -numpy._core.from_dlpack numpy._core.frombuffer numpy._core.fromfile numpy._core.fromiter @@ -47,7 +45,6 @@ numpy._core.getlimits.finfo.smallest_normal numpy._core.may_share_memory numpy._core.multiarray.dtype.__new__ numpy._core.multiarray.flatiter.__array__ -numpy._core.multiarray.from_dlpack numpy._core.multiarray.frombuffer numpy._core.multiarray.fromfile numpy._core.multiarray.fromiter @@ -58,7 +55,6 @@ numpy._core.multiarray.zeros numpy._core.numeric.array2string numpy._core.numeric.dtype.__new__ numpy._core.numeric.flatiter.__array__ -numpy._core.numeric.from_dlpack numpy._core.numeric.frombuffer numpy._core.numeric.fromfile numpy._core.numeric.fromiter @@ -88,7 +84,6 @@ numpy.core._internal._ctypes.get_data numpy.core._internal._ctypes.get_shape numpy.core._internal._ctypes.get_strides numpy.core._multiarray_umath.flatiter.__array__ -numpy.core._multiarray_umath.from_dlpack numpy.core._multiarray_umath.frombuffer numpy.core._multiarray_umath.fromfile numpy.core._multiarray_umath.fromiter @@ -99,7 +94,6 @@ numpy.core.fromnumeric.reshape numpy.core.getlimits.finfo.smallest_normal numpy.core.multiarray.dtype.__new__ numpy.core.multiarray.flatiter.__array__ -numpy.core.multiarray.from_dlpack numpy.core.multiarray.frombuffer numpy.core.multiarray.fromfile numpy.core.multiarray.fromiter @@ -110,7 +104,6 @@ numpy.core.multiarray.zeros numpy.core.numeric.array2string numpy.core.numeric.dtype.__new__ numpy.core.numeric.flatiter.__array__ -numpy.core.numeric.from_dlpack numpy.core.numeric.frombuffer numpy.core.numeric.fromfile numpy.core.numeric.fromiter @@ -132,7 +125,6 @@ numpy.f2py._backends._meson.MesonTemplate.objects_substitution numpy.fft.helper numpy.finfo.smallest_normal numpy.flatiter.__array__ -numpy.from_dlpack numpy.frombuffer numpy.fromfile numpy.fromiter @@ -264,7 +256,6 @@ numpy.matlib.corrcoef numpy.matlib.dtype.__new__ numpy.matlib.finfo.smallest_normal numpy.matlib.flatiter.__array__ -numpy.matlib.from_dlpack numpy.matlib.frombuffer numpy.matlib.fromfile numpy.matlib.fromiter From e92cabbb60d27bcd4713d9c6dab14cfce4bd5682 Mon Sep 17 00:00:00 2001 From: jorenham Date: Tue, 23 Dec 2025 13:36:34 +0100 Subject: [PATCH 11/20] =?UTF-8?q?=F0=9F=91=BD=EF=B8=8F=20`np.frombuffer`:?= =?UTF-8?q?=20sync=20with=20upstream?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/numpy-stubs/_core/_multiarray_umath.pyi | 16 +++++++++++++--- tool/allowlists/todo.txt | 9 --------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/numpy-stubs/_core/_multiarray_umath.pyi b/src/numpy-stubs/_core/_multiarray_umath.pyi index 6848e584..344ea762 100644 --- a/src/numpy-stubs/_core/_multiarray_umath.pyi +++ b/src/numpy-stubs/_core/_multiarray_umath.pyi @@ -1353,15 +1353,25 @@ def fromiter( # @overload def frombuffer( - buffer: Buffer, *, count: CanIndex = -1, offset: CanIndex = 0, **kwargs: Unpack[_KwargsL] + buffer: Buffer, *, count: CanIndex = -1, offset: CanIndex = 0, like: _CanArrayFunc | None = None ) -> _nt.Array[np.float64]: ... @overload def frombuffer( - buffer: Buffer, dtype: _DTypeLike[_ScalarT], count: CanIndex = -1, offset: CanIndex = 0, **kwargs: Unpack[_KwargsL] + buffer: Buffer, + dtype: _DTypeLike[_ScalarT], + count: CanIndex = -1, + offset: CanIndex = 0, + *, + like: _CanArrayFunc | None = None, ) -> _nt.Array[_ScalarT]: ... @overload def frombuffer( - buffer: Buffer, dtype: npt.DTypeLike, count: CanIndex = -1, offset: CanIndex = 0, **kwargs: Unpack[_KwargsL] + buffer: Buffer, + dtype: npt.DTypeLike, + count: CanIndex = -1, + offset: CanIndex = 0, + *, + like: _CanArrayFunc | None = None, ) -> _nt.Array[Incomplete]: ... # diff --git a/tool/allowlists/todo.txt b/tool/allowlists/todo.txt index 95e8ee56..87de860c 100644 --- a/tool/allowlists/todo.txt +++ b/tool/allowlists/todo.txt @@ -13,7 +13,6 @@ numpy._core._methods.umr_minimum numpy._core._methods.umr_prod numpy._core._methods.umr_sum numpy._core._multiarray_umath.flatiter.__array__ -numpy._core._multiarray_umath.frombuffer numpy._core._multiarray_umath.fromfile numpy._core._multiarray_umath.fromiter numpy._core._multiarray_umath.zeros @@ -37,7 +36,6 @@ numpy._core.defchararray.chararray.argsort numpy._core.dtype.__new__ numpy._core.finfo.smallest_normal numpy._core.flatiter.__array__ -numpy._core.frombuffer numpy._core.fromfile numpy._core.fromiter numpy._core.fromnumeric.reshape @@ -45,7 +43,6 @@ numpy._core.getlimits.finfo.smallest_normal numpy._core.may_share_memory numpy._core.multiarray.dtype.__new__ numpy._core.multiarray.flatiter.__array__ -numpy._core.multiarray.frombuffer numpy._core.multiarray.fromfile numpy._core.multiarray.fromiter numpy._core.multiarray.may_share_memory @@ -55,7 +52,6 @@ numpy._core.multiarray.zeros numpy._core.numeric.array2string numpy._core.numeric.dtype.__new__ numpy._core.numeric.flatiter.__array__ -numpy._core.numeric.frombuffer numpy._core.numeric.fromfile numpy._core.numeric.fromiter numpy._core.numeric.may_share_memory @@ -84,7 +80,6 @@ numpy.core._internal._ctypes.get_data numpy.core._internal._ctypes.get_shape numpy.core._internal._ctypes.get_strides numpy.core._multiarray_umath.flatiter.__array__ -numpy.core._multiarray_umath.frombuffer numpy.core._multiarray_umath.fromfile numpy.core._multiarray_umath.fromiter numpy.core._multiarray_umath.zeros @@ -94,7 +89,6 @@ numpy.core.fromnumeric.reshape numpy.core.getlimits.finfo.smallest_normal numpy.core.multiarray.dtype.__new__ numpy.core.multiarray.flatiter.__array__ -numpy.core.multiarray.frombuffer numpy.core.multiarray.fromfile numpy.core.multiarray.fromiter numpy.core.multiarray.may_share_memory @@ -104,7 +98,6 @@ numpy.core.multiarray.zeros numpy.core.numeric.array2string numpy.core.numeric.dtype.__new__ numpy.core.numeric.flatiter.__array__ -numpy.core.numeric.frombuffer numpy.core.numeric.fromfile numpy.core.numeric.fromiter numpy.core.numeric.may_share_memory @@ -125,7 +118,6 @@ numpy.f2py._backends._meson.MesonTemplate.objects_substitution numpy.fft.helper numpy.finfo.smallest_normal numpy.flatiter.__array__ -numpy.frombuffer numpy.fromfile numpy.fromiter numpy.in1d @@ -256,7 +248,6 @@ numpy.matlib.corrcoef numpy.matlib.dtype.__new__ numpy.matlib.finfo.smallest_normal numpy.matlib.flatiter.__array__ -numpy.matlib.frombuffer numpy.matlib.fromfile numpy.matlib.fromiter numpy.matlib.in1d From 2093f32d74aa18963d32be2746272b949ffe3655 Mon Sep 17 00:00:00 2001 From: jorenham Date: Tue, 23 Dec 2025 13:40:02 +0100 Subject: [PATCH 12/20] =?UTF-8?q?=F0=9F=91=BD=EF=B8=8F=20`np.fromfile`:=20?= =?UTF-8?q?sync=20with=20upstream?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/numpy-stubs/_core/_multiarray_umath.pyi | 8 +++++--- tool/allowlists/todo.txt | 9 --------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/src/numpy-stubs/_core/_multiarray_umath.pyi b/src/numpy-stubs/_core/_multiarray_umath.pyi index 344ea762..c70b98c5 100644 --- a/src/numpy-stubs/_core/_multiarray_umath.pyi +++ b/src/numpy-stubs/_core/_multiarray_umath.pyi @@ -1319,7 +1319,7 @@ def fromstring( # @overload def fromfile( - file: _ToFile, *, count: CanIndex = -1, sep: str = "", offset: CanIndex = 0, **kwargs: Unpack[_KwargsL] + file: _ToFile, *, count: CanIndex = -1, sep: str = "", offset: CanIndex = 0, like: _CanArrayFunc | None = None ) -> _nt.Array[np.float64]: ... @overload def fromfile( @@ -1328,7 +1328,8 @@ def fromfile( count: CanIndex = -1, sep: str = "", offset: CanIndex = 0, - **kwargs: Unpack[_KwargsL], + *, + like: _CanArrayFunc | None = None, ) -> _nt.Array[_ScalarT]: ... @overload def fromfile( @@ -1337,7 +1338,8 @@ def fromfile( count: CanIndex = -1, sep: str = "", offset: CanIndex = 0, - **kwargs: Unpack[_KwargsL], + *, + like: _CanArrayFunc | None = None, ) -> _nt.Array[Incomplete]: ... # diff --git a/tool/allowlists/todo.txt b/tool/allowlists/todo.txt index 87de860c..f7db018f 100644 --- a/tool/allowlists/todo.txt +++ b/tool/allowlists/todo.txt @@ -13,7 +13,6 @@ numpy._core._methods.umr_minimum numpy._core._methods.umr_prod numpy._core._methods.umr_sum numpy._core._multiarray_umath.flatiter.__array__ -numpy._core._multiarray_umath.fromfile numpy._core._multiarray_umath.fromiter numpy._core._multiarray_umath.zeros numpy._core._type_aliases.abstract_type @@ -36,14 +35,12 @@ numpy._core.defchararray.chararray.argsort numpy._core.dtype.__new__ numpy._core.finfo.smallest_normal numpy._core.flatiter.__array__ -numpy._core.fromfile numpy._core.fromiter numpy._core.fromnumeric.reshape numpy._core.getlimits.finfo.smallest_normal numpy._core.may_share_memory numpy._core.multiarray.dtype.__new__ numpy._core.multiarray.flatiter.__array__ -numpy._core.multiarray.fromfile numpy._core.multiarray.fromiter numpy._core.multiarray.may_share_memory numpy._core.multiarray.shares_memory @@ -52,7 +49,6 @@ numpy._core.multiarray.zeros numpy._core.numeric.array2string numpy._core.numeric.dtype.__new__ numpy._core.numeric.flatiter.__array__ -numpy._core.numeric.fromfile numpy._core.numeric.fromiter numpy._core.numeric.may_share_memory numpy._core.numeric.object_.__new__ @@ -80,7 +76,6 @@ numpy.core._internal._ctypes.get_data numpy.core._internal._ctypes.get_shape numpy.core._internal._ctypes.get_strides numpy.core._multiarray_umath.flatiter.__array__ -numpy.core._multiarray_umath.fromfile numpy.core._multiarray_umath.fromiter numpy.core._multiarray_umath.zeros numpy.core.arrayprint.array2string @@ -89,7 +84,6 @@ numpy.core.fromnumeric.reshape numpy.core.getlimits.finfo.smallest_normal numpy.core.multiarray.dtype.__new__ numpy.core.multiarray.flatiter.__array__ -numpy.core.multiarray.fromfile numpy.core.multiarray.fromiter numpy.core.multiarray.may_share_memory numpy.core.multiarray.shares_memory @@ -98,7 +92,6 @@ numpy.core.multiarray.zeros numpy.core.numeric.array2string numpy.core.numeric.dtype.__new__ numpy.core.numeric.flatiter.__array__ -numpy.core.numeric.fromfile numpy.core.numeric.fromiter numpy.core.numeric.may_share_memory numpy.core.numeric.object_.__new__ @@ -118,7 +111,6 @@ numpy.f2py._backends._meson.MesonTemplate.objects_substitution numpy.fft.helper numpy.finfo.smallest_normal numpy.flatiter.__array__ -numpy.fromfile numpy.fromiter numpy.in1d numpy.lib._arraysetops_impl.__all__ @@ -248,7 +240,6 @@ numpy.matlib.corrcoef numpy.matlib.dtype.__new__ numpy.matlib.finfo.smallest_normal numpy.matlib.flatiter.__array__ -numpy.matlib.fromfile numpy.matlib.fromiter numpy.matlib.in1d numpy.matlib.may_share_memory From 32f226832d44507905b478d975fd649f0b22216a Mon Sep 17 00:00:00 2001 From: jorenham Date: Tue, 23 Dec 2025 13:41:23 +0100 Subject: [PATCH 13/20] =?UTF-8?q?=F0=9F=91=BD=EF=B8=8F=20`np.fromiter`:=20?= =?UTF-8?q?sync=20with=20upstream?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/numpy-stubs/_core/_multiarray_umath.pyi | 4 ++-- tool/allowlists/todo.txt | 9 --------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/src/numpy-stubs/_core/_multiarray_umath.pyi b/src/numpy-stubs/_core/_multiarray_umath.pyi index c70b98c5..c78466b8 100644 --- a/src/numpy-stubs/_core/_multiarray_umath.pyi +++ b/src/numpy-stubs/_core/_multiarray_umath.pyi @@ -1345,11 +1345,11 @@ def fromfile( # @overload def fromiter( - iter: Iterable[object], dtype: _DTypeLike[_ScalarT], count: CanIndex = -1, **kwargs: Unpack[_KwargsL] + iter: Iterable[object], dtype: _DTypeLike[_ScalarT], count: CanIndex = -1, *, like: _CanArrayFunc | None = None ) -> _nt.Array[_ScalarT]: ... @overload def fromiter( - iter: Iterable[object], dtype: npt.DTypeLike, count: CanIndex = -1, **kwargs: Unpack[_KwargsL] + iter: Iterable[object], dtype: npt.DTypeLike, count: CanIndex = -1, *, like: _CanArrayFunc | None = None ) -> _nt.Array[Incomplete]: ... # diff --git a/tool/allowlists/todo.txt b/tool/allowlists/todo.txt index f7db018f..acb8fc1e 100644 --- a/tool/allowlists/todo.txt +++ b/tool/allowlists/todo.txt @@ -13,7 +13,6 @@ numpy._core._methods.umr_minimum numpy._core._methods.umr_prod numpy._core._methods.umr_sum numpy._core._multiarray_umath.flatiter.__array__ -numpy._core._multiarray_umath.fromiter numpy._core._multiarray_umath.zeros numpy._core._type_aliases.abstract_type numpy._core._type_aliases.base_name @@ -35,13 +34,11 @@ numpy._core.defchararray.chararray.argsort numpy._core.dtype.__new__ numpy._core.finfo.smallest_normal numpy._core.flatiter.__array__ -numpy._core.fromiter numpy._core.fromnumeric.reshape numpy._core.getlimits.finfo.smallest_normal numpy._core.may_share_memory numpy._core.multiarray.dtype.__new__ numpy._core.multiarray.flatiter.__array__ -numpy._core.multiarray.fromiter numpy._core.multiarray.may_share_memory numpy._core.multiarray.shares_memory numpy._core.multiarray.where @@ -49,7 +46,6 @@ numpy._core.multiarray.zeros numpy._core.numeric.array2string numpy._core.numeric.dtype.__new__ numpy._core.numeric.flatiter.__array__ -numpy._core.numeric.fromiter numpy._core.numeric.may_share_memory numpy._core.numeric.object_.__new__ numpy._core.numeric.reshape @@ -76,7 +72,6 @@ numpy.core._internal._ctypes.get_data numpy.core._internal._ctypes.get_shape numpy.core._internal._ctypes.get_strides numpy.core._multiarray_umath.flatiter.__array__ -numpy.core._multiarray_umath.fromiter numpy.core._multiarray_umath.zeros numpy.core.arrayprint.array2string numpy.core.defchararray.chararray.argsort @@ -84,7 +79,6 @@ numpy.core.fromnumeric.reshape numpy.core.getlimits.finfo.smallest_normal numpy.core.multiarray.dtype.__new__ numpy.core.multiarray.flatiter.__array__ -numpy.core.multiarray.fromiter numpy.core.multiarray.may_share_memory numpy.core.multiarray.shares_memory numpy.core.multiarray.where @@ -92,7 +86,6 @@ numpy.core.multiarray.zeros numpy.core.numeric.array2string numpy.core.numeric.dtype.__new__ numpy.core.numeric.flatiter.__array__ -numpy.core.numeric.fromiter numpy.core.numeric.may_share_memory numpy.core.numeric.object_.__new__ numpy.core.numeric.reshape @@ -111,7 +104,6 @@ numpy.f2py._backends._meson.MesonTemplate.objects_substitution numpy.fft.helper numpy.finfo.smallest_normal numpy.flatiter.__array__ -numpy.fromiter numpy.in1d numpy.lib._arraysetops_impl.__all__ numpy.lib._arraysetops_impl.in1d @@ -240,7 +232,6 @@ numpy.matlib.corrcoef numpy.matlib.dtype.__new__ numpy.matlib.finfo.smallest_normal numpy.matlib.flatiter.__array__ -numpy.matlib.fromiter numpy.matlib.in1d numpy.matlib.may_share_memory numpy.matlib.nanpercentile From 4a14c4be6a79d89841557fb2186024cb2f195c8b Mon Sep 17 00:00:00 2001 From: jorenham Date: Tue, 23 Dec 2025 13:42:35 +0100 Subject: [PATCH 14/20] =?UTF-8?q?=F0=9F=91=BD=EF=B8=8F=20`np.may=5Fshare?= =?UTF-8?q?=5Fmemory`:=20sync=20with=20upstream?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/numpy-stubs/_core/_multiarray_umath.pyi | 2 +- tool/allowlists/todo.txt | 7 ------- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/src/numpy-stubs/_core/_multiarray_umath.pyi b/src/numpy-stubs/_core/_multiarray_umath.pyi index c78466b8..a6c723eb 100644 --- a/src/numpy-stubs/_core/_multiarray_umath.pyi +++ b/src/numpy-stubs/_core/_multiarray_umath.pyi @@ -1589,7 +1589,7 @@ def ravel_multi_index( # def shares_memory(a: object, b: object, /, max_work: L[0, 1] | None = None) -> bool: ... -def may_share_memory(a: object, b: object, /, max_work: L[0, 1] | None = None) -> bool: ... +def may_share_memory(a: object, b: object, /, max_work: L[0, 1] = 0) -> bool: ... def can_cast(from_: npt.ArrayLike | npt.DTypeLike, to: npt.DTypeLike, casting: _CastingKind = "safe") -> bool: ... # diff --git a/tool/allowlists/todo.txt b/tool/allowlists/todo.txt index acb8fc1e..07e1c1d5 100644 --- a/tool/allowlists/todo.txt +++ b/tool/allowlists/todo.txt @@ -36,17 +36,14 @@ numpy._core.finfo.smallest_normal numpy._core.flatiter.__array__ numpy._core.fromnumeric.reshape numpy._core.getlimits.finfo.smallest_normal -numpy._core.may_share_memory numpy._core.multiarray.dtype.__new__ numpy._core.multiarray.flatiter.__array__ -numpy._core.multiarray.may_share_memory numpy._core.multiarray.shares_memory numpy._core.multiarray.where numpy._core.multiarray.zeros numpy._core.numeric.array2string numpy._core.numeric.dtype.__new__ numpy._core.numeric.flatiter.__array__ -numpy._core.numeric.may_share_memory numpy._core.numeric.object_.__new__ numpy._core.numeric.reshape numpy._core.numeric.shares_memory @@ -79,14 +76,12 @@ numpy.core.fromnumeric.reshape numpy.core.getlimits.finfo.smallest_normal numpy.core.multiarray.dtype.__new__ numpy.core.multiarray.flatiter.__array__ -numpy.core.multiarray.may_share_memory numpy.core.multiarray.shares_memory numpy.core.multiarray.where numpy.core.multiarray.zeros numpy.core.numeric.array2string numpy.core.numeric.dtype.__new__ numpy.core.numeric.flatiter.__array__ -numpy.core.numeric.may_share_memory numpy.core.numeric.object_.__new__ numpy.core.numeric.reshape numpy.core.numeric.shares_memory @@ -233,7 +228,6 @@ numpy.matlib.dtype.__new__ numpy.matlib.finfo.smallest_normal numpy.matlib.flatiter.__array__ numpy.matlib.in1d -numpy.matlib.may_share_memory numpy.matlib.nanpercentile numpy.matlib.ndindex.ndincr numpy.matlib.object_.__new__ @@ -245,7 +239,6 @@ numpy.matlib.trapz numpy.matlib.ufunc.__signature__ numpy.matlib.void.__new__ numpy.matlib.where -numpy.may_share_memory numpy.nanpercentile numpy.ndindex.ndincr numpy.object_.__new__ From 4b3e2ad0acdf1657cdd7492bbb578b17ca013735 Mon Sep 17 00:00:00 2001 From: jorenham Date: Tue, 23 Dec 2025 13:44:01 +0100 Subject: [PATCH 15/20] =?UTF-8?q?=F0=9F=91=BD=EF=B8=8F=20`np.shares=5Fmemo?= =?UTF-8?q?ry`:=20sync=20with=20upstream?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/numpy-stubs/_core/_multiarray_umath.pyi | 6 +++--- tool/allowlists/todo.txt | 7 ------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/src/numpy-stubs/_core/_multiarray_umath.pyi b/src/numpy-stubs/_core/_multiarray_umath.pyi index a6c723eb..0c95c07f 100644 --- a/src/numpy-stubs/_core/_multiarray_umath.pyi +++ b/src/numpy-stubs/_core/_multiarray_umath.pyi @@ -1588,11 +1588,11 @@ def ravel_multi_index( ### # -def shares_memory(a: object, b: object, /, max_work: L[0, 1] | None = None) -> bool: ... -def may_share_memory(a: object, b: object, /, max_work: L[0, 1] = 0) -> bool: ... -def can_cast(from_: npt.ArrayLike | npt.DTypeLike, to: npt.DTypeLike, casting: _CastingKind = "safe") -> bool: ... +def shares_memory(a: object, b: object, /, max_work: L[0, -1] = -1) -> bool: ... +def may_share_memory(a: object, b: object, /, max_work: L[0, -1] = 0) -> bool: ... # +def can_cast(from_: npt.ArrayLike | npt.DTypeLike, to: npt.DTypeLike, casting: _CastingKind = "safe") -> bool: ... def min_scalar_type(a: npt.ArrayLike, /) -> np.dtype[Incomplete]: ... def result_type(*arrays_and_dtypes: npt.ArrayLike | npt.DTypeLike) -> np.dtype[Incomplete]: ... def promote_types(type1: npt.DTypeLike, type2: npt.DTypeLike, /) -> np.dtype[Incomplete]: ... diff --git a/tool/allowlists/todo.txt b/tool/allowlists/todo.txt index 07e1c1d5..7f6bd2a4 100644 --- a/tool/allowlists/todo.txt +++ b/tool/allowlists/todo.txt @@ -38,7 +38,6 @@ numpy._core.fromnumeric.reshape numpy._core.getlimits.finfo.smallest_normal numpy._core.multiarray.dtype.__new__ numpy._core.multiarray.flatiter.__array__ -numpy._core.multiarray.shares_memory numpy._core.multiarray.where numpy._core.multiarray.zeros numpy._core.numeric.array2string @@ -46,7 +45,6 @@ numpy._core.numeric.dtype.__new__ numpy._core.numeric.flatiter.__array__ numpy._core.numeric.object_.__new__ numpy._core.numeric.reshape -numpy._core.numeric.shares_memory numpy._core.numeric.ufunc.__signature__ numpy._core.numeric.void.__new__ numpy._core.numeric.where @@ -55,7 +53,6 @@ numpy._core.numerictypes.object_.__new__ numpy._core.numerictypes.void.__new__ numpy._core.object_.__new__ numpy._core.reshape -numpy._core.shares_memory numpy._core.strings.slice numpy._core.ufunc.__signature__ numpy._core.umath.__all__ @@ -76,7 +73,6 @@ numpy.core.fromnumeric.reshape numpy.core.getlimits.finfo.smallest_normal numpy.core.multiarray.dtype.__new__ numpy.core.multiarray.flatiter.__array__ -numpy.core.multiarray.shares_memory numpy.core.multiarray.where numpy.core.multiarray.zeros numpy.core.numeric.array2string @@ -84,7 +80,6 @@ numpy.core.numeric.dtype.__new__ numpy.core.numeric.flatiter.__array__ numpy.core.numeric.object_.__new__ numpy.core.numeric.reshape -numpy.core.numeric.shares_memory numpy.core.numeric.ufunc.__signature__ numpy.core.numeric.void.__new__ numpy.core.numeric.where @@ -234,7 +229,6 @@ numpy.matlib.object_.__new__ numpy.matlib.percentile numpy.matlib.reshape numpy.matlib.save -numpy.matlib.shares_memory numpy.matlib.trapz numpy.matlib.ufunc.__signature__ numpy.matlib.void.__new__ @@ -245,7 +239,6 @@ numpy.object_.__new__ numpy.percentile numpy.reshape numpy.save -numpy.shares_memory numpy.strings.slice numpy.trapz numpy.ufunc.__signature__ From 8b8a1c001ec2e52fa45279f9b3e5dd764ab4a52c Mon Sep 17 00:00:00 2001 From: jorenham Date: Tue, 23 Dec 2025 13:45:56 +0100 Subject: [PATCH 16/20] =?UTF-8?q?=F0=9F=91=BD=EF=B8=8F=20`np.where`:=20syn?= =?UTF-8?q?c=20with=20upstream?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/numpy-stubs/_core/_multiarray_umath.pyi | 2 +- tool/allowlists/todo.txt | 7 ------- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/src/numpy-stubs/_core/_multiarray_umath.pyi b/src/numpy-stubs/_core/_multiarray_umath.pyi index 0c95c07f..a312e70b 100644 --- a/src/numpy-stubs/_core/_multiarray_umath.pyi +++ b/src/numpy-stubs/_core/_multiarray_umath.pyi @@ -1552,7 +1552,7 @@ def copyto(dst: _nt.Array, src: npt.ArrayLike, casting: _CastingKind = "same_kin # @overload -def where(condition: npt.ArrayLike, /) -> tuple[_nt.Array[np.intp], ...]: ... +def where(condition: npt.ArrayLike, x: None = None, y: None = None, /) -> tuple[_nt.Array[np.intp], ...]: ... @overload def where(condition: npt.ArrayLike, x: _ArrayLike[_ScalarT], y: _ArrayLike[_ScalarT], /) -> _nt.Array[_ScalarT]: ... @overload diff --git a/tool/allowlists/todo.txt b/tool/allowlists/todo.txt index 7f6bd2a4..1bad41c0 100644 --- a/tool/allowlists/todo.txt +++ b/tool/allowlists/todo.txt @@ -38,7 +38,6 @@ numpy._core.fromnumeric.reshape numpy._core.getlimits.finfo.smallest_normal numpy._core.multiarray.dtype.__new__ numpy._core.multiarray.flatiter.__array__ -numpy._core.multiarray.where numpy._core.multiarray.zeros numpy._core.numeric.array2string numpy._core.numeric.dtype.__new__ @@ -47,7 +46,6 @@ numpy._core.numeric.object_.__new__ numpy._core.numeric.reshape numpy._core.numeric.ufunc.__signature__ numpy._core.numeric.void.__new__ -numpy._core.numeric.where numpy._core.numeric.zeros numpy._core.numerictypes.object_.__new__ numpy._core.numerictypes.void.__new__ @@ -57,7 +55,6 @@ numpy._core.strings.slice numpy._core.ufunc.__signature__ numpy._core.umath.__all__ numpy._core.void.__new__ -numpy._core.where numpy._core.zeros numpy.array2string numpy.char.chararray.argsort @@ -73,7 +70,6 @@ numpy.core.fromnumeric.reshape numpy.core.getlimits.finfo.smallest_normal numpy.core.multiarray.dtype.__new__ numpy.core.multiarray.flatiter.__array__ -numpy.core.multiarray.where numpy.core.multiarray.zeros numpy.core.numeric.array2string numpy.core.numeric.dtype.__new__ @@ -82,7 +78,6 @@ numpy.core.numeric.object_.__new__ numpy.core.numeric.reshape numpy.core.numeric.ufunc.__signature__ numpy.core.numeric.void.__new__ -numpy.core.numeric.where numpy.core.numeric.zeros numpy.core.numerictypes.object_.__new__ numpy.core.numerictypes.void.__new__ @@ -232,7 +227,6 @@ numpy.matlib.save numpy.matlib.trapz numpy.matlib.ufunc.__signature__ numpy.matlib.void.__new__ -numpy.matlib.where numpy.nanpercentile numpy.ndindex.ndincr numpy.object_.__new__ @@ -243,5 +237,4 @@ numpy.strings.slice numpy.trapz numpy.ufunc.__signature__ numpy.void.__new__ -numpy.where numpy.zeros From 94f32df6c665bdd844ee3e7ed85e961ddf913350 Mon Sep 17 00:00:00 2001 From: jorenham Date: Tue, 23 Dec 2025 13:48:37 +0100 Subject: [PATCH 17/20] =?UTF-8?q?=F0=9F=91=BD=EF=B8=8F=20`np.zeros`:=20syn?= =?UTF-8?q?c=20with=20upstream?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/numpy-stubs/_core/_multiarray_umath.pyi | 89 +++++++++++++++++---- tool/allowlists/todo.txt | 8 -- 2 files changed, 72 insertions(+), 25 deletions(-) diff --git a/src/numpy-stubs/_core/_multiarray_umath.pyi b/src/numpy-stubs/_core/_multiarray_umath.pyi index a312e70b..b9406499 100644 --- a/src/numpy-stubs/_core/_multiarray_umath.pyi +++ b/src/numpy-stubs/_core/_multiarray_umath.pyi @@ -181,11 +181,6 @@ class _HasDoc(Protocol): class _KwargsL(TypedDict, total=False): like: _CanArrayFunc | None -@type_check_only -class _KwargsDL(TypedDict, total=False): - device: _Device | None - like: _CanArrayFunc | None - @type_check_only class _ExtObjDict(TypedDict): divide: _ExtObjValue @@ -607,51 +602,111 @@ def empty( # NOTE: Keep in sync with `empty` (below) and `numpy._core.numeric.ones` @overload # 1d shape, default dtype (float64) def zeros( - shape: _ShapeLike1D, dtype: _nt.ToDTypeFloat64 = ..., order: _OrderCF = "C", **kwargs: Unpack[_KwargsDL] + shape: _ShapeLike1D, + dtype: _nt.ToDTypeFloat64 = ..., + order: _OrderCF = "C", + *, + device: _Device | None = None, + like: _CanArrayFunc | None = None, ) -> _nt.Array1D[np.float64]: ... @overload # 1d shape, known dtype def zeros( - shape: _ShapeLike1D, dtype: _DTypeT | _HasDType[_DTypeT], order: _OrderCF = "C", **kwargs: Unpack[_KwargsDL] + shape: _ShapeLike1D, + dtype: _DTypeT | _HasDType[_DTypeT], + order: _OrderCF = "C", + *, + device: _Device | None = None, + like: _CanArrayFunc | None = None, ) -> np.ndarray[_nt.Rank1, _DTypeT]: ... @overload # 1d shape, known scalar-type def zeros( - shape: _ShapeLike1D, dtype: _DTypeLike[_ScalarT], order: _OrderCF = "C", **kwargs: Unpack[_KwargsDL] + shape: _ShapeLike1D, + dtype: _DTypeLike[_ScalarT], + order: _OrderCF = "C", + *, + device: _Device | None = None, + like: _CanArrayFunc | None = None, ) -> _nt.Array1D[_ScalarT]: ... @overload # 1d shape, unknown dtype def zeros( - shape: _ShapeLike1D, dtype: npt.DTypeLike = ..., order: _OrderCF = "C", **kwargs: Unpack[_KwargsDL] + shape: _ShapeLike1D, + dtype: npt.DTypeLike = ..., + order: _OrderCF = "C", + *, + device: _Device | None = None, + like: _CanArrayFunc | None = None, ) -> _nt.Array1D[Incomplete]: ... @overload # known shape, default dtype (float64) def zeros( - shape: _AnyShapeT, dtype: _nt.ToDTypeFloat64 = ..., order: _OrderCF = "C", **kwargs: Unpack[_KwargsDL] + shape: _AnyShapeT, + dtype: _nt.ToDTypeFloat64 = ..., + order: _OrderCF = "C", + *, + device: _Device | None = None, + like: _CanArrayFunc | None = None, ) -> _nt.Array[np.float64, _AnyShapeT]: ... @overload # known shape, known dtype (mypy reports a false positive) def zeros( # type: ignore[overload-overlap] - shape: _AnyShapeT, dtype: _DTypeT | _HasDType[_DTypeT], order: _OrderCF = "C", **kwargs: Unpack[_KwargsDL] + shape: _AnyShapeT, + dtype: _DTypeT | _HasDType[_DTypeT], + order: _OrderCF = "C", + *, + device: _Device | None = None, + like: _CanArrayFunc | None = None, ) -> np.ndarray[_AnyShapeT, _DTypeT]: ... @overload # known shape, known scalar-type def zeros( - shape: _AnyShapeT, dtype: _DTypeLike[_ScalarT], order: _OrderCF = "C", **kwargs: Unpack[_KwargsDL] + shape: _AnyShapeT, + dtype: _DTypeLike[_ScalarT], + order: _OrderCF = "C", + *, + device: _Device | None = None, + like: _CanArrayFunc | None = None, ) -> _nt.Array[_ScalarT, _AnyShapeT]: ... @overload # known shape, unknown scalar-type def zeros( - shape: _AnyShapeT, dtype: npt.DTypeLike = ..., order: _OrderCF = "C", **kwargs: Unpack[_KwargsDL] + shape: _AnyShapeT, + dtype: npt.DTypeLike = ..., + order: _OrderCF = "C", + *, + device: _Device | None = None, + like: _CanArrayFunc | None = None, ) -> _nt.Array[Incomplete, _AnyShapeT]: ... @overload # unknown shape, default dtype def zeros( - shape: _ShapeLike, dtype: _nt.ToDTypeFloat64 = ..., order: _OrderCF = "C", **kwargs: Unpack[_KwargsDL] + shape: _ShapeLike, + dtype: _nt.ToDTypeFloat64 = ..., + order: _OrderCF = "C", + *, + device: _Device | None = None, + like: _CanArrayFunc | None = None, ) -> _nt.Array[np.float64]: ... @overload # unknown shape, known dtype def zeros( - shape: _ShapeLike, dtype: _DTypeT | _HasDType[_DTypeT], order: _OrderCF = "C", **kwargs: Unpack[_KwargsDL] + shape: _ShapeLike, + dtype: _DTypeT | _HasDType[_DTypeT], + order: _OrderCF = "C", + *, + device: _Device | None = None, + like: _CanArrayFunc | None = None, ) -> np.ndarray[Incomplete, _DTypeT]: ... @overload # unknown shape, known scalar-type def zeros( - shape: _ShapeLike, dtype: _DTypeLike[_ScalarT], order: _OrderCF = "C", **kwargs: Unpack[_KwargsDL] + shape: _ShapeLike, + dtype: _DTypeLike[_ScalarT], + order: _OrderCF = "C", + *, + device: _Device | None = None, + like: _CanArrayFunc | None = None, ) -> _nt.Array[_ScalarT]: ... @overload # unknown shape, unknown dtype def zeros( - shape: _ShapeLike, dtype: npt.DTypeLike = ..., order: _OrderCF = "C", **kwargs: Unpack[_KwargsDL] + shape: _ShapeLike, + dtype: npt.DTypeLike = ..., + order: _OrderCF = "C", + *, + device: _Device | None = None, + like: _CanArrayFunc | None = None, ) -> _nt.Array[Incomplete]: ... # NOTE: Keep in sync with `.numeric.{zeros,ones}_like` (all 30 overloads...) diff --git a/tool/allowlists/todo.txt b/tool/allowlists/todo.txt index 1bad41c0..362909b1 100644 --- a/tool/allowlists/todo.txt +++ b/tool/allowlists/todo.txt @@ -13,7 +13,6 @@ numpy._core._methods.umr_minimum numpy._core._methods.umr_prod numpy._core._methods.umr_sum numpy._core._multiarray_umath.flatiter.__array__ -numpy._core._multiarray_umath.zeros numpy._core._type_aliases.abstract_type numpy._core._type_aliases.base_name numpy._core._type_aliases.bits @@ -38,7 +37,6 @@ numpy._core.fromnumeric.reshape numpy._core.getlimits.finfo.smallest_normal numpy._core.multiarray.dtype.__new__ numpy._core.multiarray.flatiter.__array__ -numpy._core.multiarray.zeros numpy._core.numeric.array2string numpy._core.numeric.dtype.__new__ numpy._core.numeric.flatiter.__array__ @@ -46,7 +44,6 @@ numpy._core.numeric.object_.__new__ numpy._core.numeric.reshape numpy._core.numeric.ufunc.__signature__ numpy._core.numeric.void.__new__ -numpy._core.numeric.zeros numpy._core.numerictypes.object_.__new__ numpy._core.numerictypes.void.__new__ numpy._core.object_.__new__ @@ -55,7 +52,6 @@ numpy._core.strings.slice numpy._core.ufunc.__signature__ numpy._core.umath.__all__ numpy._core.void.__new__ -numpy._core.zeros numpy.array2string numpy.char.chararray.argsort numpy.core._internal._ctypes.get_as_parameter @@ -63,14 +59,12 @@ numpy.core._internal._ctypes.get_data numpy.core._internal._ctypes.get_shape numpy.core._internal._ctypes.get_strides numpy.core._multiarray_umath.flatiter.__array__ -numpy.core._multiarray_umath.zeros numpy.core.arrayprint.array2string numpy.core.defchararray.chararray.argsort numpy.core.fromnumeric.reshape numpy.core.getlimits.finfo.smallest_normal numpy.core.multiarray.dtype.__new__ numpy.core.multiarray.flatiter.__array__ -numpy.core.multiarray.zeros numpy.core.numeric.array2string numpy.core.numeric.dtype.__new__ numpy.core.numeric.flatiter.__array__ @@ -78,7 +72,6 @@ numpy.core.numeric.object_.__new__ numpy.core.numeric.reshape numpy.core.numeric.ufunc.__signature__ numpy.core.numeric.void.__new__ -numpy.core.numeric.zeros numpy.core.numerictypes.object_.__new__ numpy.core.numerictypes.void.__new__ numpy.core.umath.__all__ @@ -237,4 +230,3 @@ numpy.strings.slice numpy.trapz numpy.ufunc.__signature__ numpy.void.__new__ -numpy.zeros From f3f75d67fe49289a19af39b2fc63bd6d2f74b275 Mon Sep 17 00:00:00 2001 From: jorenham Date: Tue, 23 Dec 2025 13:50:27 +0100 Subject: [PATCH 18/20] =?UTF-8?q?=F0=9F=91=BD=EF=B8=8F=20`np.fromstring`:?= =?UTF-8?q?=20sync=20with=20upstream?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/numpy-stubs/_core/_multiarray_umath.pyi | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/numpy-stubs/_core/_multiarray_umath.pyi b/src/numpy-stubs/_core/_multiarray_umath.pyi index b9406499..00e06f6b 100644 --- a/src/numpy-stubs/_core/_multiarray_umath.pyi +++ b/src/numpy-stubs/_core/_multiarray_umath.pyi @@ -21,7 +21,7 @@ from typing import ( overload, type_check_only, ) -from typing_extensions import Buffer, CapsuleType, TypeAliasType, TypeVar, Unpack, deprecated +from typing_extensions import Buffer, CapsuleType, TypeAliasType, TypeVar, deprecated import _numtype as _nt import numpy as np @@ -177,10 +177,6 @@ class _HasDoc(Protocol): ### -@type_check_only -class _KwargsL(TypedDict, total=False): - like: _CanArrayFunc | None - @type_check_only class _ExtObjDict(TypedDict): divide: _ExtObjValue @@ -1356,11 +1352,16 @@ def fromstring( count: CanIndex = -1, *, sep: str, - **kwargs: Unpack[_KwargsL], + like: _CanArrayFunc | None = None, ) -> _nt.Array[np.float64]: ... @overload def fromstring( - string: bytes | str, dtype: _DTypeLike[_ScalarT], count: CanIndex = -1, *, sep: str, **kwargs: Unpack[_KwargsL] + string: bytes | str, + dtype: _DTypeLike[_ScalarT], + count: CanIndex = -1, + *, + sep: str, + like: _CanArrayFunc | None = None, ) -> _nt.Array[_ScalarT]: ... @overload def fromstring( @@ -1368,7 +1369,7 @@ def fromstring( ) -> _nt.Array[_ScalarT]: ... @overload def fromstring( - string: bytes | str, dtype: npt.DTypeLike, count: CanIndex = -1, *, sep: str, **kwargs: Unpack[_KwargsL] + string: bytes | str, dtype: npt.DTypeLike, count: CanIndex = -1, *, sep: str, like: _CanArrayFunc | None = None ) -> _nt.Array[Incomplete]: ... # From 21673e6bf37b47791bd71b950e7b32825c074c04 Mon Sep 17 00:00:00 2001 From: jorenham Date: Tue, 23 Dec 2025 13:53:39 +0100 Subject: [PATCH 19/20] =?UTF-8?q?=F0=9F=91=BD=EF=B8=8F=20`np.flatiter.=5F?= =?UTF-8?q?=5Farray=5F=5F`:=20sync=20with=20upstream?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/numpy-stubs/_core/_multiarray_umath.pyi | 8 +++++--- tool/allowlists/todo.txt | 9 --------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/src/numpy-stubs/_core/_multiarray_umath.pyi b/src/numpy-stubs/_core/_multiarray_umath.pyi index 00e06f6b..78c2a6c4 100644 --- a/src/numpy-stubs/_core/_multiarray_umath.pyi +++ b/src/numpy-stubs/_core/_multiarray_umath.pyi @@ -340,11 +340,13 @@ class flatiter(Generic[_ArrayT_co]): # @overload - def __array__(self: flatiter[_nt.Array[_ScalarT]], dtype: None = None, /) -> _nt.Array1D[_ScalarT]: ... + def __array__( + self: flatiter[_nt.Array[_ScalarT]], dtype: None = None, /, *, copy: None = None + ) -> _nt.Array1D[_ScalarT]: ... @overload - def __array__(self, dtype: _DTypeLike[_ScalarT], /) -> _nt.Array1D[_ScalarT]: ... + def __array__(self, dtype: _DTypeLike[_ScalarT], /, *, copy: None = None) -> _nt.Array1D[_ScalarT]: ... @overload - def __array__(self, dtype: npt.DTypeLike | None = None, /) -> _nt.Array1D[Incomplete]: ... + def __array__(self, dtype: npt.DTypeLike | None = None, /, *, copy: None = None) -> _nt.Array1D[Incomplete]: ... @final class nditer: diff --git a/tool/allowlists/todo.txt b/tool/allowlists/todo.txt index 362909b1..98660e00 100644 --- a/tool/allowlists/todo.txt +++ b/tool/allowlists/todo.txt @@ -12,7 +12,6 @@ numpy._core._methods.umr_maximum numpy._core._methods.umr_minimum numpy._core._methods.umr_prod numpy._core._methods.umr_sum -numpy._core._multiarray_umath.flatiter.__array__ numpy._core._type_aliases.abstract_type numpy._core._type_aliases.base_name numpy._core._type_aliases.bits @@ -32,14 +31,11 @@ numpy._core.arrayprint.array2string numpy._core.defchararray.chararray.argsort numpy._core.dtype.__new__ numpy._core.finfo.smallest_normal -numpy._core.flatiter.__array__ numpy._core.fromnumeric.reshape numpy._core.getlimits.finfo.smallest_normal numpy._core.multiarray.dtype.__new__ -numpy._core.multiarray.flatiter.__array__ numpy._core.numeric.array2string numpy._core.numeric.dtype.__new__ -numpy._core.numeric.flatiter.__array__ numpy._core.numeric.object_.__new__ numpy._core.numeric.reshape numpy._core.numeric.ufunc.__signature__ @@ -58,16 +54,13 @@ numpy.core._internal._ctypes.get_as_parameter numpy.core._internal._ctypes.get_data numpy.core._internal._ctypes.get_shape numpy.core._internal._ctypes.get_strides -numpy.core._multiarray_umath.flatiter.__array__ numpy.core.arrayprint.array2string numpy.core.defchararray.chararray.argsort numpy.core.fromnumeric.reshape numpy.core.getlimits.finfo.smallest_normal numpy.core.multiarray.dtype.__new__ -numpy.core.multiarray.flatiter.__array__ numpy.core.numeric.array2string numpy.core.numeric.dtype.__new__ -numpy.core.numeric.flatiter.__array__ numpy.core.numeric.object_.__new__ numpy.core.numeric.reshape numpy.core.numeric.ufunc.__signature__ @@ -81,7 +74,6 @@ numpy.dtype.__new__ numpy.f2py._backends._meson.MesonTemplate.objects_substitution numpy.fft.helper numpy.finfo.smallest_normal -numpy.flatiter.__array__ numpy.in1d numpy.lib._arraysetops_impl.__all__ numpy.lib._arraysetops_impl.in1d @@ -209,7 +201,6 @@ numpy.matlib.array2string numpy.matlib.corrcoef numpy.matlib.dtype.__new__ numpy.matlib.finfo.smallest_normal -numpy.matlib.flatiter.__array__ numpy.matlib.in1d numpy.matlib.nanpercentile numpy.matlib.ndindex.ndincr From 37e0c2ed222bad47391feeadaa77c05dfa707ac0 Mon Sep 17 00:00:00 2001 From: jorenham Date: Tue, 23 Dec 2025 14:02:19 +0100 Subject: [PATCH 20/20] =?UTF-8?q?=E2=9C=85=20update=20type-tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/numpy-stubs/@test/runtime/legacy/multiarray.py | 4 ++-- .../@test/static/accept/array_constructors.pyi | 14 +++++++------- src/numpy-stubs/@test/static/accept/multiarray.pyi | 4 ++-- src/numpy-stubs/@test/static/reject/multiarray.pyi | 4 +--- 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/src/numpy-stubs/@test/runtime/legacy/multiarray.py b/src/numpy-stubs/@test/runtime/legacy/multiarray.py index 26cedfd7..eefb8c0e 100644 --- a/src/numpy-stubs/@test/runtime/legacy/multiarray.py +++ b/src/numpy-stubs/@test/runtime/legacy/multiarray.py @@ -70,7 +70,7 @@ np.unpackbits(AR_u1) np.shares_memory(1, 2) -np.shares_memory(AR_f8, AR_f8, max_work=1) +np.shares_memory(AR_f8, AR_f8, max_work=-1) np.may_share_memory(1, 2) -np.may_share_memory(AR_f8, AR_f8, max_work=1) +np.may_share_memory(AR_f8, AR_f8, max_work=-1) diff --git a/src/numpy-stubs/@test/static/accept/array_constructors.pyi b/src/numpy-stubs/@test/static/accept/array_constructors.pyi index 889d12e7..da95966d 100644 --- a/src/numpy-stubs/@test/static/accept/array_constructors.pyi +++ b/src/numpy-stubs/@test/static/accept/array_constructors.pyi @@ -102,15 +102,15 @@ assert_type(np.frombuffer(A, dtype="c16"), _nt.Array) assert_type(np.arange(False, True), _nt.Array1D[np.int_]) assert_type(np.arange(10), _nt.Array1D[np.int_]) assert_type(np.arange(0, 10, step=2), _nt.Array1D[np.int_]) -assert_type(np.arange(10.0), _nt.Array1D[np.float64]) -assert_type(np.arange(start=0, stop=10.0), _nt.Array1D[np.float64]) -assert_type(np.arange(np.timedelta64(0)), _nt.Array1D[np.timedelta64]) -assert_type(np.arange(0, np.timedelta64(10)), _nt.Array1D[np.timedelta64]) -assert_type(np.arange(np.datetime64("0"), np.datetime64("10")), _nt.Array1D[np.datetime64]) -assert_type(np.arange(10, dtype=np.float64), _nt.Array1D[np.float64]) +assert_type(np.arange(10.0), _nt.Array1D[np.float64 | Any]) +assert_type(np.arange(0, stop=10.0), _nt.Array1D[np.float64 | Any]) +assert_type(np.arange(np.timedelta64(0)), _nt.Array1D[np.timedelta64[Any]]) +assert_type(np.arange(0, np.timedelta64(10)), _nt.Array1D[np.timedelta64[Any]]) +assert_type(np.arange(np.datetime64("0"), np.datetime64("10")), _nt.Array1D[np.datetime64[Any]]) +assert_type(np.arange(10, dtype=np.float64), _nt.Array1D[np.float64 | Any]) assert_type(np.arange(0, 10, step=2, dtype=np.int16), _nt.Array1D[np.int16]) assert_type(np.arange(10, dtype=int), _nt.Array1D[np.int_]) -assert_type(np.arange(0, 10, dtype="f8"), _nt.Array1D[np.float64]) +assert_type(np.arange(0, 10, dtype="f8"), _nt.Array1D[Any]) assert_type(np.require(A), _nt.Array[np.float64]) assert_type(np.require(B), MyArray[np.float64]) diff --git a/src/numpy-stubs/@test/static/accept/multiarray.pyi b/src/numpy-stubs/@test/static/accept/multiarray.pyi index 5ecf7b0e..d2c5db78 100644 --- a/src/numpy-stubs/@test/static/accept/multiarray.pyi +++ b/src/numpy-stubs/@test/static/accept/multiarray.pyi @@ -101,10 +101,10 @@ assert_type(np.packbits(AR_u1), _nt.Array[np.uint8]) assert_type(np.unpackbits(AR_u1), _nt.Array[np.uint8]) assert_type(np.shares_memory(1, 2), bool) -assert_type(np.shares_memory(AR_f8, AR_f8, max_work=1), bool) +assert_type(np.shares_memory(AR_f8, AR_f8, max_work=-1), bool) assert_type(np.may_share_memory(1, 2), bool) -assert_type(np.may_share_memory(AR_f8, AR_f8, max_work=1), bool) +assert_type(np.may_share_memory(AR_f8, AR_f8, max_work=-1), bool) assert_type(np.promote_types(np.int32, np.int64), np.dtype) assert_type(np.promote_types("f4", float), np.dtype) diff --git a/src/numpy-stubs/@test/static/reject/multiarray.pyi b/src/numpy-stubs/@test/static/reject/multiarray.pyi index 9cdd390d..6a6213e7 100644 --- a/src/numpy-stubs/@test/static/reject/multiarray.pyi +++ b/src/numpy-stubs/@test/static/reject/multiarray.pyi @@ -16,7 +16,7 @@ def func(a: int) -> None: ... ### -np.where(AR_b, 1) # type: ignore[call-overload] # pyright: ignore[reportCallIssue] +np.where(AR_b, 1) # type: ignore[call-overload] # pyright: ignore[reportArgumentType] np.can_cast(AR_f8, 1) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] @@ -35,8 +35,6 @@ np.unpackbits(AR_u1, bitorder=">") # type: ignore[arg-type] # pyright: ignore[ np.shares_memory(1, 1, max_work=i8) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] np.may_share_memory(1, 1, max_work=i8) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] -np.arange(M) # type: ignore[call-overload] # pyright: ignore[reportArgumentType, reportCallIssue] - np.datetime_data(int) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] np.datetime_as_string("2012") # type: ignore[call-overload] # pyright: ignore[reportArgumentType, reportCallIssue]