-
Notifications
You must be signed in to change notification settings - Fork 275
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
Make some helper functions for determining hashed bins part of repository_lib #1058
Make some helper functions for determining hashed bins part of repository_lib #1058
Conversation
Remove the non-public function _get_hash() from repository_tool in favour of the public function get_target_hash() in repository_lib Signed-off-by: Joshua Lock <[email protected]>
TODO: these functions don't yet have explicit tests (though they are tested implicitly by the |
tuf/repository_lib.py
Outdated
|
||
|
||
|
||
def find_bin_for_hash(path_hash, number_of_bins): |
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.
Should perhaps be find_bin_for_target_hash()
for better consistency with get_target_hash()
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 relocating the code, @joshuagl! I support your find_bin_for_target_hash
rename suggestion.
Also, I'm for moving on without adding explicit tests. The delegate_hashed_bins
tests cover the functionality sufficiently for the time being. And we can still add tests when we set the public API in stone. What do you think?
Move repository_tool._find_bin_for_hash() and helper functions it uses to non-protected functions in repository_lib. _find_bin_for_hash() becomes find_bin_for_target_hash() These functions will be useful to adopters using the WIP low-level API for updating metadata files (see theupdateframework#1048) Signed-off-by: Joshua Lock <[email protected]>
7f1c790
to
ed45fb2
Compare
Pushed an update with the rename in ed45fb2
I think this makes sense, thanks @lukpueh |
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.
🎉
Fixes issue #: N/A
Description of the changes being introduced by the pull request:
In order to support users of the WIP low-level API for updating individual metadata on addition of a target (see #1048), specifically Warehouse and PEP 458, make some of the helper functions for determining the appropriate bin for a given target part of the public API in
repository_lib
.Please verify and check that the pull request fulfills the following
requirements: