-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
CLN: Move capitalize_first_letter to where it's used #57096
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
Merged
Changes from 9 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
9a5ffd2
Use str.captialize instead of helper
mroeschke 00f0992
Use title instead
mroeschke b775e21
Use string capwords
mroeschke 088b988
Merge remote-tracking branch 'upstream/main' into cln/helper
mroeschke 9208bee
Merge remote-tracking branch 'upstream/main' into cln/helper
mroeschke be1df81
Pylint
mroeschke 61e6b14
Merge remote-tracking branch 'upstream/main' into cln/helper
mroeschke 19fa575
Just use helper function
mroeschke 2d65f02
Merge remote-tracking branch 'upstream/main' into cln/helper
mroeschke fd76f47
Merge remote-tracking branch 'upstream/main' into cln/helper
mroeschke 8ce54ce
Remove helper function
mroeschke File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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.
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.
Sorry, I'm still a bit confused.
First thing is that
self.name
is always going to beperiod[...
in lower case, this is the implementation (just two methods above this part):Then, if we want to compare strings, why not simply:
This will make:
Which for what understand is what we want, no?
Then, there is another case to consider:
Is this what we want? I personally think this is a bug. I'd say that a better implementation here is simply:
So the comparison with string is consistent with the comparison with the types directly. If we want to do this, we probably don't want to raise when the string is not a valid frequency string, so I guess this makes more sense:
If we go with this option, we probably should add a test, as this would be a bug fix, not a clean up anymore.
What do you think? I think it's a quick change, but if you prefer that I open a new PR for this I can do it.
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.
Maybe we can use
pd.PeriodDtype(freq='1s1ms').freq.freqstrt
to make the comparisonThere 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 updated this PR to use
return other[:1].lower() + other[1:] == self.name
For the
PeriodDtype(freq='1s1ms') == '1001ms'
, I would prefer not to make a call about this case in this PR. My gut would prefer to be stricter in eq and requireperiod[...]
, while just the frequency string can be compared exactly tofreqstr
as @natmokval suggested. For example,1001ms
could be "timedelta-like" for a user which shouldn't be made equal to a "period-like`"