-
-
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. I made the changes in this PR to address the future |
||
else: | ||
freq = to_offset(freq, is_period=True) | ||
base = libperiod.freq_to_dtype_code(freq) | ||
if base != FreqGroup.FR_QTR.value: | ||
if base != cast(int, FreqGroup.FR_QTR.value): | ||
raise AssertionError("base must equal FR_QTR") | ||
|
||
freqstr = freq.freqstr | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe 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. |
||
"pandas._libs.tslibs.dtypes.FreqGroup.FR_BUS", | ||
"pandas._libs.tslibs.dtypes.FreqGroup.FR_DAY", | ||
"pandas._libs.tslibs.dtypes.FreqGroup.FR_HR", | ||
"pandas._libs.tslibs.dtypes.FreqGroup.FR_MIN", | ||
"pandas._libs.tslibs.dtypes.FreqGroup.FR_MS", | ||
"pandas._libs.tslibs.dtypes.FreqGroup.FR_MTH", | ||
"pandas._libs.tslibs.dtypes.FreqGroup.FR_NS", | ||
"pandas._libs.tslibs.dtypes.FreqGroup.FR_QTR", | ||
"pandas._libs.tslibs.dtypes.FreqGroup.FR_SEC", | ||
"pandas._libs.tslibs.dtypes.FreqGroup.FR_UND", | ||
"pandas._libs.tslibs.dtypes.FreqGroup.FR_US", | ||
"pandas._libs.tslibs.dtypes.FreqGroup.FR_WK", | ||
"pandas._libs.tslibs.dtypes.NpyDatetimeUnit.NPY_FR_D", | ||
"pandas._libs.tslibs.dtypes.NpyDatetimeUnit.NPY_FR_GENERIC", | ||
"pandas._libs.tslibs.dtypes.NpyDatetimeUnit.NPY_FR_M", | ||
"pandas._libs.tslibs.dtypes.NpyDatetimeUnit.NPY_FR_W", | ||
"pandas._libs.tslibs.dtypes.NpyDatetimeUnit.NPY_FR_Y", | ||
"pandas._libs.tslibs.dtypes.NpyDatetimeUnit.NPY_FR_as", | ||
"pandas._libs.tslibs.dtypes.NpyDatetimeUnit.NPY_FR_fs", | ||
"pandas._libs.tslibs.dtypes.NpyDatetimeUnit.NPY_FR_h", | ||
"pandas._libs.tslibs.dtypes.NpyDatetimeUnit.NPY_FR_m", | ||
"pandas._libs.tslibs.dtypes.NpyDatetimeUnit.NPY_FR_ms", | ||
"pandas._libs.tslibs.dtypes.NpyDatetimeUnit.NPY_FR_ns", | ||
"pandas._libs.tslibs.dtypes.NpyDatetimeUnit.NPY_FR_ps", | ||
"pandas._libs.tslibs.dtypes.NpyDatetimeUnit.NPY_FR_s", | ||
"pandas._libs.tslibs.dtypes.NpyDatetimeUnit.NPY_FR_us", | ||
"pandas._libs.tslibs.dtypes.Resolution.RESO_DAY", | ||
"pandas._libs.tslibs.dtypes.Resolution.RESO_HR", | ||
"pandas._libs.tslibs.dtypes.Resolution.RESO_MIN", | ||
"pandas._libs.tslibs.dtypes.Resolution.RESO_MS", | ||
"pandas._libs.tslibs.dtypes.Resolution.RESO_MTH", | ||
"pandas._libs.tslibs.dtypes.Resolution.RESO_NS", | ||
"pandas._libs.tslibs.dtypes.Resolution.RESO_QTR", | ||
"pandas._libs.tslibs.dtypes.Resolution.RESO_SEC", | ||
"pandas._libs.tslibs.dtypes.Resolution.RESO_US", | ||
"pandas._libs.tslibs.dtypes.Resolution.RESO_YR", | ||
] | ||
|
||
if __name__ == "__main__": | ||
|
Uh oh!
There was an error while loading. Please reload this page.