construct-classes 0.2.0__tar.gz → 0.2.1__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.
- {construct_classes-0.2.0 → construct_classes-0.2.1}/CHANGELOG.rst +9 -1
- {construct_classes-0.2.0 → construct_classes-0.2.1}/PKG-INFO +1 -1
- {construct_classes-0.2.0 → construct_classes-0.2.1}/pyproject.toml +1 -1
- {construct_classes-0.2.0 → construct_classes-0.2.1}/src/construct_classes/__init__.py +7 -2
- {construct_classes-0.2.0 → construct_classes-0.2.1}/LICENSE +0 -0
- {construct_classes-0.2.0 → construct_classes-0.2.1}/README.rst +0 -0
- {construct_classes-0.2.0 → construct_classes-0.2.1}/src/construct_classes/py.typed +0 -0
|
@@ -11,7 +11,15 @@ Unreleased
|
|
|
11
11
|
|
|
12
12
|
Please see all `Unreleased Changes`_ for more information.
|
|
13
13
|
|
|
14
|
-
.. _Unreleased Changes: https://github.com/matejcik/construct-classes/compare/v0.2.
|
|
14
|
+
.. _Unreleased Changes: https://github.com/matejcik/construct-classes/compare/v0.2.1...HEAD
|
|
15
|
+
|
|
16
|
+
0.2.1 - 2025-08-25
|
|
17
|
+
--------------------
|
|
18
|
+
|
|
19
|
+
Fixed
|
|
20
|
+
~~~~~
|
|
21
|
+
|
|
22
|
+
- Fix exception when creating a subclass of a subclass of :code:`Struct`.
|
|
15
23
|
|
|
16
24
|
|
|
17
25
|
0.2.0 - 2025-08-25
|
|
@@ -42,8 +42,9 @@ class _StructMeta(type):
|
|
|
42
42
|
**kwargs: t.Any,
|
|
43
43
|
) -> type:
|
|
44
44
|
new_cls = super().__new__(cls, name, bases, namespace)
|
|
45
|
-
if bases:
|
|
46
|
-
|
|
45
|
+
if any(isinstance(b, _StructMeta) for b in bases):
|
|
46
|
+
# skip over `Struct` itself, which does not have a StructMeta class in its
|
|
47
|
+
# bases.
|
|
47
48
|
return dataclasses.dataclass(kw_only=kw_only, **kwargs)(new_cls)
|
|
48
49
|
else:
|
|
49
50
|
return new_cls
|
|
@@ -90,3 +91,7 @@ class Struct(metaclass=_StructMeta):
|
|
|
90
91
|
def parse(cls: t.Type[Self], data: bytes) -> Self:
|
|
91
92
|
result = cls.SUBCON.parse(data)
|
|
92
93
|
return cls.from_parsed(result)
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
# check that `Struct` itself is not transformed
|
|
97
|
+
assert not dataclasses.is_dataclass(Struct)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|