soia-client 1.0.5__tar.gz → 1.0.6__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.
Potentially problematic release.
This version of soia-client might be problematic. Click here for more details.
- {soia_client-1.0.5 → soia_client-1.0.6}/PKG-INFO +1 -1
- {soia_client-1.0.5 → soia_client-1.0.6}/pyproject.toml +1 -1
- {soia_client-1.0.5 → soia_client-1.0.6}/soia_client.egg-info/PKG-INFO +1 -1
- {soia_client-1.0.5 → soia_client-1.0.6}/soialib/impl/structs.py +13 -1
- {soia_client-1.0.5 → soia_client-1.0.6}/tests/test_module_initializer.py +20 -0
- {soia_client-1.0.5 → soia_client-1.0.6}/LICENSE +0 -0
- {soia_client-1.0.5 → soia_client-1.0.6}/README +0 -0
- {soia_client-1.0.5 → soia_client-1.0.6}/setup.cfg +0 -0
- {soia_client-1.0.5 → soia_client-1.0.6}/soia_client.egg-info/SOURCES.txt +0 -0
- {soia_client-1.0.5 → soia_client-1.0.6}/soia_client.egg-info/dependency_links.txt +0 -0
- {soia_client-1.0.5 → soia_client-1.0.6}/soia_client.egg-info/top_level.txt +0 -0
- {soia_client-1.0.5 → soia_client-1.0.6}/soialib/__init__.py +0 -0
- {soia_client-1.0.5 → soia_client-1.0.6}/soialib/impl/__init__.py +0 -0
- {soia_client-1.0.5 → soia_client-1.0.6}/soialib/impl/arrays.py +0 -0
- {soia_client-1.0.5 → soia_client-1.0.6}/soialib/impl/encoding.py +0 -0
- {soia_client-1.0.5 → soia_client-1.0.6}/soialib/impl/enums.py +0 -0
- {soia_client-1.0.5 → soia_client-1.0.6}/soialib/impl/function_maker.py +0 -0
- {soia_client-1.0.5 → soia_client-1.0.6}/soialib/impl/optionals.py +0 -0
- {soia_client-1.0.5 → soia_client-1.0.6}/soialib/impl/primitives.py +0 -0
- {soia_client-1.0.5 → soia_client-1.0.6}/soialib/impl/repr.py +0 -0
- {soia_client-1.0.5 → soia_client-1.0.6}/soialib/impl/type_adapter.py +0 -0
- {soia_client-1.0.5 → soia_client-1.0.6}/soialib/keyed_items.py +0 -0
- {soia_client-1.0.5 → soia_client-1.0.6}/soialib/method.py +0 -0
- {soia_client-1.0.5 → soia_client-1.0.6}/soialib/module_initializer.py +0 -0
- {soia_client-1.0.5 → soia_client-1.0.6}/soialib/never.py +0 -0
- {soia_client-1.0.5 → soia_client-1.0.6}/soialib/serializer.py +0 -0
- {soia_client-1.0.5 → soia_client-1.0.6}/soialib/serializers.py +0 -0
- {soia_client-1.0.5 → soia_client-1.0.6}/soialib/spec.py +0 -0
- {soia_client-1.0.5 → soia_client-1.0.6}/soialib/timestamp.py +0 -0
- {soia_client-1.0.5 → soia_client-1.0.6}/tests/test_serializers.py +0 -0
- {soia_client-1.0.5 → soia_client-1.0.6}/tests/test_timestamp.py +0 -0
|
@@ -146,7 +146,7 @@ class StructAdapter(TypeAdapter):
|
|
|
146
146
|
)
|
|
147
147
|
|
|
148
148
|
# Initialize DEFAULT.
|
|
149
|
-
self.gen_class.DEFAULT
|
|
149
|
+
_init_default(self.gen_class.DEFAULT, fields)
|
|
150
150
|
|
|
151
151
|
# Define mutable getters
|
|
152
152
|
for field in fields:
|
|
@@ -674,6 +674,18 @@ def _adjust_array_len_expr(var: str, removed_numbers: tuple[int, ...]) -> str:
|
|
|
674
674
|
return ret
|
|
675
675
|
|
|
676
676
|
|
|
677
|
+
def _init_default(default: Any, fields: Sequence[_Field]) -> None:
|
|
678
|
+
for field in fields:
|
|
679
|
+
attribute = field.field.attribute
|
|
680
|
+
get_field_default = make_function(
|
|
681
|
+
name="get_default",
|
|
682
|
+
params=(),
|
|
683
|
+
body=(Line.join("return ", field.type.default_expr()),),
|
|
684
|
+
)
|
|
685
|
+
object.__setattr__(default, attribute, get_field_default())
|
|
686
|
+
object.__setattr__(default, "_array_len", 0)
|
|
687
|
+
|
|
688
|
+
|
|
677
689
|
def _make_mutable_getter(field: _Field) -> Callable[[Any], Any]:
|
|
678
690
|
# Two cases: the field either has struct type or array type.
|
|
679
691
|
attribute = field.field.attribute
|
|
@@ -259,6 +259,26 @@ class ModuleInitializerTestCase(unittest.TestCase):
|
|
|
259
259
|
),
|
|
260
260
|
),
|
|
261
261
|
),
|
|
262
|
+
spec.Struct(
|
|
263
|
+
id="my/module.soia:RecOuter",
|
|
264
|
+
fields=(
|
|
265
|
+
spec.Field(
|
|
266
|
+
name="r",
|
|
267
|
+
number=0,
|
|
268
|
+
type="my/module.soia:RecOuter.RecInner",
|
|
269
|
+
),
|
|
270
|
+
),
|
|
271
|
+
),
|
|
272
|
+
spec.Struct(
|
|
273
|
+
id="my/module.soia:RecOuter.RecInner",
|
|
274
|
+
fields=(
|
|
275
|
+
spec.Field(
|
|
276
|
+
name="r",
|
|
277
|
+
number=0,
|
|
278
|
+
type="my/module.soia:RecOuter",
|
|
279
|
+
),
|
|
280
|
+
),
|
|
281
|
+
),
|
|
262
282
|
),
|
|
263
283
|
methods=(
|
|
264
284
|
spec.Method(
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|