From a3779bc53d4b6b58039eebcb268f8bfb9c46e7b9 Mon Sep 17 00:00:00 2001 From: jorenham Date: Mon, 29 Dec 2025 23:18:15 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=BD=EF=B8=8F=20`lib.=5Fstride=5Ftricks?= =?UTF-8?q?=5Fimpl`=20sync=20with=20upstream?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/numpy-stubs/lib/_stride_tricks_impl.pyi | 51 ++++++++++++--------- 1 file changed, 30 insertions(+), 21 deletions(-) diff --git a/src/numpy-stubs/lib/_stride_tricks_impl.pyi b/src/numpy-stubs/lib/_stride_tricks_impl.pyi index 51228793..e67f51dd 100644 --- a/src/numpy-stubs/lib/_stride_tricks_impl.pyi +++ b/src/numpy-stubs/lib/_stride_tricks_impl.pyi @@ -1,3 +1,4 @@ +from _typeshed import Incomplete from collections.abc import Iterable from typing import Any, SupportsIndex, overload from typing_extensions import TypeVar @@ -10,48 +11,56 @@ __all__ = ["broadcast_arrays", "broadcast_shapes", "broadcast_to"] _ScalarT = TypeVar("_ScalarT", bound=np.generic) +### + class DummyArray: __array_interface__: dict[str, Any] - base: _nt.Array | None - def __init__(self, interface: dict[str, Any], base: _nt.Array | None = ...) -> None: ... + base: np.ndarray | None + def __init__(self, /, interface: dict[str, Any], base: np.ndarray | None = None) -> None: ... @overload def as_strided( x: _ArrayLike[_ScalarT], - shape: Iterable[int] | None = ..., - strides: Iterable[int] | None = ..., - subok: bool = ..., - writeable: bool = ..., + shape: Iterable[int] | None = None, + strides: Iterable[int] | None = None, + subok: bool = False, + writeable: bool = True, ) -> _nt.Array[_ScalarT]: ... @overload def as_strided( x: ArrayLike, - shape: Iterable[int] | None = ..., - strides: Iterable[int] | None = ..., - subok: bool = ..., - writeable: bool = ..., -) -> _nt.Array: ... + shape: Iterable[int] | None = None, + strides: Iterable[int] | None = None, + subok: bool = False, + writeable: bool = True, +) -> _nt.Array[Incomplete]: ... + +# @overload def sliding_window_view( x: _ArrayLike[_ScalarT], window_shape: _ShapeLike, - axis: SupportsIndex | None = ..., + axis: SupportsIndex | None = None, *, - subok: bool = ..., - writeable: bool = ..., + subok: bool = False, + writeable: bool = False, ) -> _nt.Array[_ScalarT]: ... @overload def sliding_window_view( x: ArrayLike, window_shape: _ShapeLike, - axis: SupportsIndex | None = ..., + axis: SupportsIndex | None = None, *, - subok: bool = ..., - writeable: bool = ..., -) -> _nt.Array: ... + subok: bool = False, + writeable: bool = False, +) -> _nt.Array[Incomplete]: ... + +# @overload -def broadcast_to(array: _ArrayLike[_ScalarT], shape: _ShapeLike, subok: bool = ...) -> _nt.Array[_ScalarT]: ... +def broadcast_to(array: _ArrayLike[_ScalarT], shape: _ShapeLike, subok: bool = False) -> _nt.Array[_ScalarT]: ... @overload -def broadcast_to(array: ArrayLike, shape: _ShapeLike, subok: bool = ...) -> _nt.Array: ... +def broadcast_to(array: ArrayLike, shape: _ShapeLike, subok: bool = False) -> _nt.Array[Incomplete]: ... + +# def broadcast_shapes(*args: _ShapeLike) -> _nt.Shape: ... -def broadcast_arrays(*args: ArrayLike, subok: bool = ...) -> tuple[_nt.Array, ...]: ... +def broadcast_arrays(*args: ArrayLike, subok: bool = False) -> tuple[_nt.Array[Incomplete], ...]: ...