/ lib / numpy / lib / stride_tricks.pyi
stride_tricks.pyi
 1  from collections.abc import Iterable
 2  from typing import Any, TypeVar, overload, SupportsIndex
 3  
 4  from numpy import generic
 5  from numpy._typing import (
 6      NDArray,
 7      ArrayLike,
 8      _ShapeLike,
 9      _Shape,
10      _ArrayLike
11  )
12  
13  _SCT = TypeVar("_SCT", bound=generic)
14  
15  __all__: list[str]
16  
17  class DummyArray:
18      __array_interface__: dict[str, Any]
19      base: None | NDArray[Any]
20      def __init__(
21          self,
22          interface: dict[str, Any],
23          base: None | NDArray[Any] = ...,
24      ) -> None: ...
25  
26  @overload
27  def as_strided(
28      x: _ArrayLike[_SCT],
29      shape: None | Iterable[int] = ...,
30      strides: None | Iterable[int] = ...,
31      subok: bool = ...,
32      writeable: bool = ...,
33  ) -> NDArray[_SCT]: ...
34  @overload
35  def as_strided(
36      x: ArrayLike,
37      shape: None | Iterable[int] = ...,
38      strides: None | Iterable[int] = ...,
39      subok: bool = ...,
40      writeable: bool = ...,
41  ) -> NDArray[Any]: ...
42  
43  @overload
44  def sliding_window_view(
45      x: _ArrayLike[_SCT],
46      window_shape: int | Iterable[int],
47      axis: None | SupportsIndex = ...,
48      *,
49      subok: bool = ...,
50      writeable: bool = ...,
51  ) -> NDArray[_SCT]: ...
52  @overload
53  def sliding_window_view(
54      x: ArrayLike,
55      window_shape: int | Iterable[int],
56      axis: None | SupportsIndex = ...,
57      *,
58      subok: bool = ...,
59      writeable: bool = ...,
60  ) -> NDArray[Any]: ...
61  
62  @overload
63  def broadcast_to(
64      array: _ArrayLike[_SCT],
65      shape: int | Iterable[int],
66      subok: bool = ...,
67  ) -> NDArray[_SCT]: ...
68  @overload
69  def broadcast_to(
70      array: ArrayLike,
71      shape: int | Iterable[int],
72      subok: bool = ...,
73  ) -> NDArray[Any]: ...
74  
75  def broadcast_shapes(*args: _ShapeLike) -> _Shape: ...
76  
77  def broadcast_arrays(
78      *args: ArrayLike,
79      subok: bool = ...,
80  ) -> list[NDArray[Any]]: ...