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