mixins.pyi 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. from abc import ABC, abstractmethod
  2. from typing import Any, Literal as L, type_check_only
  3. from numpy import ufunc
  4. __all__ = ["NDArrayOperatorsMixin"]
  5. # NOTE: `NDArrayOperatorsMixin` is not formally an abstract baseclass,
  6. # even though it's reliant on subclasses implementing `__array_ufunc__`
  7. # NOTE: The accepted input- and output-types of the various dunders are
  8. # completely dependent on how `__array_ufunc__` is implemented.
  9. # As such, only little type safety can be provided here.
  10. class NDArrayOperatorsMixin(ABC):
  11. __slots__ = ()
  12. @type_check_only
  13. @abstractmethod
  14. def __array_ufunc__(
  15. self,
  16. ufunc: ufunc,
  17. method: L["__call__", "reduce", "reduceat", "accumulate", "outer", "at"],
  18. /,
  19. *inputs: Any,
  20. **kwargs: Any,
  21. ) -> Any: ...
  22. def __lt__(self, other: Any) -> Any: ...
  23. def __le__(self, other: Any) -> Any: ...
  24. def __eq__(self, other: Any) -> Any: ...
  25. def __ne__(self, other: Any) -> Any: ...
  26. def __gt__(self, other: Any) -> Any: ...
  27. def __ge__(self, other: Any) -> Any: ...
  28. def __add__(self, other: Any) -> Any: ...
  29. def __radd__(self, other: Any) -> Any: ...
  30. def __iadd__(self, other: Any) -> Any: ...
  31. def __sub__(self, other: Any) -> Any: ...
  32. def __rsub__(self, other: Any) -> Any: ...
  33. def __isub__(self, other: Any) -> Any: ...
  34. def __mul__(self, other: Any) -> Any: ...
  35. def __rmul__(self, other: Any) -> Any: ...
  36. def __imul__(self, other: Any) -> Any: ...
  37. def __matmul__(self, other: Any) -> Any: ...
  38. def __rmatmul__(self, other: Any) -> Any: ...
  39. def __imatmul__(self, other: Any) -> Any: ...
  40. def __truediv__(self, other: Any) -> Any: ...
  41. def __rtruediv__(self, other: Any) -> Any: ...
  42. def __itruediv__(self, other: Any) -> Any: ...
  43. def __floordiv__(self, other: Any) -> Any: ...
  44. def __rfloordiv__(self, other: Any) -> Any: ...
  45. def __ifloordiv__(self, other: Any) -> Any: ...
  46. def __mod__(self, other: Any) -> Any: ...
  47. def __rmod__(self, other: Any) -> Any: ...
  48. def __imod__(self, other: Any) -> Any: ...
  49. def __divmod__(self, other: Any) -> Any: ...
  50. def __rdivmod__(self, other: Any) -> Any: ...
  51. def __pow__(self, other: Any) -> Any: ...
  52. def __rpow__(self, other: Any) -> Any: ...
  53. def __ipow__(self, other: Any) -> Any: ...
  54. def __lshift__(self, other: Any) -> Any: ...
  55. def __rlshift__(self, other: Any) -> Any: ...
  56. def __ilshift__(self, other: Any) -> Any: ...
  57. def __rshift__(self, other: Any) -> Any: ...
  58. def __rrshift__(self, other: Any) -> Any: ...
  59. def __irshift__(self, other: Any) -> Any: ...
  60. def __and__(self, other: Any) -> Any: ...
  61. def __rand__(self, other: Any) -> Any: ...
  62. def __iand__(self, other: Any) -> Any: ...
  63. def __xor__(self, other: Any) -> Any: ...
  64. def __rxor__(self, other: Any) -> Any: ...
  65. def __ixor__(self, other: Any) -> Any: ...
  66. def __or__(self, other: Any) -> Any: ...
  67. def __ror__(self, other: Any) -> Any: ...
  68. def __ior__(self, other: Any) -> Any: ...
  69. def __neg__(self) -> Any: ...
  70. def __pos__(self) -> Any: ...
  71. def __abs__(self) -> Any: ...
  72. def __invert__(self) -> Any: ...