diff options
Diffstat (limited to 'numpy/typing/_callable.py')
-rw-r--r-- | numpy/typing/_callable.py | 46 |
1 files changed, 28 insertions, 18 deletions
diff --git a/numpy/typing/_callable.py b/numpy/typing/_callable.py index 0e34cd799..23cabd47a 100644 --- a/numpy/typing/_callable.py +++ b/numpy/typing/_callable.py @@ -38,7 +38,7 @@ from numpy import ( complexfloating, complex128, ) -from ._nbit import _NBitInt +from ._nbit import _NBitInt, _NBitDouble from ._scalars import ( _BoolLike_co, _IntLike_co, @@ -133,7 +133,7 @@ if TYPE_CHECKING or HAVE_PROTOCOL: @overload # platform dependent def __call__(self, __other: int) -> _2Tuple[int_]: ... @overload - def __call__(self, __other: float) -> _2Tuple[float64]: ... + def __call__(self, __other: float) -> _2Tuple[floating[Union[_NBit1, _NBitDouble]]]: ... @overload def __call__(self, __other: _IntType) -> _2Tuple[_IntType]: ... @overload @@ -151,11 +151,13 @@ if TYPE_CHECKING or HAVE_PROTOCOL: @overload def __call__(self, __other: bool) -> floating[_NBit1]: ... @overload - def __call__(self, __other: int) -> floating[_NBitInt]: ... + def __call__(self, __other: int) -> floating[Union[_NBit1, _NBitInt]]: ... @overload - def __call__(self, __other: float) -> float64: ... + def __call__(self, __other: float) -> floating[Union[_NBit1, _NBitDouble]]: ... @overload - def __call__(self, __other: complex) -> complex128: ... + def __call__( + self, __other: complex + ) -> complexfloating[Union[_NBit1, _NBitDouble], Union[_NBit1, _NBitDouble]]: ... @overload def __call__(self, __other: integer[_NBit2]) -> floating[Union[_NBit1, _NBit2]]: ... @@ -168,9 +170,11 @@ if TYPE_CHECKING or HAVE_PROTOCOL: self, __other: Union[int, signedinteger[Any]] ) -> Union[signedinteger[Any], float64]: ... @overload - def __call__(self, __other: float) -> float64: ... + def __call__(self, __other: float) -> floating[Union[_NBit1, _NBitDouble]]: ... @overload - def __call__(self, __other: complex) -> complex128: ... + def __call__( + self, __other: complex + ) -> complexfloating[Union[_NBit1, _NBitDouble], Union[_NBit1, _NBitDouble]]: ... @overload def __call__( self, __other: unsignedinteger[_NBit2] @@ -196,7 +200,7 @@ if TYPE_CHECKING or HAVE_PROTOCOL: self, __other: Union[int, signedinteger[Any]] ) -> Union[signedinteger[Any], float64]: ... @overload - def __call__(self, __other: float) -> float64: ... + def __call__(self, __other: float) -> floating[Union[_NBit1, _NBitDouble]]: ... @overload def __call__( self, __other: unsignedinteger[_NBit2] @@ -210,7 +214,7 @@ if TYPE_CHECKING or HAVE_PROTOCOL: self, __other: Union[int, signedinteger[Any]] ) -> Union[_2Tuple[signedinteger[Any]], _2Tuple[float64]]: ... @overload - def __call__(self, __other: float) -> _2Tuple[float64]: ... + def __call__(self, __other: float) -> _2Tuple[floating[Union[_NBit1, _NBitDouble]]]: ... @overload def __call__( self, __other: unsignedinteger[_NBit2] @@ -222,9 +226,11 @@ if TYPE_CHECKING or HAVE_PROTOCOL: @overload def __call__(self, __other: int) -> signedinteger[Union[_NBit1, _NBitInt]]: ... @overload - def __call__(self, __other: float) -> float64: ... + def __call__(self, __other: float) -> floating[Union[_NBit1, _NBitDouble]]: ... @overload - def __call__(self, __other: complex) -> complex128: ... + def __call__( + self, __other: complex + ) -> complexfloating[Union[_NBit1, _NBitDouble], Union[_NBit1, _NBitDouble]]: ... @overload def __call__( self, __other: signedinteger[_NBit2] @@ -246,7 +252,7 @@ if TYPE_CHECKING or HAVE_PROTOCOL: @overload def __call__(self, __other: int) -> signedinteger[Union[_NBit1, _NBitInt]]: ... @overload - def __call__(self, __other: float) -> float64: ... + def __call__(self, __other: float) -> floating[Union[_NBit1, _NBitDouble]]: ... @overload def __call__( self, __other: signedinteger[_NBit2] @@ -258,7 +264,7 @@ if TYPE_CHECKING or HAVE_PROTOCOL: @overload def __call__(self, __other: int) -> _2Tuple[signedinteger[Union[_NBit1, _NBitInt]]]: ... @overload - def __call__(self, __other: float) -> _2Tuple[float64]: ... + def __call__(self, __other: float) -> _2Tuple[floating[Union[_NBit1, _NBitDouble]]]: ... @overload def __call__( self, __other: signedinteger[_NBit2] @@ -270,9 +276,11 @@ if TYPE_CHECKING or HAVE_PROTOCOL: @overload def __call__(self, __other: int) -> floating[Union[_NBit1, _NBitInt]]: ... @overload - def __call__(self, __other: float) -> float64: ... + def __call__(self, __other: float) -> floating[Union[_NBit1, _NBitDouble]]: ... @overload - def __call__(self, __other: complex) -> complex128: ... + def __call__( + self, __other: complex + ) -> complexfloating[Union[_NBit1, _NBitDouble], Union[_NBit1, _NBitDouble]]: ... @overload def __call__( self, __other: Union[integer[_NBit2], floating[_NBit2]] @@ -284,7 +292,7 @@ if TYPE_CHECKING or HAVE_PROTOCOL: @overload def __call__(self, __other: int) -> floating[Union[_NBit1, _NBitInt]]: ... @overload - def __call__(self, __other: float) -> float64: ... + def __call__(self, __other: float) -> floating[Union[_NBit1, _NBitDouble]]: ... @overload def __call__( self, __other: Union[integer[_NBit2], floating[_NBit2]] @@ -296,7 +304,7 @@ if TYPE_CHECKING or HAVE_PROTOCOL: @overload def __call__(self, __other: int) -> _2Tuple[floating[Union[_NBit1, _NBitInt]]]: ... @overload - def __call__(self, __other: float) -> _2Tuple[float64]: ... + def __call__(self, __other: float) -> _2Tuple[floating[Union[_NBit1, _NBitDouble]]]: ... @overload def __call__( self, __other: Union[integer[_NBit2], floating[_NBit2]] @@ -308,7 +316,9 @@ if TYPE_CHECKING or HAVE_PROTOCOL: @overload def __call__(self, __other: int) -> complexfloating[Union[_NBit1, _NBitInt], Union[_NBit1, _NBitInt]]: ... @overload - def __call__(self, __other: Union[float, complex]) -> complex128: ... + def __call__( + self, __other: Union[float, complex] + ) -> complexfloating[Union[_NBit1, _NBitDouble], Union[_NBit1, _NBitDouble]]: ... @overload def __call__( self, |