c-struct-data-parser 0.3.0__tar.gz → 0.4.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {c_struct_data_parser-0.3.0 → c_struct_data_parser-0.4.0}/PKG-INFO +1 -1
- {c_struct_data_parser-0.3.0 → c_struct_data_parser-0.4.0}/pyproject.toml +1 -1
- {c_struct_data_parser-0.3.0 → c_struct_data_parser-0.4.0}/src/c_struct_data_parser/data_structures.py +10 -6
- {c_struct_data_parser-0.3.0 → c_struct_data_parser-0.4.0}/src/c_struct_data_parser/reader_abc.py +3 -0
- {c_struct_data_parser-0.3.0 → c_struct_data_parser-0.4.0}/README.md +0 -0
- {c_struct_data_parser-0.3.0 → c_struct_data_parser-0.4.0}/src/c_struct_data_parser/__init__.py +0 -0
- {c_struct_data_parser-0.3.0 → c_struct_data_parser-0.4.0}/src/c_struct_data_parser/bytes_reader.py +0 -0
- {c_struct_data_parser-0.3.0 → c_struct_data_parser-0.4.0}/src/c_struct_data_parser/parser.py +0 -0
- {c_struct_data_parser-0.3.0 → c_struct_data_parser-0.4.0}/src/c_struct_data_parser/py.typed +0 -0
|
@@ -73,10 +73,13 @@ class IntDefinition(DataDefinition):
|
|
|
73
73
|
@classmethod
|
|
74
74
|
def parser(cls, reader: Reader) -> Tuple[IntDefinition, Reader]:
|
|
75
75
|
(address, data_bytes), new_reader = reader.read(cls.size)
|
|
76
|
-
return
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
76
|
+
return (
|
|
77
|
+
cls(
|
|
78
|
+
int.from_bytes(data_bytes, byteorder=cls.byteorder),
|
|
79
|
+
metadata=Metadata(address),
|
|
80
|
+
),
|
|
81
|
+
new_reader,
|
|
82
|
+
)
|
|
80
83
|
|
|
81
84
|
def __repr__(self) -> str:
|
|
82
85
|
cls_name = type(self).__name__
|
|
@@ -155,7 +158,7 @@ class StructDefinition(DataDefinition):
|
|
|
155
158
|
)
|
|
156
159
|
for (k, t), v in zip(self.field_types.items(), fields):
|
|
157
160
|
if not isinstance(v, t):
|
|
158
|
-
raise ValueError(f"Got unexpected value: {v} for type: {t}")
|
|
161
|
+
raise ValueError(f"Got unexpected value: {v} for type: {t!r}")
|
|
159
162
|
setattr(self, k, v)
|
|
160
163
|
|
|
161
164
|
def __str__(self) -> str:
|
|
@@ -453,12 +456,13 @@ class ArrayDefinition(DataDefinition):
|
|
|
453
456
|
|
|
454
457
|
|
|
455
458
|
def create_array_definition(
|
|
459
|
+
name: str,
|
|
456
460
|
target_type: Type[DataDefinition],
|
|
457
461
|
num_elems: int,
|
|
458
462
|
) -> Type[ArrayDefinition]:
|
|
459
463
|
fields_parser = create_repeat_parser(num_elems, target_type.parser)
|
|
460
464
|
return type(
|
|
461
|
-
|
|
465
|
+
name,
|
|
462
466
|
(ArrayDefinition,),
|
|
463
467
|
{
|
|
464
468
|
"target_type": target_type,
|
|
File without changes
|
{c_struct_data_parser-0.3.0 → c_struct_data_parser-0.4.0}/src/c_struct_data_parser/__init__.py
RENAMED
|
File without changes
|
{c_struct_data_parser-0.3.0 → c_struct_data_parser-0.4.0}/src/c_struct_data_parser/bytes_reader.py
RENAMED
|
File without changes
|
{c_struct_data_parser-0.3.0 → c_struct_data_parser-0.4.0}/src/c_struct_data_parser/parser.py
RENAMED
|
File without changes
|
|
File without changes
|