-
-
Notifications
You must be signed in to change notification settings - Fork 18.9k
fix enum typing from _lib #62145
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
base: main
Are you sure you want to change the base?
fix enum typing from _lib #62145
Conversation
This comment was marked as off-topic.
This comment was marked as off-topic.
@@ -1435,11 +1435,11 @@ def _range_from_fields( | |||
if quarter is not None: | |||
if freq is None: | |||
freq = to_offset("Q", is_period=True) | |||
base = FreqGroup.FR_QTR.value | |||
base = cast(int, FreqGroup.FR_QTR.value) |
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.
Note that this is a mypy bug and is no longer necessary on mypy master (python/mypy#19352), so the next release will cause [redundant-cast]
here and below
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. I made the changes in this PR to address the future mypy
, but we need the code to work now with the current mypy
and so that the changes made in the dev version of mypy work with pandas.
@@ -74,6 +74,44 @@ | |||
"pandas._libs.tslibs.offsets.BusinessHour.rollforward ", | |||
# type alias | |||
"pandas._libs.tslibs.timedeltas.UnitChoices", | |||
# enum types in cython vs PYI | |||
"pandas._libs.tslibs.dtypes.FreqGroup.FR_ANN", |
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.
Even better, that same PR made all these entries redundant as well - current stubtest on mypy master does not report them as incompatible.
mypy
is fixing how they handleenum
types, and the fix revealed an issue with how we handle them.See python/mypy#19687 (comment)