generated from datalad/datalad-extension-template
-
Notifications
You must be signed in to change notification settings - Fork 10
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 EnsureHashAlgorithm #492
Merged
Merged
Commits on May 15, 2023
-
Create EnsureHashAlgorithm based on EnsureChoice
This adds EnsureHashAlgorithm constraint which checks whether the given algorith name is contained in hashlib's algorithms_guaranteed set. It derives from EnsureChoice without further customization. Using `algorithms_guaranteed` covers algorithms that have named constructors in hashlib, i.e. accessible through getattr(hashlib, name) - that's the current usage in MultiHash. Future expansion could see us move to algorithms_available - these will be recognized when passed to (slower) hashlib.new(), but have no named constructors. For details, see: https://docs.python.org/3.11/library/hashlib.html
Configuration menu - View commit details
-
Copy full SHA for 2fa7b99 - Browse repository at this point
Copy the full SHA 2fa7b99View commit details
Commits on May 16, 2023
-
Fix EnsureHashAlgorithm & use EnsureListOf
The EnsureHash algorithm now calls its super.__init__ correctly. We use EnsureHashAlgorithm() | EnsureListOf(...) in ls_file_colelction now. This correctly handles incoming values, which are always a list in CLI (argparse behaviour with --append) and can be str or list in Python API. At least when they are OK. When input is not OK, two things are suboptimal: - an incorrect hash (str) proceeds to EnsureListOf, which tries to go letter by letter, failing on first - a hash (list) with an incorrect value would first fail on EnsureHashAlgorithm(list), proceed to EnsureListOf, and fail on EnsureHashAlgorithm(str) As a conequence, in both cases the error message would say "does not match any of 2 alternatives" and print EnsureChoice message ("is not one of ...") twice.
Configuration menu - View commit details
-
Copy full SHA for 632facb - Browse repository at this point
Copy the full SHA 632facbView commit details
Commits on Oct 18, 2023
-
Apply @mih's patch from comment for improved error
as suggested in datalad#346 (comment)
Configuration menu - View commit details
-
Copy full SHA for 0f04769 - Browse repository at this point
Copy the full SHA 0f04769View commit details
Commits on Oct 20, 2023
-
Configuration menu - View commit details
-
Copy full SHA for b27725a - Browse repository at this point
Copy the full SHA b27725aView commit details
Commits on Oct 21, 2023
-
Configuration menu - View commit details
-
Copy full SHA for b27f292 - Browse repository at this point
Copy the full SHA b27f292View commit details -
Configuration menu - View commit details
-
Copy full SHA for 6788864 - Browse repository at this point
Copy the full SHA 6788864View commit details -
Configuration menu - View commit details
-
Copy full SHA for 666977d - Browse repository at this point
Copy the full SHA 666977dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 4e04ec8 - Browse repository at this point
Copy the full SHA 4e04ec8View commit details
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.