Skip to content

Commit

Permalink
Merge pull request #19324 from BvB93/real_imag
Browse files Browse the repository at this point in the history
MAINT: Fixed the return-dtype of `ndarray.real` and `imag`
  • Loading branch information
charris committed Jun 24, 2021
2 parents 209cca9 + cd33912 commit c532dcd
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions numpy/__init__.pyi
Expand Up @@ -1645,6 +1645,14 @@ _ArrayTD64_co = NDArray[Union[bool_, integer[Any], timedelta64]]
class _SupportsItem(Protocol[_T_co]):
def item(self, __args: Any) -> _T_co: ...

class _SupportsReal(Protocol[_T_co]):
@property
def real(self) -> _T_co: ...

class _SupportsImag(Protocol[_T_co]):
@property
def imag(self) -> _T_co: ...

class ndarray(_ArrayOrScalarCommon, Generic[_ShapeType, _DType_co]):
@property
def base(self) -> Optional[ndarray]: ...
Expand All @@ -1653,11 +1661,15 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeType, _DType_co]):
@property
def size(self) -> int: ...
@property
def real(self: _ArraySelf) -> _ArraySelf: ...
def real(
self: NDArray[_SupportsReal[_ScalarType]], # type: ignore[type-var]
) -> ndarray[_ShapeType, dtype[_ScalarType]]: ...
@real.setter
def real(self, value: ArrayLike) -> None: ...
@property
def imag(self: _ArraySelf) -> _ArraySelf: ...
def imag(
self: NDArray[_SupportsImag[_ScalarType]], # type: ignore[type-var]
) -> ndarray[_ShapeType, dtype[_ScalarType]]: ...
@imag.setter
def imag(self, value: ArrayLike) -> None: ...
def __new__(
Expand Down

0 comments on commit c532dcd

Please sign in to comment.