-
Notifications
You must be signed in to change notification settings - Fork 271
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
ngclient: use Metadata.verify_delegate #1509
ngclient: use Metadata.verify_delegate #1509
Conversation
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.
LGTM!
Love those prs where we are simplifying the codebase!
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 switch to Metadata.verify_delegate
look great, but I'm confused as to why we have added extra typing annotations that were not required before?
@@ -408,7 +360,7 @@ def update_delegated_targets( | |||
if self.snapshot is None: | |||
raise RuntimeError("Cannot load targets before snapshot") | |||
|
|||
delegator = self.get(delegator_name) | |||
delegator: Optional[Metadata] = self.get(delegator_name) |
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.
Are we annotating this as Optional so that mypy can understand that None
is a valid value for delegator? Why wasn't this required before?
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.
No, mypy was not complaining about this. I did it to help the code editor figure it out. I can separate it in another commit or explain it in the commit message if it looks weird in between the other changes.
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 does look a bit out of place in this commit, though it's not an objectionable change by itself.
Replace the helper verify_with_threshold() with the newly implemented method Metadata.verify_delegate. Add an aditional type annotation helping the IDE. Signed-off-by: Teodora Sechkova <tsechkova@vmware.com>
7a370e5
to
d70f697
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.
Thanks for the clean up!
Fixes #1413
Description of the changes being introduced by the pull request:
Replace the helper verify_with_threshold() with
the newly implemented method Metadata.verify_delegate.
Please verify and check that the pull request fulfills the following
requirements: