Skip to content
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

clean: simplify lite-rule-alias and dont-uppercase #59240

Merged
merged 1 commit into from
Jul 19, 2024

Conversation

MarcoGorelli
Copy link
Member

work in progress, trying to clean this confusing code

  • closes #xxxx (Replace xxxx with the GitHub issue number)
  • Tests added and passed if fixing a bug or adding a new feature
  • All code checks passed.
  • Added type annotations to new arguments/methods/functions.
  • Added an entry in the latest doc/source/whatsnew/vX.X.X.rst file if fixing a bug or adding a new feature.

Comment on lines -4705 to +4702
_dont_uppercase = {"h", "bh", "cbh", "MS", "ms", "s"}
_dont_uppercase = {"min", "h", "bh", "cbh", "s", "ms", "us", "ns"}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It never made much sense to me that 'MS' was in this list. It's been there since forever, but it looks odd - 'MS' is already uppercase 😄

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree, it was always confusing for me.

@pytest.mark.parametrize("freq_depr", ["2MIN", "2mS", "2Us"])
@pytest.mark.parametrize("freq_depr", ["2MIN", "2nS", "2Us"])
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this PR, "2mS" would just raise a hard error. I think that's OK tbh, anyone using 'ms' case-insentively was already playing with fire

("b", BDay()),
("bme", BMonthEnd()),
("Bme", BMonthEnd()),
("BME", BMonthEnd()),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'b' raises a deprecation warning (and it's already tested, e.g. test_construction_bday and test_construction_bday

'bme' would raise a hard error, but I think that's fine too, as 'me' already went through a deprecation cycle

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, seems reasonable to me

@natmokval
Copy link
Contributor

natmokval commented Jul 18, 2024

@MarcoGorelli, these changes look good to me.
When we merge this PR, I can close #56516.

@MarcoGorelli MarcoGorelli marked this pull request as ready for review July 19, 2024 09:44
@MarcoGorelli MarcoGorelli changed the title WIP clean: simplify lite-rule-alias and dont-uppercase clean: simplify lite-rule-alias and dont-uppercase Jul 19, 2024
@mroeschke mroeschke added Frequency DateOffsets Clean labels Jul 19, 2024
@mroeschke mroeschke added this to the 3.0 milestone Jul 19, 2024
@mroeschke mroeschke merged commit fe9ff74 into pandas-dev:main Jul 19, 2024
51 checks passed
@mroeschke
Copy link
Member

Thanks @MarcoGorelli

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants