diff options
author | Bas van Beek <b.f.van.beek@vu.nl> | 2020-10-22 17:36:03 +0200 |
---|---|---|
committer | Bas van Beek <b.f.van.beek@vu.nl> | 2020-10-22 17:45:53 +0200 |
commit | 5602b48f72de4f2311d8979cecc1c5d82468a115 (patch) | |
tree | 1b888f9241139a40fd97e51d697e22e088a46dd1 | |
parent | 6f08cd3b55ae00b80cf33e172a4df1daf439b50f (diff) | |
download | numpy-5602b48f72de4f2311d8979cecc1c5d82468a115.tar.gz |
MAINT: Add `__complex__` to all numeric types
In practice only `complexfloating` defines a `__complex__` method, but this is the only make all numeric types compatible with `builtins.complex`.
-rw-r--r-- | numpy/__init__.pyi | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/numpy/__init__.pyi b/numpy/__init__.pyi index 27fdbed3d..e70075ee6 100644 --- a/numpy/__init__.pyi +++ b/numpy/__init__.pyi @@ -1653,6 +1653,7 @@ class number(generic, Generic[_NBit_co]): # type: ignore def imag(self: _ArraySelf) -> _ArraySelf: ... def __int__(self) -> int: ... def __float__(self) -> float: ... + def __complex__(self) -> complex: ... def __neg__(self: _ArraySelf) -> _ArraySelf: ... def __pos__(self: _ArraySelf) -> _ArraySelf: ... def __abs__(self: _ArraySelf) -> _ArraySelf: ... @@ -1678,6 +1679,7 @@ class bool_(generic): def imag(self: _ArraySelf) -> _ArraySelf: ... def __int__(self) -> int: ... def __float__(self) -> float: ... + def __complex__(self) -> complex: ... def __abs__(self: _ArraySelf) -> _ArraySelf: ... __add__: _BoolOp[bool_] __radd__: _BoolOp[bool_] @@ -1806,6 +1808,7 @@ class timedelta64(generic): ) -> None: ... def __int__(self) -> int: ... def __float__(self) -> float: ... + def __complex__(self) -> complex: ... def __neg__(self: _ArraySelf) -> _ArraySelf: ... def __pos__(self: _ArraySelf) -> _ArraySelf: ... def __abs__(self: _ArraySelf) -> _ArraySelf: ... @@ -1896,7 +1899,6 @@ class complexfloating(inexact[_NBit_co], Generic[_NBit_co, _NBit_co2]): @property def imag(self) -> floating[_NBit_co2]: ... # type: ignore[override] def __abs__(self) -> floating[_NBit_co]: ... # type: ignore[override] - def __complex__(self) -> complex: ... __add__: _ComplexOp[_NBit_co] __radd__: _ComplexOp[_NBit_co] __sub__: _ComplexOp[_NBit_co] |