-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
TYP: fix NDFrame.align #51867
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
TYP: fix NDFrame.align #51867
Conversation
pyright_reportGeneralTypeIssues.json
Outdated
@@ -1,4 +1,3 @@ | |||
# this becomes obsolete when reportGeneralTypeIssues can be enabled in pyproject.toml |
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.
Had to remove these comments as the JSON format does not allow comments (pyright seems to use a stricter parser now)
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.
what happens if you dont upgrade pyright?
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.
Upgrading pyright is not needed for this PR. Just upgraded it because there is a newer version.
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.
OK. everything but this im happy to merge. for this can we ping someone who knows pyright better than me?
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.
I reverted this change for this PR as it is not yet needed.
pandas/core/generic.py
Outdated
@@ -198,6 +199,8 @@ | |||
from pandas.core.indexers.objects import BaseIndexer | |||
from pandas.core.resample import Resampler | |||
|
|||
_NDFrameT = TypeVar("_NDFrameT", bound="NDFrame") |
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.
can you add a comment on why this is necessary? e.g. i think once Self is available we can swap this out?
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.
Yes, this can be removed when we can use Self
. If we want to link two parameters to be of the same NDFrame (sub-class) NDFrameT
is enough, but if we have two pairs, we need to use a second TypeVar for the second pair. Otherwise, all four parameters are bound to the same (sub)class.
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.
i know, im asking for a comment in the code to that effect
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.
Added a comment. I realized that we cannot remove it when Self is available as Self doesn't help _align_as_utc
.
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.
Probably better to move it to pandas._typing
since this will not be a temporary fix.
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.
i think when the time comes we can make _align_as_utc a NDFrame method
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.
moved to pandas._typing
one comment request, otherwise LGTM |
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.
LGTM
thanks @twoertwein |
doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.