From a943791da8ac6e463c586836c7175cf1d7cf0114 Mon Sep 17 00:00:00 2001 From: jorenham Date: Wed, 24 Dec 2025 12:19:34 +0100 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=91=BD=EF=B8=8F=20`fix`=20pending=20d?= =?UTF-8?q?eprecation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/numpy-stubs/lib/_ufunclike_impl.pyi | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/numpy-stubs/lib/_ufunclike_impl.pyi b/src/numpy-stubs/lib/_ufunclike_impl.pyi index 5a3018f8..2a4ffc9a 100644 --- a/src/numpy-stubs/lib/_ufunclike_impl.pyi +++ b/src/numpy-stubs/lib/_ufunclike_impl.pyi @@ -1,5 +1,5 @@ from typing import overload -from typing_extensions import TypeVar +from typing_extensions import TypeVar, deprecated import _numtype as _nt import numpy as np @@ -16,30 +16,43 @@ _RealT = TypeVar("_RealT", bound=np.integer | np.floating | np.object_) # @overload +@deprecated("np.fix will be deprecated in NumPy 2.5 in favor of np.trunc", category=PendingDeprecationWarning) def fix(x: _nt.Array[_RealT, _ShapeT], out: None = None) -> _nt.Array[_RealT, _ShapeT]: ... @overload +@deprecated("np.fix will be deprecated in NumPy 2.5 in favor of np.trunc", category=PendingDeprecationWarning) def fix(x: _nt.ToBool_0d, out: None = None) -> np.bool: ... @overload +@deprecated("np.fix will be deprecated in NumPy 2.5 in favor of np.trunc", category=PendingDeprecationWarning) def fix(x: _nt.ToInt_0d, out: None = None) -> np.intp: ... @overload +@deprecated("np.fix will be deprecated in NumPy 2.5 in favor of np.trunc", category=PendingDeprecationWarning) def fix(x: _nt.ToFloat64_0d, out: None = None) -> np.float64: ... @overload +@deprecated("np.fix will be deprecated in NumPy 2.5 in favor of np.trunc", category=PendingDeprecationWarning) def fix(x: _nt.CanArray0D[_RealT], out: None = None) -> _RealT: ... @overload +@deprecated("np.fix will be deprecated in NumPy 2.5 in favor of np.trunc", category=PendingDeprecationWarning) def fix(x: _nt.ToBool_1nd, out: None = None) -> _nt.Array[np.bool]: ... @overload +@deprecated("np.fix will be deprecated in NumPy 2.5 in favor of np.trunc", category=PendingDeprecationWarning) def fix(x: _nt.ToInt_1nd, out: None = None) -> _nt.Array[np.intp]: ... @overload +@deprecated("np.fix will be deprecated in NumPy 2.5 in favor of np.trunc", category=PendingDeprecationWarning) def fix(x: _nt.ToFloat64_1nd, out: None = None) -> _nt.Array[np.float64]: ... @overload +@deprecated("np.fix will be deprecated in NumPy 2.5 in favor of np.trunc", category=PendingDeprecationWarning) def fix(x: _nt._ToArray_1ds[_RealT], out: None = None) -> _nt.Array1D[_RealT]: ... @overload +@deprecated("np.fix will be deprecated in NumPy 2.5 in favor of np.trunc", category=PendingDeprecationWarning) def fix(x: _nt._ToArray_2ds[_RealT], out: None = None) -> _nt.Array2D[_RealT]: ... @overload +@deprecated("np.fix will be deprecated in NumPy 2.5 in favor of np.trunc", category=PendingDeprecationWarning) def fix(x: _nt._ToArray_3ds[_RealT], out: None = None) -> _nt.Array3D[_RealT]: ... @overload +@deprecated("np.fix will be deprecated in NumPy 2.5 in favor of np.trunc", category=PendingDeprecationWarning) def fix(x: _nt._ToArray_1nd[_RealT], out: None = None) -> _nt.Array[_RealT]: ... @overload +@deprecated("np.fix will be deprecated in NumPy 2.5 in favor of np.trunc", category=PendingDeprecationWarning) def fix(x: _nt.CoFloating_nd, out: _ArrayT) -> _ArrayT: ... # From 712f6d2ca427c14459561d88dd23ad619661c90a Mon Sep 17 00:00:00 2001 From: jorenham Date: Wed, 24 Dec 2025 12:24:47 +0100 Subject: [PATCH 2/2] =?UTF-8?q?=E2=9C=85=20update=20test=20for=20the=20`fi?= =?UTF-8?q?x`=20pending=20deprecation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/numpy-stubs/@test/runtime/legacy/ufunclike.py | 12 ++++++------ src/numpy-stubs/@test/static/accept/ufunclike.pyi | 10 +++++----- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/numpy-stubs/@test/runtime/legacy/ufunclike.py b/src/numpy-stubs/@test/runtime/legacy/ufunclike.py index b590c3e5..67c28530 100644 --- a/src/numpy-stubs/@test/runtime/legacy/ufunclike.py +++ b/src/numpy-stubs/@test/runtime/legacy/ufunclike.py @@ -23,12 +23,12 @@ def __array__(self, /) -> np.ndarray[Any, np.dtype[np.object_]]: AR_LIKE_O = [Object(), Object(), Object()] AR_U: np.ndarray[tuple[int], np.dtype[np.str_]] = np.zeros(3, dtype="U5") -np.fix(AR_LIKE_b) -np.fix(AR_LIKE_u) -np.fix(AR_LIKE_i) -np.fix(AR_LIKE_f) -np.fix(AR_LIKE_O) -np.fix(AR_LIKE_f, out=AR_U) +np.fix(AR_LIKE_b) # pyright: ignore[reportDeprecated] +np.fix(AR_LIKE_u) # pyright: ignore[reportDeprecated] +np.fix(AR_LIKE_i) # pyright: ignore[reportDeprecated] +np.fix(AR_LIKE_f) # pyright: ignore[reportDeprecated] +np.fix(AR_LIKE_O) # pyright: ignore[reportDeprecated] +np.fix(AR_LIKE_f, out=AR_U) # pyright: ignore[reportDeprecated] np.isposinf(AR_LIKE_b) np.isposinf(AR_LIKE_u) diff --git a/src/numpy-stubs/@test/static/accept/ufunclike.pyi b/src/numpy-stubs/@test/static/accept/ufunclike.pyi index a4271aa4..fea14b2b 100644 --- a/src/numpy-stubs/@test/static/accept/ufunclike.pyi +++ b/src/numpy-stubs/@test/static/accept/ufunclike.pyi @@ -11,11 +11,11 @@ AR_LIKE_f: list[float] ### -assert_type(np.fix(AR_u4), _nt.Array[np.uint32]) -assert_type(np.fix(AR_LIKE_b), _nt.Array[np.bool]) -assert_type(np.fix(AR_LIKE_i), _nt.Array[np.intp]) -assert_type(np.fix(AR_LIKE_f), _nt.Array[np.float64]) -assert_type(np.fix(AR_LIKE_f, out=AR_U), _nt.Array[np.str_]) +assert_type(np.fix(AR_u4), _nt.Array[np.uint32]) # pyright: ignore[reportDeprecated] +assert_type(np.fix(AR_LIKE_b), _nt.Array[np.bool]) # pyright: ignore[reportDeprecated] +assert_type(np.fix(AR_LIKE_i), _nt.Array[np.intp]) # pyright: ignore[reportDeprecated] +assert_type(np.fix(AR_LIKE_f), _nt.Array[np.float64]) # pyright: ignore[reportDeprecated] +assert_type(np.fix(AR_LIKE_f, out=AR_U), _nt.Array[np.str_]) # pyright: ignore[reportDeprecated] assert_type(np.isposinf(AR_u4), _nt.Array[np.bool]) assert_type(np.isposinf(AR_LIKE_b), _nt.Array1D[np.bool])