-
-
Notifications
You must be signed in to change notification settings - Fork 31.4k
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
bpo-323042: Document how to remove a suffix of a pathlib.Path #8655
bpo-323042: Document how to remove a suffix of a pathlib.Path #8655
Conversation
Hello, and thanks for your contribution! I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA). Unfortunately our records indicate you have not signed the CLA. For legal reasons we need you to sign this before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue. When your account is ready, please add a comment in this pull request You can check yourself Thanks again for your contribution, we look forward to reviewing 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.
Could you also remove the outdated comment in Lib/pathlib.py
?
# XXX if suffix is None, should the current suffix be removed?
Sure. I also documented the empty string case in the docstring. |
Lib/pathlib.py
Outdated
"""Return a new path with the file suffix changed (or added, if none).""" | ||
# XXX if suffix is None, should the current suffix be removed? | ||
"""Return a new path with the file suffix changed. If the path | ||
has no suffix, add `suffix`. If the given `suffix` is an empty |
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.
Style nit: We don't use reST markup in docstrings.
6b7a3e7
to
7a8d530
Compare
Thanks for the feedback! FYI: In some places in pathlib.py rst-style comments are used. One could clean that up at some point. |
Should I squash the commits or is any other action required from my side? |
Thanks @sotte for the PR, and @berkerpeksag for merging it 🌮🎉.. I'm working now to backport this PR to: 3.6, 3.7. |
GH-8661 is a backport of this pull request to the 3.7 branch. |
GH-8662 is a backport of this pull request to the 3.6 branch. |
(cherry picked from commit 46dc4e3) Co-authored-by: Stefan Otte <stefan.otte@gmail.com>
(cherry picked from commit 46dc4e3) Co-authored-by: Stefan Otte <stefan.otte@gmail.com>
Thanks!
No, I was just waiting for tests to be completed. |
Thanks! Was a lot of fun :) |
bpo-323042: Document how to remove a suffix of a pathlib.Path
I didn't realize that you can remove a suffix with the
with_suffix
function of thePath
class ofpathlib
and I always used a little utility function that I wrote.I wanted to add that functionality (removing of a suffix) and submit a PR but then I saw that
with_suffix
has you covered already. I'm just documenting this feature with this PR.https://bugs.python.org/issue323042