[yeb] type-convert checksum and patch values#1826
Merged
boegel merged 6 commits intoeasybuilders:developfrom Jul 5, 2016
Merged
[yeb] type-convert checksum and patch values#1826boegel merged 6 commits intoeasybuilders:developfrom
boegel merged 6 commits intoeasybuilders:developfrom
Conversation
| return [to_dependency(dep) for dep in dep_list] | ||
|
|
||
| def to_checksums(checksums): | ||
| if not isinstance(checksums[0], list): |
Contributor
Author
There was a problem hiding this comment.
checksums can be a list of lists, see https://github.com/hpcugent/easybuild-framework/blob/master/test/framework/easyconfigs/toy-0.0.eb#L10
Member
There was a problem hiding this comment.
I'm not sure why this is needed either, it looks wrong to only consider the 1st element.
Member
|
(open/close to trigger Travis) |
| CHECKSUMS = (list, as_hashable({'elem_types': [STRING_OR_TUPLE_LIST]})) | ||
|
|
||
| CHECKABLE_TYPES = [CHECKSUMS, DEPENDENCIES, DEPENDENCY_DICT, NAME_VERSION_DICT, SANITY_CHECK_PATHS_DICT, | ||
| STRING_OR_TUPLE_LIST, TUPLE_OF_STRINGS] |
Member
There was a problem hiding this comment.
style nit-picking: fix indent to align with line above
| if not any(isinstance(checksum, list) for checksum in checksums): | ||
| return to_list_of_strings_and_tuples(checksums) | ||
| else: | ||
| return [to_list_of_strings_and_tuples(cs) for cs in checksums] |
Member
There was a problem hiding this comment.
positive logic (and a docstring) makes this easier to comprehend:
def to_checksums(checksums):
"""Ensure correct element types for list of checksums: convert each element to a tuple."""
if all(isinstance(cs, basestring) for cs in checksums):
# if all elements are strings, we convert each individual element to a tuple
res = [to_list_of_strings_and_tuples(cs) for cs in checksums]
else:
res = to_list_of_strings_and_tuples(checksums)
return res(do check my comment/docstring, I may confuse between list/tuple...)
Member
|
Going in, thanks @Caylo! |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
(to use in yeb, simply replace tuples by lists)