-
-
Notifications
You must be signed in to change notification settings - Fork 19.2k
TYP: update EA.view() type annotation to indicate it returns an EA without dtype parameter #62285
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
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…thout dtype parameter
Comment on lines
-511
to
512
|
||
@overload | ||
@overload # type: ignore[override] | ||
def view(self) -> Self: ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not really clear to me why I need to add this ignore here (since this is exactly the same as in the base class and the mixin base).
But if not adding it, I get
pandas/core/arrays/datetimelike.py:511: error: Signature of "view" incompatible with supertype "pandas.core.arrays._mixins.NDArrayBackedExtensionArray" [override]
pandas/core/arrays/datetimelike.py:511: note: Superclass:
pandas/core/arrays/datetimelike.py:511: note: @overload
pandas/core/arrays/datetimelike.py:511: note: def view(self) -> DatetimeLikeArrayMixin
pandas/core/arrays/datetimelike.py:511: note: @overload
pandas/core/arrays/datetimelike.py:511: note: def view(self, dtype: ExtensionDtype | str | dtype[Any] | type[str] | type[complex] | type[bool] | type[object] | None = ...) -> ExtensionArray | ndarray[Any, Any]
pandas/core/arrays/datetimelike.py:511: note: Subclass:
pandas/core/arrays/datetimelike.py:511: note: @overload
pandas/core/arrays/datetimelike.py:511: note: def view(self) -> DatetimeLikeArrayMixin
pandas/core/arrays/datetimelike.py:511: note: @overload
pandas/core/arrays/datetimelike.py:511: note: def view(self, dtype: Literal['M8[ns]']) -> DatetimeArray
pandas/core/arrays/datetimelike.py:511: note: @overload
pandas/core/arrays/datetimelike.py:511: note: def view(self, dtype: Literal['m8[ns]']) -> TimedeltaArray
pandas/core/arrays/datetimelike.py:511: note: @overload
pandas/core/arrays/datetimelike.py:511: note: def view(self, dtype: ExtensionDtype | str | dtype[Any] | type[str] | type[complex] | type[bool] | type[object] | None = ...) -> ExtensionArray | ndarray[Any, Any]
pandas/core/arrays/datetimelike.py:511: error: Signature of "view" incompatible with supertype "pandas.core.arrays.base.ExtensionArray" [override]
pandas/core/arrays/datetimelike.py:511: note: Superclass:
pandas/core/arrays/datetimelike.py:511: note: @overload
pandas/core/arrays/datetimelike.py:511: note: def view(self) -> DatetimeLikeArrayMixin
pandas/core/arrays/datetimelike.py:511: note: @overload
pandas/core/arrays/datetimelike.py:511: note: def view(self, dtype: ExtensionDtype | str | dtype[Any] | type[str] | type[complex] | type[bool] | type[object] | None = ...) -> ExtensionArray | ndarray[Any, Any]
pandas/core/arrays/datetimelike.py:511: note: Subclass:
pandas/core/arrays/datetimelike.py:511: note: @overload
pandas/core/arrays/datetimelike.py:511: note: def view(self) -> DatetimeLikeArrayMixin
pandas/core/arrays/datetimelike.py:511: note: @overload
pandas/core/arrays/datetimelike.py:511: note: def view(self, dtype: Literal['M8[ns]']) -> DatetimeArray
pandas/core/arrays/datetimelike.py:511: note: @overload
pandas/core/arrays/datetimelike.py:511: note: def view(self, dtype: Literal['m8[ns]']) -> TimedeltaArray
pandas/core/arrays/datetimelike.py:511: note: @overload
pandas/core/arrays/datetimelike.py:511: note: def view(self, dtype: ExtensionDtype | str | dtype[Any] | type[str] | type[complex] | type[bool] | type[object] | None = ...) -> ExtensionArray | ndarray[Any, Any]
mroeschke
approved these changes
Sep 8, 2025
Thanks @jorisvandenbossche |
eicchen
pushed a commit
to eicchen/pandas
that referenced
this pull request
Oct 18, 2025
…thout dtype parameter (pandas-dev#62285)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Running into this in #61925, trying to fix this here separately (as I might have some questions for typing experts on how to get this passing, and don't want to derail the original PR for that)