-
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
Fix parsing of JSON index dist-info-metadata values #12078
Merged
Merged
Changes from 2 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
6c3db09
Fix parsing of JSON index dist-info-metadata values
pfmoore cc554ed
Add a news file
pfmoore 8f89997
Fix types to be 3.7-compatible
pfmoore cfb4923
Fix bad test data in test_parse_links_json
pfmoore 93b274e
Missed a change to one of the tests
pfmoore 232cc9d
Parse hash data before passing to MetadataFile
pfmoore 5168881
Implement PEP 714 - rename dist-info-metadata
pfmoore 7e3f74f
Merge branch 'main' into core_metadata
pfmoore 97cc6a4
Merge branch 'main' into core_metadata
pfmoore a0976d8
Fix lint issues
pfmoore c7daa07
Reword the check for no hashes
pfmoore a934f38
Merge branch 'main' into core_metadata
pfmoore File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Correctly parse ``dist-info-metadata`` values from JSON-format index data. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 have a strong preference since the values in
_SUPPORTED_HASHES
look fine to me (though it might be time to retiremd5
from that list). In theory people can use a number of other hashes that this method may not pick up, but I think that can/should be handled as a separate task of maintaining the list of supported hashes.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.
Seems reasonable. This is mostly about handling garbage produced by incorrect servers (stuff like "sah256=abcbcba") than about limiting what hashes we use.
The attribute is already a weird tri-state thing (
None
= no data supplied,MetadataFile(None)
= supplied with no hashes, and the full thing with hashes. There's also a dodgyMetadataFile({})
which we get if we end up stripping everything, which is probably like `MetadataFile(None), but consumers might not like an empty dict of hashes.I think what I should probably do is validate the input up front, rather than in this class. Then we just assert here that hashes must be
None
or a dictionary containing only one or more supported hash types.