[DEV] New feature: inline syntax#59
Merged
Merged
Conversation
`_ContextLambda` is `ExprMixin` which overwrites `__eq__`. The `__contains__` function for tuples delegates to `__eq__` and this interaction means that `_has_offset` and `_keep_pos` will be unconditionally false and true when using a dynamic offset.
--- Move all parsing and building related functions (pack*, unpack*, sizeof) into a separate file for easy import handling. Refs: #57
Merge pull request #57 from tsheinen/fix-dynamic-offset-unpack
- Merge pull request #58 from MatrixEditor/fix/dynamic-offsets - Move all parsing and building related functions (pack*, unpack*, sizeof) into a separate file for easy import handling.
- amount, offset and condition now apply comparison in the correct order
- Add correct typing to Chain struct - Add pack and unpack wrappers to all available common structs
- Add inline syntax support to Field class
- update test_py_offset tests
Removes support for the padding 'x' format character within the PyStructFormattedField class. - Remove '_is_padding' from PyStructFormattedField
- Add inline syntax to tutorial - Add inline syntax example - Update documentation for PackMixin and UnpackMixin
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.
this pull request tracks changes related to the v2.8.1 release
Changes made here introduce a new inline syntax that can be used to unpack structs (not annotated struct classes) from bytes or a stream:
Added
<<operator to automatically unpack structs from datafrom_bytes,from_fileandto_bytesfor direct packing or unpackingPackMixinandUnpackMixinto automatically implement the methods mentioned above for struct typesChanges
pack,unpackandsizeofwere moved into their own module (no changed visibe when importing fromcaterpillar.models)Removed
'x'format character inPyStructFormattedFieldFixes
Fieldclass incorrectly evaluated to true or false unconditionally (in case of a context-lambda). This issue has now been fixed in all places.