Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 30 additions & 21 deletions src/numpy-stubs/lib/_stride_tricks_impl.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from _typeshed import Incomplete
from collections.abc import Iterable
from typing import Any, SupportsIndex, overload
from typing_extensions import TypeVar
Expand All @@ -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], ...]: ...