Commit graph

38 commits

Author SHA1 Message Date
Tim Rid
2b5967e11d fixing pyright issues 2021-05-23 16:22:40 +02:00
Tim Rid
5a39c51321 - renamed classes/methods/file:
- "tstruct.py" -> "dataclass_struct.py"
    - "TStruct" -> "DataclassStruct"
    - "TBitStruct" -> "DataclassBitStruct"
    - "sfield" -> "csfield"
    - "TContainerMixin" -> "DataclassMixin"

- extended documentation
2021-05-22 23:36:54 +02:00
Tim Rid
9666d132fd added TBitStruct test 2021-05-22 21:51:24 +02:00
Tim Rid
3811437219 fixed faild test 2021-05-22 17:22:04 +02:00
Tim Rid
a304977aca - Revised TContainerMixin:
- removed inheritance of cs.Container (which removed the acces to dataclass objects via square brackets)
   - copied __str__ from cs.Container with a few modifications

- Removed 'add_offsets' from TStruct
- Changed implementation of TBitStruct
2021-05-22 17:10:56 +02:00
Tim Rid
976e68d4b9 values from "cs.Const" and "cs.Default" are now set as default value from the dataclass 2021-04-13 21:33:11 +02:00
Tim Rid
d092e48a68 fixed failing test case 2021-04-03 21:40:26 +02:00
Tim Rid
94b7f7f606 changed "swapped" to "reverse" in TStruct and TBitStruct 2021-03-30 19:54:23 +02:00
Tim Rid
b336087493 renamed "TContainerBase" to "TContainerMixin" 2021-03-30 19:35:33 +02:00
Tim Rid
ae440407e9 - renamed "TStructField" to "field" and "TUnionField" to "ufield". This makes the dataclass definitions shorter and more readable.
- removed "Opt" and "List" because they are not necessary any more, because covariant is now included for ParsedType.
- added test with typing.List as field
- fix: changed dict to typing.Dict
2021-03-16 18:51:04 +01:00
Tim Rid
d0a31458a8 added covariant and contravariant from PR #1 2021-03-13 17:49:03 +01:00
Tim Rid
318c5b0a67 arrow is now also typed, so the type ignore is unnecessary 2021-03-13 12:51:09 +01:00
Tim Rid
8957eaeede updated stubs for construct==2.10.61 2021-02-20 23:52:06 +01:00
Tim Rid
246a7d3910 added two offsets for each element 2021-02-20 22:11:10 +01:00
Tim Rid
57d843171e added __getattr__ to TStruct 2021-02-20 21:50:50 +01:00
Tim Rid
a4741e2bf2 new setting in TStruct: "add_offsets" 2021-02-20 21:42:39 +01:00
Tim Rid
419353c712 strip trailing new lines in documentation 2021-01-10 13:33:02 +01:00
Tim Rid
6900b37acd fixed things that are complained by pyright 2021-01-10 13:31:56 +01:00
Tim Rid
4c4bf74fd3 fixed some python 3.7 and numpy issues 2021-01-03 12:32:41 +01:00
Tim Rid
3d74c99718 fixed type error 2021-01-03 11:54:11 +01:00
Tim Rid
f5a3565f3e added stubs for LazyStruct, LazyListContainer, LazyArray, LazyBound
fixed bug in test_typed.py
2021-01-02 23:35:45 +01:00
Tim Rid
764102a80a Removed TArray. Instead created TypeAlias "List". 2021-01-02 22:38:18 +01:00
Tim Rid
f3a2fd94d0 fixed some mypy issues 2021-01-02 21:31:26 +01:00
Tim Rid
aa453f29a7 fixed mypy and pytest errors 2021-01-02 17:54:52 +01:00
Tim Rid
ffe3211326 added "TContainerBase" 2021-01-02 14:49:34 +01:00
Tim Rid
ac8800943a Added "TFlagsEnum" and "FlagsEnumBase" 2021-01-02 12:01:20 +01:00
Tim Rid
def9e93da7 - enhanced TEnum
- added EnumBase
- extended README.md
2021-01-02 01:12:04 +01:00
Tim Rid
74a5082c7f run black and isort 2021-01-01 23:46:43 +01:00
Tim Rid
0a51f86183 slightly modified test_core.py so that mypy doesn't generate errors. 2021-01-01 22:56:53 +01:00
Tim Rid
0f597f643f added original tests from https://raw.githubusercontent.com/construct/construct/2626b398a676191114f6ce5d8db903e9590700db/tests/test_core.py 2021-01-01 22:06:19 +01:00
Tim Rid
944cf85797 - added tests "test_tstruct_default_field" and "test_tstruct_const_field"
- added setattrs
2021-01-01 17:26:40 +01:00
Tim Rid
4aa3013a82 corrected and enhanced tests 2021-01-01 15:42:10 +01:00
Tim Rid
e6f3f12d30 - divided construct_typed in multiple files
- adapted the "test_typed.py" to dataclasses
2020-12-31 17:11:21 +01:00
Tim Rid
aff5c0589b rework of construct_typed to dataclasses 2020-12-31 00:31:44 +01:00
Tim Rid
12d94f89e4 fixed swapped param of TypedStruct, to keep the order of the sucons in a container when printing
added TypedBitStruct
2020-12-16 21:39:45 +01:00
Tim Rid
8922c5eccc put a prefix before every object of "typing", because there are a few duplications, e.g. Union and Optional.
added stubs for Select, Optional, If, IfThenElse
2020-12-12 13:17:27 +01:00
Tim Rid
a564ff55fd a TypedStruct is always parsed to an object of the container_type 2020-12-12 12:12:54 +01:00
Tim Rid
209314db4a added README.md
added more (mostly empty) stub files
added setup.py
added construct_typed initial version
added initial tests
2020-12-10 20:26:37 +01:00