stride_tricks.pyi 1.7 KB

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