8000 MAINT: Fixed the return-dtype of `ndarray.real` and `imag` by BvB93 · Pull Request #19324 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

MAINT: Fixed the return-dtype of ndarray.real and imag #19324

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 24, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
8000
Diff view
16 changes: 14 additions & 2 deletions numpy/__init__.pyi
Original file line number Diff line number Diff line change
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