soia-client 1.0.9__tar.gz → 1.0.10__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.

Files changed (30) hide show
  1. {soia_client-1.0.9 → soia_client-1.0.10}/PKG-INFO +1 -1
  2. {soia_client-1.0.9 → soia_client-1.0.10}/pyproject.toml +1 -1
  3. {soia_client-1.0.9 → soia_client-1.0.10}/soia_client.egg-info/PKG-INFO +1 -1
  4. {soia_client-1.0.9 → soia_client-1.0.10}/soialib/impl/arrays.py +2 -2
  5. {soia_client-1.0.9 → soia_client-1.0.10}/soialib/impl/structs.py +2 -0
  6. {soia_client-1.0.9 → soia_client-1.0.10}/tests/test_module_initializer.py +23 -0
  7. {soia_client-1.0.9 → soia_client-1.0.10}/LICENSE +0 -0
  8. {soia_client-1.0.9 → soia_client-1.0.10}/README +0 -0
  9. {soia_client-1.0.9 → soia_client-1.0.10}/setup.cfg +0 -0
  10. {soia_client-1.0.9 → soia_client-1.0.10}/soia_client.egg-info/SOURCES.txt +0 -0
  11. {soia_client-1.0.9 → soia_client-1.0.10}/soia_client.egg-info/dependency_links.txt +0 -0
  12. {soia_client-1.0.9 → soia_client-1.0.10}/soia_client.egg-info/top_level.txt +0 -0
  13. {soia_client-1.0.9 → soia_client-1.0.10}/soialib/__init__.py +0 -0
  14. {soia_client-1.0.9 → soia_client-1.0.10}/soialib/impl/__init__.py +0 -0
  15. {soia_client-1.0.9 → soia_client-1.0.10}/soialib/impl/enums.py +0 -0
  16. {soia_client-1.0.9 → soia_client-1.0.10}/soialib/impl/function_maker.py +0 -0
  17. {soia_client-1.0.9 → soia_client-1.0.10}/soialib/impl/optionals.py +0 -0
  18. {soia_client-1.0.9 → soia_client-1.0.10}/soialib/impl/primitives.py +0 -0
  19. {soia_client-1.0.9 → soia_client-1.0.10}/soialib/impl/repr.py +0 -0
  20. {soia_client-1.0.9 → soia_client-1.0.10}/soialib/impl/type_adapter.py +0 -0
  21. {soia_client-1.0.9 → soia_client-1.0.10}/soialib/keyed_items.py +0 -0
  22. {soia_client-1.0.9 → soia_client-1.0.10}/soialib/method.py +0 -0
  23. {soia_client-1.0.9 → soia_client-1.0.10}/soialib/module_initializer.py +0 -0
  24. {soia_client-1.0.9 → soia_client-1.0.10}/soialib/never.py +0 -0
  25. {soia_client-1.0.9 → soia_client-1.0.10}/soialib/serializer.py +0 -0
  26. {soia_client-1.0.9 → soia_client-1.0.10}/soialib/serializers.py +0 -0
  27. {soia_client-1.0.9 → soia_client-1.0.10}/soialib/spec.py +0 -0
  28. {soia_client-1.0.9 → soia_client-1.0.10}/soialib/timestamp.py +0 -0
  29. {soia_client-1.0.9 → soia_client-1.0.10}/tests/test_serializers.py +0 -0
  30. {soia_client-1.0.9 → soia_client-1.0.10}/tests/test_timestamp.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: soia-client
3
- Version: 1.0.9
3
+ Version: 1.0.10
4
4
  Author-email: Tyler Fibonacci <gepheum@gmail.com>
5
5
  License: MIT License
6
6
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "soia-client"
7
- version = "1.0.9"
7
+ version = "1.0.10"
8
8
  description = ""
9
9
  readme = "README.md"
10
10
  authors = [{ name = "Tyler Fibonacci", email = "gepheum@gmail.com" }]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: soia-client
3
- Version: 1.0.9
3
+ Version: 1.0.10
4
4
  Author-email: Tyler Fibonacci <gepheum@gmail.com>
5
5
  License: MIT License
6
6
 
@@ -118,14 +118,14 @@ def _new_listuple_class() -> type:
118
118
  return Listuple
119
119
 
120
120
 
121
- def _new_keyed_items_class(attributes: tuple[str, ...], default_expr: ExprLike):
121
+ def _new_keyed_items_class(key_attributes: tuple[str, ...], default_expr: ExprLike):
122
122
  key_items = make_function(
123
123
  name="key_items",
124
124
  params=["items"],
125
125
  body=[
126
126
  "ret = {}",
127
127
  "for item in items:",
128
- f" ret[item.{'.'.join(attributes)}] = item",
128
+ f" ret[item.{'.'.join(key_attributes)}] = item",
129
129
  "return ret",
130
130
  ],
131
131
  )
@@ -457,6 +457,8 @@ def _make_eq_fn(
457
457
  """
458
458
 
459
459
  builder = BodyBuilder()
460
+ builder.append_ln("if other is self:")
461
+ builder.append_ln(" return True")
460
462
  builder.append_ln("if other.__class__ is self.__class__:")
461
463
  operands: list[ExprLike]
462
464
  if fields:
@@ -294,6 +294,21 @@ class ModuleInitializerTestCase(unittest.TestCase):
294
294
  ),
295
295
  ),
296
296
  ),
297
+ spec.Struct(
298
+ id="my/module.soia:Rec",
299
+ fields=(
300
+ spec.Field(
301
+ name="r",
302
+ number=0,
303
+ type="my/module.soia:Rec",
304
+ ),
305
+ spec.Field(
306
+ name="x",
307
+ number=1,
308
+ type=spec.PrimitiveType.INT32,
309
+ ),
310
+ ),
311
+ ),
297
312
  spec.Struct(
298
313
  id="my/module.soia:Foobar",
299
314
  fields=(
@@ -530,6 +545,14 @@ class ModuleInitializerTestCase(unittest.TestCase):
530
545
  self.assertEqual(serializer.to_json_code(foobar), "[0,0,0,0,[2.0]]")
531
546
  self.assertEqual(serializer.from_json_code("[0,0,0,0,[2.0]]"), foobar)
532
547
 
548
+ def test_recursive_struct(self):
549
+ rec_cls = self.init_test_module()["Rec"]
550
+ r = rec_cls(r=rec_cls(r=rec_cls.DEFAULT, x=1))
551
+ serializer = rec_cls.SERIALIZER
552
+ self.assertEqual(serializer.to_json_code(r), "[[[],1]]")
553
+ self.assertEqual(serializer.from_json_code("[[[],1]]"), r)
554
+ self.assertEqual(str(r), "Rec(\n r=Rec(x=1),\n)")
555
+
533
556
  def test_struct_ctor_accepts_mutable_struct(self):
534
557
  module = self.init_test_module()
535
558
  segment_cls = module["Segment"]
File without changes
File without changes
File without changes