-
Notifications
You must be signed in to change notification settings - Fork 3.2k
consolidate vcs link detection #6883
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
Conversation
0a69e0a to
7684037
Compare
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.
This looks like a good simplification. Thanks!
src/pip/_internal/models/link.py
Outdated
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.
Since with this change this logic is getting duplicated in both is_vcs and is_artifact, I think it would be best if is_artifact is changed to call this method. (And you can move is_vcs before is_artifact so is_artifact is depending on methods defined before it.) Also, that way we avoid introducing a second nested import.
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.
Good point. Done.
|
Looks good to me. |
src/pip/_internal/models/link.py
Outdated
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.
Actually, this can just be:
return not self.is_vcsThere 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.
Yes of course, but reading the docstring I had the feeling it was meant to evolve to cover other cases. That is also the reason I refrained of implementing is_vcs as not is_artifact. What do you think?
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.
It's always possible things can change in the future, but we can cross that bridge when we get to 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.
FWIW, I do agree the current docstring is confusing..
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.
Okay, done and squashed.
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.
Great! 👍
fe32b88 to
2e1dfbe
Compare
While working on #6853 and #6851, it was not immediately obvious to me why
not link.is_artifactmeans it is a VCS link.So I thought I could make this little readability improvement, by replacing the global
is_vcs_urlfunction by ais_vcsproperty ofLink.