Minor: Remove unnecessary canonicalize_name
calls and validate via NormalizedName
type
#13585
+41
−23
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.
This is a small follow up to #13581, the
name
attribute of theWheel
model class is now guaranteed to be canonicalized, this means there are many places where it is now redundant to callcanonicalize_name
.To validate this is always true I have set some parameters to use the
NormalizedName
type from packaging, which is the type of the canonicalized name. I tried to keep this fairly minimal, there were many more places where a canonicalized name is always being used but changing the type on all of them started to make this PR a lot bigger than it needed to be.We could also use the
Version
type for the version attribute instead of a str in theWheel
model, which would save a couple of calls toVersion
elsewhere, but this ended up being non-trivial in theLinkEvaluator.evaluate_link
method, so I left it a more brave PR than this one.