-
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
Refactor manifest writing. #465
Conversation
Signed-off-by: dblock <dblock@dblock.org>
nested = cls.compact(v) | ||
if len(nested.keys()) > 0: | ||
clean[k] = nested | ||
elif v is not None and v != []: |
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.
Can be check like if not nested[k]
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.
Not sure I follow, LMK if 1664903 can be improved further.
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.
Since we are checking whether the key has any value in the dictionary. Why not to check it like if not dict[key]
which will check for value mapped to the key? Let me know what you think
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.
I don't think I understand ;) We already have a hold on v
, the value through the iteration above. If that value is None
or []
we don't want to write it. Why would I use d[k]
here? Could you please write the function as you suggest?
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.
Ohh. I completely missed the 1664903 commit. That's exactly does what I suggested above.
Signed-off-by: dblock <dblock@dblock.org>
Signed-off-by: dblock <dblock@dblock.org>
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!
Signed-off-by: dblock dblock@dblock.org
Description
Extracted from #461.
Manifest#to_file
.__to_dict__
into private methods and added a singleManifest#to_dict
.Manifest#compact
that removes empty keys when writing manifests.schema-version
isstr
.Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.