summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--numpy/__init__.pyi49
-rw-r--r--numpy/typing/_callable.py2
2 files changed, 25 insertions, 26 deletions
diff --git a/numpy/__init__.pyi b/numpy/__init__.pyi
index 579dd03d6..cfa53b5c0 100644
--- a/numpy/__init__.pyi
+++ b/numpy/__init__.pyi
@@ -16,6 +16,7 @@ from numpy.typing import (
_IntLike,
_FloatLike,
_ComplexLike,
+ _TD64Like,
_NumberLike,
_SupportsDType,
_VoidDTypeLike,
@@ -986,10 +987,8 @@ _SortSide = Literal["left", "right"]
_ArrayLikeBool = Union[_BoolLike, Sequence[_BoolLike], ndarray]
_ArrayLikeIntOrBool = Union[
_IntLike,
- _BoolLike,
ndarray,
Sequence[_IntLike],
- Sequence[_BoolLike],
Sequence[Sequence[Any]], # TODO: wait for support for recursive types
]
@@ -1392,7 +1391,7 @@ class _ArrayOrScalarCommon:
@overload
def take(
self,
- indices: Union[_IntLike, _BoolLike],
+ indices: _IntLike,
axis: Optional[int] = ...,
out: None = ...,
mode: _ModeKind = ...,
@@ -1752,12 +1751,12 @@ class datetime64(generic):
__value: int,
__format: Union[_CharLike, Tuple[_CharLike, _IntLike]]
) -> None: ...
- def __add__(self, other: Union[timedelta64, _IntLike, _BoolLike]) -> datetime64: ...
- def __radd__(self, other: Union[timedelta64, _IntLike, _BoolLike]) -> datetime64: ...
+ def __add__(self, other: _TD64Like) -> datetime64: ...
+ def __radd__(self, other: _TD64Like) -> datetime64: ...
@overload
def __sub__(self, other: datetime64) -> timedelta64: ...
@overload
- def __sub__(self, other: Union[timedelta64, _IntLike, _BoolLike]) -> datetime64: ...
+ def __sub__(self, other: _TD64Like) -> datetime64: ...
def __rsub__(self, other: datetime64) -> timedelta64: ...
# Support for `__index__` was added in python 3.8 (bpo-20092)
@@ -1776,20 +1775,20 @@ class integer(number[_NBit_co]): # type: ignore
def __index__(self) -> int: ...
__truediv__: _IntTrueDiv[_NBit_co]
__rtruediv__: _IntTrueDiv[_NBit_co]
- def __mod__(self, value: Union[_IntLike, integer]) -> integer: ...
- def __rmod__(self, value: Union[_IntLike, integer]) -> integer: ...
+ def __mod__(self, value: _IntLike) -> integer: ...
+ def __rmod__(self, value: _IntLike) -> integer: ...
def __invert__(self: _IntType) -> _IntType: ...
# Ensure that objects annotated as `integer` support bit-wise operations
- def __lshift__(self, other: Union[_IntLike, _BoolLike]) -> integer: ...
- def __rlshift__(self, other: Union[_IntLike, _BoolLike]) -> integer: ...
- def __rshift__(self, other: Union[_IntLike, _BoolLike]) -> integer: ...
- def __rrshift__(self, other: Union[_IntLike, _BoolLike]) -> integer: ...
- def __and__(self, other: Union[_IntLike, _BoolLike]) -> integer: ...
- def __rand__(self, other: Union[_IntLike, _BoolLike]) -> integer: ...
- def __or__(self, other: Union[_IntLike, _BoolLike]) -> integer: ...
- def __ror__(self, other: Union[_IntLike, _BoolLike]) -> integer: ...
- def __xor__(self, other: Union[_IntLike, _BoolLike]) -> integer: ...
- def __rxor__(self, other: Union[_IntLike, _BoolLike]) -> integer: ...
+ def __lshift__(self, other: _IntLike) -> integer: ...
+ def __rlshift__(self, other: _IntLike) -> integer: ...
+ def __rshift__(self, other: _IntLike) -> integer: ...
+ def __rrshift__(self, other: _IntLike) -> integer: ...
+ def __and__(self, other: _IntLike) -> integer: ...
+ def __rand__(self, other: _IntLike) -> integer: ...
+ def __or__(self, other: _IntLike) -> integer: ...
+ def __ror__(self, other: _IntLike) -> integer: ...
+ def __xor__(self, other: _IntLike) -> integer: ...
+ def __rxor__(self, other: _IntLike) -> integer: ...
class signedinteger(integer[_NBit_co]):
def __init__(self, __value: _IntValue = ...) -> None: ...
@@ -1835,12 +1834,12 @@ class timedelta64(generic):
def __neg__(self: _ArraySelf) -> _ArraySelf: ...
def __pos__(self: _ArraySelf) -> _ArraySelf: ...
def __abs__(self: _ArraySelf) -> _ArraySelf: ...
- def __add__(self, other: Union[timedelta64, _IntLike, _BoolLike]) -> timedelta64: ...
- def __radd__(self, other: Union[timedelta64, _IntLike, _BoolLike]) -> timedelta64: ...
- def __sub__(self, other: Union[timedelta64, _IntLike, _BoolLike]) -> timedelta64: ...
- def __rsub__(self, other: Union[timedelta64, _IntLike, _BoolLike]) -> timedelta64: ...
- def __mul__(self, other: Union[_FloatLike, _BoolLike]) -> timedelta64: ...
- def __rmul__(self, other: Union[_FloatLike, _BoolLike]) -> timedelta64: ...
+ def __add__(self, other: _TD64Like) -> timedelta64: ...
+ def __radd__(self, other: _TD64Like) -> timedelta64: ...
+ def __sub__(self, other: _TD64Like) -> timedelta64: ...
+ def __rsub__(self, other: _TD64Like) -> timedelta64: ...
+ def __mul__(self, other: _FloatLike) -> timedelta64: ...
+ def __rmul__(self, other: _FloatLike) -> timedelta64: ...
__truediv__: _TD64Div[float64]
__floordiv__: _TD64Div[int64]
def __rtruediv__(self, other: timedelta64) -> float64: ...
@@ -1941,7 +1940,7 @@ complex128 = complexfloating[_64Bit, _64Bit]
class flexible(generic): ... # type: ignore
class void(flexible):
- def __init__(self, __value: Union[_IntLike, _BoolLike, bytes]): ...
+ def __init__(self, __value: Union[_IntLike, bytes]): ...
@property
def real(self: _ArraySelf) -> _ArraySelf: ...
@property
diff --git a/numpy/typing/_callable.py b/numpy/typing/_callable.py
index 91b7a4ec2..97dc3c2e3 100644
--- a/numpy/typing/_callable.py
+++ b/numpy/typing/_callable.py
@@ -101,7 +101,7 @@ if TYPE_CHECKING or HAVE_PROTOCOL:
class _BoolTrueDiv(Protocol):
@overload
- def __call__(self, __other: Union[float, _IntLike, _BoolLike]) -> float64: ...
+ def __call__(self, __other: Union[float, _IntLike]) -> float64: ...
@overload
def __call__(self, __other: complex) -> complex128: ...
@overload