diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2021-02-08 10:05:14 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-08 10:05:14 -0700 |
commit | d7d9d7ba33d6486dff1a8cc1c55ed542e0bfb47e (patch) | |
tree | cf96f05edaf2729bf500455c3a678ac6c785bd20 /numpy/typing/_callable.py | |
parent | 8eff1f6a2fed8d9df52750271f4e07dc4ea5e1bf (diff) | |
parent | 53496cdf82d6c9a3ddb40c12746d3257d9e09396 (diff) | |
download | numpy-d7d9d7ba33d6486dff1a8cc1c55ed542e0bfb47e.tar.gz |
Merge pull request #18322 from BvB93/plugin-precision
ENH: Add a mypy plugin for exposing platform-specific extended-precision types
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, |