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

bpo-37689: add Path.is_relative_to() method #14982

Merged
merged 6 commits into from
Aug 13, 2019
Merged

Conversation

shihai1991
Copy link
Member

@shihai1991 shihai1991 commented Jul 27, 2019

Doc/library/pathlib.rst Outdated Show resolved Hide resolved
Copy link
Contributor

@aeros aeros left a comment

Choose a reason for hiding this comment

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

@shihai1991 Thanks for the contribution! I definitely think that this function would be quite helpful.

I did some testing in the interpreter after installing python through your branch:
image
OS: Arch Linux 5.2.3

Looks good to me! I just had a few minor suggestions:

Doc/library/pathlib.rst Outdated Show resolved Hide resolved
Doc/library/pathlib.rst Outdated Show resolved Hide resolved
Doc/library/pathlib.rst Outdated Show resolved Hide resolved
@shihai1991
Copy link
Member Author

@pitrou Hi, Antoine. pls review this PR, if you have free time, thanks :)

@aeros
Copy link
Contributor

aeros commented Jul 28, 2019

@shihai1991 Btw, after you've made any changes based on suggestions you can use "Resolve conversation" to show that each one has been addressed (or directly commit the suggestion to the PR). Thanks for making the recommended changes (:

@pitrou pitrou changed the title bpo-37689: add a is_realative_to function in pathlib module bpo-37689: add Path.is_relative_to() method Jul 28, 2019
Copy link
Member

@pitrou pitrou left a comment

Choose a reason for hiding this comment

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

Thanks for doing this. Please find some comments below.

Doc/library/pathlib.rst Outdated Show resolved Hide resolved
@@ -539,6 +539,20 @@ Pure paths provide the following methods and properties:
ValueError: '/etc/passwd' does not start with '/usr'


.. method:: PurePath.is_relative_to(*other)

Return the boolean result that this path is relative to *other* path.
Copy link
Member

Choose a reason for hiding this comment

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

How about Return whether this path is relative to the *other* path?

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree, this would be an improvement over my earlier suggestion. Since it's modifying a verb, "Return" in this case, I think it might be slightly more correct to explicitly specify the "or not":

Return whether or not this path is relative to the *other* path.

Copy link
Member Author

Choose a reason for hiding this comment

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

ops, i am not a native english speaker, so i have no idea about "whether(or not)" :(

Copy link
Contributor

Choose a reason for hiding this comment

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

@shihai1991 That's okay, the distinction is often a pain, even for those of us who are native speakers (:

Lib/test/test_pathlib.py Outdated Show resolved Hide resolved
@bedevere-bot
Copy link

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@shihai1991
Copy link
Member Author

@shihai1991 Btw, after you've made any changes based on suggestions you can use "Resolve conversation" to show that each one has been addressed (or directly commit the suggestion to the PR). Thanks for making the recommended changes (:

np, looks I need change my habit(because i am a gerrit user before:)

@shihai1991
Copy link
Member Author

I have made the requested changes; please review again

@bedevere-bot
Copy link

Thanks for making the requested changes!

@pitrou: please review the changes made to this pull request.

Copy link
Member

@CuriousLearner CuriousLearner left a comment

Choose a reason for hiding this comment

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

Overall, this looks good to me. I just have a minor suggestion on renaming the parameter as mentioned inline.

Doc/library/pathlib.rst Show resolved Hide resolved
Lib/pathlib.py Show resolved Hide resolved
Copy link
Member

@CuriousLearner CuriousLearner left a comment

Choose a reason for hiding this comment

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

Since other methods already have other parameter, I think we're good to go on this.

LGTM 🌮

Copy link
Member

@pitrou pitrou left a comment

Choose a reason for hiding this comment

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

Thanks for the update! Just one additional comment and I think we're good to go.

Doc/library/pathlib.rst Outdated Show resolved Hide resolved
@bedevere-bot
Copy link

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@shihai1991
Copy link
Member Author

I have made the requested changes; please review again

@bedevere-bot
Copy link

Thanks for making the requested changes!

@pitrou: please review the changes made to this pull request.

@pitrou
Copy link
Member

pitrou commented Aug 13, 2019

Thank you @shihai1991 !

lisroach pushed a commit to lisroach/cpython that referenced this pull request Sep 10, 2019
DinoV pushed a commit to DinoV/cpython that referenced this pull request Jan 14, 2020
websurfer5 pushed a commit to websurfer5/cpython that referenced this pull request Jul 20, 2020
icanhasmath pushed a commit to ActiveState/cpython that referenced this pull request Oct 27, 2023
icanhasmath pushed a commit to ActiveState/cpython that referenced this pull request Jul 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants