-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
--- + Added a note to refer to necessary installation dependencies + Changed version to 2.0.1
- Loading branch information
1 parent
816650e
commit 048e5a8
Showing
7 changed files
with
97 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from caterpillar.model import struct, sizeof | ||
from caterpillar.fields import uint16, _infix_ | ||
from caterpillar.options import S_REPLACE_TYPES | ||
|
||
# Here, we define a custom operator named 'M' that will multiply | ||
# the second argument by 2. | ||
M = _infix_(lambda a, b: a[b*2]) | ||
|
||
# or directly as function | ||
# @_infix_ | ||
# def M(a, b): | ||
# return a[b*2] | ||
|
||
@struct(options={S_REPLACE_TYPES}) | ||
class Format: | ||
# __annotations__ should contain typing.List[int] as we've specified the | ||
# documentation option. | ||
f1: uint16 /M/ 3 | ||
|
||
print(Format.__annotations__) | ||
|
This file contains 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
This file contains 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
This file contains 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
This file contains 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