soia-client 1.0.5__py3-none-any.whl → 1.0.7__py3-none-any.whl

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.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: soia-client
3
- Version: 1.0.5
3
+ Version: 1.0.7
4
4
  Author-email: Tyler Fibonacci <gepheum@gmail.com>
5
5
  License: MIT License
6
6
 
@@ -15,10 +15,10 @@ soialib/impl/function_maker.py,sha256=PYqHqnZf8nELfEnRcoyyUbPAHyr99ROHhmHGj9ldB6
15
15
  soialib/impl/optionals.py,sha256=QUcxx0i7oAQl7IcnxKyNW11xi7fbs2hmuSP1pfrTSTY,2120
16
16
  soialib/impl/primitives.py,sha256=X_ywRmVZI_Q5tatb1Qil6Xvdyh1J4ElfI-LOCn671Zk,5975
17
17
  soialib/impl/repr.py,sha256=z-_jGNKuY__DfwQKW40xzZFf_eG6wGMJvuY_2hJrETA,1441
18
- soialib/impl/structs.py,sha256=pXPn6SeyZH-FwQXbvUG_uoc5DZ8oZgDQ5v_jx8Uf5aY,23576
18
+ soialib/impl/structs.py,sha256=vkOklmPzvWyFLFkMYbuDF8Rv_lkhzA66J-Uo9FJcVQc,24028
19
19
  soialib/impl/type_adapter.py,sha256=IP3jF3wPgwKhWd7LKMmbbv1qUTv1HBAyMdpVrIg0_S0,2063
20
- soia_client-1.0.5.dist-info/LICENSE,sha256=SaAftKkX6hfSOiPdENQPS70tifH3PDHgazq8eK2Pwfw,1064
21
- soia_client-1.0.5.dist-info/METADATA,sha256=JWD4wSPRLd1uz_nCM37-Y2DAKnf_5gO-QcHye3hYmMw,1645
22
- soia_client-1.0.5.dist-info/WHEEL,sha256=OVMc5UfuAQiSplgO0_WdW7vXVGAt9Hdd6qtN4HotdyA,91
23
- soia_client-1.0.5.dist-info/top_level.txt,sha256=2vPmAo5G0SrCxYrNdJKJJVdpalYppgjO2mmz2PtsFUI,8
24
- soia_client-1.0.5.dist-info/RECORD,,
20
+ soia_client-1.0.7.dist-info/LICENSE,sha256=SaAftKkX6hfSOiPdENQPS70tifH3PDHgazq8eK2Pwfw,1064
21
+ soia_client-1.0.7.dist-info/METADATA,sha256=s5Ll-b2a11xX7z7c1yWbXt1-zu4BZEh9ZxOP5y8jXsA,1645
22
+ soia_client-1.0.7.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
23
+ soia_client-1.0.7.dist-info/top_level.txt,sha256=2vPmAo5G0SrCxYrNdJKJJVdpalYppgjO2mmz2PtsFUI,8
24
+ soia_client-1.0.7.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.2.0)
2
+ Generator: setuptools (75.3.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
soialib/impl/structs.py CHANGED
@@ -146,7 +146,7 @@ class StructAdapter(TypeAdapter):
146
146
  )
147
147
 
148
148
  # Initialize DEFAULT.
149
- self.gen_class.DEFAULT.__init__()
149
+ _init_default(self.gen_class.DEFAULT, fields)
150
150
 
151
151
  # Define mutable getters
152
152
  for field in fields:
@@ -230,7 +230,7 @@ def _make_frozen_class_init_fn(
230
230
  """
231
231
 
232
232
  # Set the params.
233
- params: Params = ["self"]
233
+ params: Params = ["_self"]
234
234
  for field in fields:
235
235
  params.append(
236
236
  Param(
@@ -254,7 +254,7 @@ def _make_frozen_class_init_fn(
254
254
  f"{field.field.number + 1} if ",
255
255
  field.type.is_not_default_expr(
256
256
  arg_expr=field.field.attribute,
257
- attr_expr=f"self.{field.field.attribute}",
257
+ attr_expr=f"_self.{field.field.attribute}",
258
258
  ),
259
259
  " else ",
260
260
  )
@@ -269,7 +269,7 @@ def _make_frozen_class_init_fn(
269
269
  attribute = field.field.attribute
270
270
  builder.append_ln(
271
271
  obj_setattr,
272
- '(self, "',
272
+ '(_self, "',
273
273
  attribute,
274
274
  '", ',
275
275
  field.type.to_frozen_expr(attribute),
@@ -278,7 +278,7 @@ def _make_frozen_class_init_fn(
278
278
  # Set array length.
279
279
  builder.append_ln(
280
280
  obj_setattr,
281
- f'(self, "_array_len", ',
281
+ f'(_self, "_array_len", ',
282
282
  array_len_expr(),
283
283
  ")",
284
284
  )
@@ -288,22 +288,22 @@ def _make_frozen_class_init_fn(
288
288
  # with regular assignment, and then change back the __class__ attribute.
289
289
  builder.append_ln(
290
290
  obj_setattr,
291
- '(self, "__class__", ',
291
+ '(_self, "__class__", ',
292
292
  Expr.local("Simple", simple_class),
293
293
  ")",
294
294
  )
295
295
  for field in fields:
296
296
  attribute = field.field.attribute
297
297
  builder.append_ln(
298
- "self.",
298
+ "_self.",
299
299
  attribute,
300
300
  " = ",
301
301
  field.type.to_frozen_expr(attribute),
302
302
  )
303
303
  # Set array length.
304
- builder.append_ln(f"self._array_len = ", array_len_expr())
304
+ builder.append_ln(f"_self._array_len = ", array_len_expr())
305
305
  # Change back the __class__.
306
- builder.append_ln("self.__class__ = ", Expr.local("Frozen", frozen_class))
306
+ builder.append_ln("_self.__class__ = ", Expr.local("Frozen", frozen_class))
307
307
 
308
308
  return make_function(
309
309
  name="__init__",
@@ -317,7 +317,7 @@ def _make_mutable_class_init_fn(fields: Sequence[_Field]) -> Callable[[Any], Non
317
317
  Returns the implementation of the __init__() method of the mutable class.
318
318
  """
319
319
 
320
- params: Params = ["self"]
320
+ params: Params = ["_self"]
321
321
  builder = BodyBuilder()
322
322
  for field in fields:
323
323
  attribute = field.field.attribute
@@ -328,7 +328,7 @@ def _make_mutable_class_init_fn(fields: Sequence[_Field]) -> Callable[[Any], Non
328
328
  )
329
329
  )
330
330
  builder.append_ln(
331
- "self.",
331
+ "_self.",
332
332
  attribute,
333
333
  " = ",
334
334
  attribute,
@@ -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