diff options
Diffstat (limited to 'numpy/typing')
-rw-r--r-- | numpy/typing/__init__.py | 2 | ||||
-rw-r--r-- | numpy/typing/_callable.py | 2 | ||||
-rw-r--r-- | numpy/typing/_scalars.py | 8 |
3 files changed, 9 insertions, 3 deletions
diff --git a/numpy/typing/__init__.py b/numpy/typing/__init__.py index e72e8fb4d..d9d9557bf 100644 --- a/numpy/typing/__init__.py +++ b/numpy/typing/__init__.py @@ -210,9 +210,11 @@ del TYPE_CHECKING, final, List from ._scalars import ( _CharLike, _BoolLike, + _UIntLike, _IntLike, _FloatLike, _ComplexLike, + _TD64Like, _NumberLike, _ScalarLike, _VoidLike, diff --git a/numpy/typing/_callable.py b/numpy/typing/_callable.py index c703df28a..831921fd7 100644 --- a/numpy/typing/_callable.py +++ b/numpy/typing/_callable.py @@ -103,7 +103,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 diff --git a/numpy/typing/_scalars.py b/numpy/typing/_scalars.py index e4fc28b07..90b2eff7b 100644 --- a/numpy/typing/_scalars.py +++ b/numpy/typing/_scalars.py @@ -7,12 +7,16 @@ import numpy as np _CharLike = Union[str, bytes] +# The 6 `<X>Like` type-aliases below represent all scalars that can be +# coerced into `<X>` (with the casting rule `same_kind`) _BoolLike = Union[bool, np.bool_] -_IntLike = Union[int, np.integer] +_UIntLike = Union[_BoolLike, np.unsignedinteger] +_IntLike = Union[_BoolLike, int, np.integer] _FloatLike = Union[_IntLike, float, np.floating] _ComplexLike = Union[_FloatLike, complex, np.complexfloating] -_NumberLike = Union[int, float, complex, np.number, np.bool_] +_TD64Like = Union[_IntLike, np.timedelta64] +_NumberLike = Union[int, float, complex, np.number, np.bool_] _ScalarLike = Union[ int, float, |