Refactor/combine from_bytes and from_stream#36
Open
Alon-Alexander wants to merge 4 commits intoshustinm:masterfrom
Open
Refactor/combine from_bytes and from_stream#36Alon-Alexander wants to merge 4 commits intoshustinm:masterfrom
Alon-Alexander wants to merge 4 commits intoshustinm:masterfrom
Conversation
Add `from_stream` to all fields. Create `as_stream` utility Call `from_stream` from `from_bytes`
shustinm
requested changes
May 14, 2021
Owner
shustinm
left a comment
There was a problem hiding this comment.
Great progress, but missed the point to remove code duplication
hydration/__init__.py
Outdated
| pre_bytes_hook = Struct.pre_bytes_hook | ||
| post_bytes_hook = Struct.post_bytes_hook | ||
| from_bytes_hook = Struct.from_bytes_hook | ||
| from_bytes_hook = Struct.pre_deserialization_hook |
Owner
There was a problem hiding this comment.
This is not what this hook is about. The from_bytes_hook is a hook that happens during deserialization. So it should be renamed to deserialization_hook. The other hooks need to be renamed too. e. g. pre_bytes_hook -> pre_deserialization_hook
Author
There was a problem hiding this comment.
Updated, but notice that it is pre_serialization_hook (and post) and not pre_deserialization_hook
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.
Fixes #35
from_streamandfrom_bytesby creating aas_streamutility.from_streamwhere bytes hooks can change the field object (with code which already existed infrom_bytes).from_bytes_hooktopre_deserialization_hookbut kept the old name there for backward-compatibility.