-
Notifications
You must be signed in to change notification settings - Fork 26
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
Add vers
support in index_packages endpoint
#170
Conversation
Signed-off-by: Keshav Priyadarshi <[email protected]>
Signed-off-by: Keshav Priyadarshi <[email protected]>
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.
Thanks! this is looking good, but I would prefer we find a way to avoid code copy from VulnerableCode. How could we share this code?
And if we go ahead and merge this, what's the plan to remove this duplication?
Signed-off-by: Keshav Priyadarshi <[email protected]>
As discussed earlier, we will move this piece of code to the fetchcode.
|
This PR is a blocker for aboutcode-org/scancode.io#836 (comment) |
@tdruez waiting for review from @pombredanne and @JonoYang |
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.
@keshav-space Thanks for the PR! I've left some comments for your consideration.
] | ||
""" | ||
latest_date = None | ||
for download in downloads: |
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 think its more Pythonic to sort the list of downloads by the upload time, then popping the latest download entry from the list.
for download in downloads: | |
# Sort `downloads` from earliest "upload_time_iso_8601" to latest | |
downloads = downloads.sort(key=lambda x: x["upload_time_iso_8601"]) | |
# Pop the latest download entry from `downloads` | |
latest_download = downloads.pop() | |
latest_date = latest_download.get("upload_time_iso_8601") | |
if latest_date: | |
latest_date = dateparser.parse(latest_date) | |
return latest_date |
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.
@JonoYang I was trying to keep package_managers
code untouched and refactor it while migrating to fetchcode.
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.
@keshav-space Ah, I see.
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.
Thanks... some nits for your consideration.
Signed-off-by: Keshav Priyadarshi <[email protected]>
Signed-off-by: Keshav Priyadarshi <[email protected]>
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.
@keshav-space LGTM!
@pombredanne Is there anything else you see that needs to be updated?
Merging, thanks for the contribution! |
vers
inindex_packages
endpoint #155