_machar.pyi 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. from collections.abc import Iterable
  2. from typing import Any, Final, overload
  3. from typing_extensions import TypeVar, Unpack
  4. import numpy as np
  5. from numpy import _CastingKind
  6. from numpy._utils import set_module as set_module
  7. ###
  8. _T = TypeVar("_T")
  9. _TupleT = TypeVar("_TupleT", bound=tuple[()] | tuple[Any, Any, Unpack[tuple[Any, ...]]])
  10. _ExceptionT = TypeVar("_ExceptionT", bound=Exception)
  11. ###
  12. class UFuncTypeError(TypeError):
  13. ufunc: Final[np.ufunc]
  14. def __init__(self, /, ufunc: np.ufunc) -> None: ...
  15. class _UFuncNoLoopError(UFuncTypeError):
  16. dtypes: tuple[np.dtype[Any], ...]
  17. def __init__(self, /, ufunc: np.ufunc, dtypes: Iterable[np.dtype[Any]]) -> None: ...
  18. class _UFuncBinaryResolutionError(_UFuncNoLoopError):
  19. dtypes: tuple[np.dtype[Any], np.dtype[Any]]
  20. def __init__(self, /, ufunc: np.ufunc, dtypes: Iterable[np.dtype[Any]]) -> None: ...
  21. class _UFuncCastingError(UFuncTypeError):
  22. casting: Final[_CastingKind]
  23. from_: Final[np.dtype[Any]]
  24. to: Final[np.dtype[Any]]
  25. def __init__(self, /, ufunc: np.ufunc, casting: _CastingKind, from_: np.dtype[Any], to: np.dtype[Any]) -> None: ...
  26. class _UFuncInputCastingError(_UFuncCastingError):
  27. in_i: Final[int]
  28. def __init__(
  29. self,
  30. /,
  31. ufunc: np.ufunc,
  32. casting: _CastingKind,
  33. from_: np.dtype[Any],
  34. to: np.dtype[Any],
  35. i: int,
  36. ) -> None: ...
  37. class _UFuncOutputCastingError(_UFuncCastingError):
  38. out_i: Final[int]
  39. def __init__(
  40. self,
  41. /,
  42. ufunc: np.ufunc,
  43. casting: _CastingKind,
  44. from_: np.dtype[Any],
  45. to: np.dtype[Any],
  46. i: int,
  47. ) -> None: ...
  48. class _ArrayMemoryError(MemoryError):
  49. shape: tuple[int, ...]
  50. dtype: np.dtype[Any]
  51. def __init__(self, /, shape: tuple[int, ...], dtype: np.dtype[Any]) -> None: ...
  52. @property
  53. def _total_size(self) -> int: ...
  54. @staticmethod
  55. def _size_to_string(num_bytes: int) -> str: ...
  56. @overload
  57. def _unpack_tuple(tup: tuple[_T]) -> _T: ...
  58. @overload
  59. def _unpack_tuple(tup: _TupleT) -> _TupleT: ...
  60. def _display_as_base(cls: type[_ExceptionT]) -> type[_ExceptionT]: ...