shape_base.pyi 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import sys
  2. from typing import TypeVar, overload, List, Sequence
  3. from numpy import ndarray
  4. from numpy.typing import ArrayLike
  5. if sys.version_info >= (3, 8):
  6. from typing import SupportsIndex
  7. else:
  8. from typing_extensions import Protocol
  9. class SupportsIndex(Protocol):
  10. def __index__(self) -> int: ...
  11. _ArrayType = TypeVar("_ArrayType", bound=ndarray)
  12. @overload
  13. def atleast_1d(__arys: ArrayLike) -> ndarray: ...
  14. @overload
  15. def atleast_1d(*arys: ArrayLike) -> List[ndarray]: ...
  16. @overload
  17. def atleast_2d(__arys: ArrayLike) -> ndarray: ...
  18. @overload
  19. def atleast_2d(*arys: ArrayLike) -> List[ndarray]: ...
  20. @overload
  21. def atleast_3d(__arys: ArrayLike) -> ndarray: ...
  22. @overload
  23. def atleast_3d(*arys: ArrayLike) -> List[ndarray]: ...
  24. def vstack(tup: Sequence[ArrayLike]) -> ndarray: ...
  25. def hstack(tup: Sequence[ArrayLike]) -> ndarray: ...
  26. @overload
  27. def stack(
  28. arrays: Sequence[ArrayLike], axis: SupportsIndex = ..., out: None = ...
  29. ) -> ndarray: ...
  30. @overload
  31. def stack(
  32. arrays: Sequence[ArrayLike], axis: SupportsIndex = ..., out: _ArrayType = ...
  33. ) -> _ArrayType: ...
  34. def block(arrays: ArrayLike) -> ndarray: ...