soia-client 1.0.29__tar.gz → 1.0.30__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.29 → soia_client-1.0.30}/PKG-INFO +1 -1
- {soia_client-1.0.29 → soia_client-1.0.30}/pyproject.toml +1 -1
- {soia_client-1.0.29 → soia_client-1.0.30}/soia/_impl/primitives.py +7 -6
- {soia_client-1.0.29 → soia_client-1.0.30}/soia_client.egg-info/PKG-INFO +1 -1
- {soia_client-1.0.29 → soia_client-1.0.30}/tests/test_module_initializer.py +3 -4
- {soia_client-1.0.29 → soia_client-1.0.30}/LICENSE +0 -0
- {soia_client-1.0.29 → soia_client-1.0.30}/README.md +0 -0
- {soia_client-1.0.29 → soia_client-1.0.30}/setup.cfg +0 -0
- {soia_client-1.0.29 → soia_client-1.0.30}/soia/__init__.py +0 -0
- {soia_client-1.0.29 → soia_client-1.0.30}/soia/_impl/__init__.py +0 -0
- {soia_client-1.0.29 → soia_client-1.0.30}/soia/_impl/arrays.py +0 -0
- {soia_client-1.0.29 → soia_client-1.0.30}/soia/_impl/enums.py +0 -0
- {soia_client-1.0.29 → soia_client-1.0.30}/soia/_impl/function_maker.py +0 -0
- {soia_client-1.0.29 → soia_client-1.0.30}/soia/_impl/keyed_items.py +0 -0
- {soia_client-1.0.29 → soia_client-1.0.30}/soia/_impl/method.py +0 -0
- {soia_client-1.0.29 → soia_client-1.0.30}/soia/_impl/never.py +0 -0
- {soia_client-1.0.29 → soia_client-1.0.30}/soia/_impl/optionals.py +0 -0
- {soia_client-1.0.29 → soia_client-1.0.30}/soia/_impl/repr.py +0 -0
- {soia_client-1.0.29 → soia_client-1.0.30}/soia/_impl/serializer.py +0 -0
- {soia_client-1.0.29 → soia_client-1.0.30}/soia/_impl/serializers.py +0 -0
- {soia_client-1.0.29 → soia_client-1.0.30}/soia/_impl/service.py +0 -0
- {soia_client-1.0.29 → soia_client-1.0.30}/soia/_impl/service_client.py +0 -0
- {soia_client-1.0.29 → soia_client-1.0.30}/soia/_impl/structs.py +0 -0
- {soia_client-1.0.29 → soia_client-1.0.30}/soia/_impl/timestamp.py +0 -0
- {soia_client-1.0.29 → soia_client-1.0.30}/soia/_impl/type_adapter.py +0 -0
- {soia_client-1.0.29 → soia_client-1.0.30}/soia/_module_initializer.py +0 -0
- {soia_client-1.0.29 → soia_client-1.0.30}/soia/_spec.py +0 -0
- {soia_client-1.0.29 → soia_client-1.0.30}/soia/reflection.py +0 -0
- {soia_client-1.0.29 → soia_client-1.0.30}/soia_client.egg-info/SOURCES.txt +0 -0
- {soia_client-1.0.29 → soia_client-1.0.30}/soia_client.egg-info/dependency_links.txt +0 -0
- {soia_client-1.0.29 → soia_client-1.0.30}/soia_client.egg-info/top_level.txt +0 -0
- {soia_client-1.0.29 → soia_client-1.0.30}/tests/test_serializers.py +0 -0
- {soia_client-1.0.29 → soia_client-1.0.30}/tests/test_timestamp.py +0 -0
|
@@ -1,13 +1,13 @@
|
|
|
1
|
+
import base64
|
|
1
2
|
from collections.abc import Callable
|
|
2
3
|
from dataclasses import dataclass
|
|
3
4
|
from typing import Any, Final, final
|
|
4
5
|
|
|
6
|
+
from soia import _spec, reflection
|
|
5
7
|
from soia._impl.function_maker import Expr, ExprLike
|
|
6
8
|
from soia._impl.timestamp import Timestamp
|
|
7
9
|
from soia._impl.type_adapter import TypeAdapter
|
|
8
10
|
|
|
9
|
-
from soia import _spec, reflection
|
|
10
|
-
|
|
11
11
|
|
|
12
12
|
class AbstractPrimitiveAdapter(TypeAdapter):
|
|
13
13
|
@final
|
|
@@ -280,8 +280,6 @@ STRING_ADAPTER: Final[TypeAdapter] = _StringAdapter()
|
|
|
280
280
|
|
|
281
281
|
|
|
282
282
|
class _BytesAdapter(AbstractPrimitiveAdapter):
|
|
283
|
-
_fromhex_fn: Final = bytes.fromhex
|
|
284
|
-
|
|
285
283
|
def default_expr(self) -> ExprLike:
|
|
286
284
|
return 'b""'
|
|
287
285
|
|
|
@@ -296,11 +294,14 @@ class _BytesAdapter(AbstractPrimitiveAdapter):
|
|
|
296
294
|
in_expr: ExprLike,
|
|
297
295
|
readable: bool,
|
|
298
296
|
) -> Expr:
|
|
299
|
-
return Expr.join(
|
|
297
|
+
return Expr.join(
|
|
298
|
+
Expr.local("b64encode", base64.b64encode),
|
|
299
|
+
"(", in_expr, ").decode('utf-8')",
|
|
300
|
+
)
|
|
300
301
|
|
|
301
302
|
def from_json_expr(self, json_expr: ExprLike) -> Expr:
|
|
302
303
|
return Expr.join(
|
|
303
|
-
Expr.local("
|
|
304
|
+
Expr.local("b64decode", base64.b64decode), "(", json_expr, ' or "")'
|
|
304
305
|
)
|
|
305
306
|
|
|
306
307
|
def get_type(self) -> reflection.Type:
|
|
@@ -2,11 +2,10 @@ import dataclasses
|
|
|
2
2
|
import unittest
|
|
3
3
|
from typing import Any
|
|
4
4
|
|
|
5
|
+
from soia import KeyedItems, Method, Timestamp, _spec
|
|
5
6
|
from soia._module_initializer import init_module
|
|
6
7
|
from soia.reflection import TypeDescriptor
|
|
7
8
|
|
|
8
|
-
from soia import KeyedItems, Method, Timestamp, _spec
|
|
9
|
-
|
|
10
9
|
|
|
11
10
|
class ModuleInitializerTestCase(unittest.TestCase):
|
|
12
11
|
def init_test_module(self) -> dict[str, Any]:
|
|
@@ -423,7 +422,7 @@ class ModuleInitializerTestCase(unittest.TestCase):
|
|
|
423
422
|
u64=3,
|
|
424
423
|
t=Timestamp.from_unix_millis(4),
|
|
425
424
|
)
|
|
426
|
-
self.assertEqual(serializer.to_json(p), [1, "
|
|
425
|
+
self.assertEqual(serializer.to_json(p), [1, "YQ==", 3.14, 3.14, 1, 2, 3, "", 4])
|
|
427
426
|
|
|
428
427
|
def test_primitives_from_json(self):
|
|
429
428
|
primitives_cls = self.init_test_module()["Primitives"]
|
|
@@ -431,7 +430,7 @@ class ModuleInitializerTestCase(unittest.TestCase):
|
|
|
431
430
|
json = [0] * 100
|
|
432
431
|
self.assertEqual(serializer.from_json(json), primitives_cls.DEFAULT)
|
|
433
432
|
self.assertEqual(
|
|
434
|
-
serializer.from_json([1, "
|
|
433
|
+
serializer.from_json([1, "YQ==", 3.14, 3.14, 1, 2, 3, "", 4]),
|
|
435
434
|
primitives_cls(
|
|
436
435
|
bool=True,
|
|
437
436
|
bytes=b"a",
|
|
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
|
|
File without changes
|
|
File without changes
|