-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Get rid full file path #7898
Get rid full file path #7898
Conversation
…ad of the full file path.
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.
Also, this should include tests.
Thanks for the PR @microcat49! If you could respond to the review comments when you have the time to, that'd be great! :) |
Hey @pradyunsg sorry about the delayed response I'm still looking into how I could fix the issue raised in the review comment. |
@microcat49 thanks for the quick response! No hurries. Feel free to ask follow up questions if you have any. :) |
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.
A few comments and this definitely needs tests.
… the link. Also adds unit tests.
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.
Some nitpicking, please don't take me too seriously though!
logger.info('Processing %s (cached)', req.link.filename) | ||
else: | ||
logger.info('Processing %s', req.link.file_path) | ||
|
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.
I don't think this newline is needed.
|
||
|
||
class TestInstallRequirementWheelCache(object): | ||
|
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.
Neither is this. It is, I was wrong.
""" | ||
This test to make sure that file is able to tell when a link is | ||
from the wheel cache. | ||
""" | ||
|
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.
What's pip
policy toward PEP 257? I see this style of docstring all over functional tests. Is it time to start complying with the PEP?
""" | ||
This test to make sure that file is able to tell when a link is not | ||
from the wheel cache. | ||
""" | ||
|
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.
So is this.
if self._wheel_cache is not None and self.link is not None: | ||
return bool(self._wheel_cache.cache_dir in self.link.file_path) | ||
else: | ||
return False |
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.
IMHO this is safer (duck-typing) and clearer:
if self._wheel_cache is not None and self.link is not None: | |
return bool(self._wheel_cache.cache_dir in self.link.file_path) | |
else: | |
return False | |
try: | |
return self._wheel_cache.cache_dir in self.link.file_path | |
except AttributeError: | |
return False |
Also please mind the docstring.
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.
The AttributeError suggestion is unclear to me. There are too many attribute access and it’s confusing which one causes the exception. The original implementation is more explicit for me (but the bool()
cast can be removed as suggested).
I am not convinced it is worthwhile to continue this PR without a preliminary refactoring. |
Hello! I am an automated bot and I have noticed that this pull request is not currently able to be merged. If you are able to either merge the |
Closing due to lack of movement here. Please feel free to file a new PR if you want to get the ball rolling again! :) |
Fixes and closes #7815
This change will switch from using full file path for wheel to using just the name of the package.