omlish 0.0.0.dev58__py3-none-any.whl → 0.0.0.dev59__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.
- omlish/__about__.py +2 -2
- omlish/marshal/__init__.py +10 -5
- omlish/marshal/nop.py +18 -0
- omlish/marshal/primitives.py +16 -6
- {omlish-0.0.0.dev58.dist-info → omlish-0.0.0.dev59.dist-info}/METADATA +1 -1
- {omlish-0.0.0.dev58.dist-info → omlish-0.0.0.dev59.dist-info}/RECORD +10 -9
- {omlish-0.0.0.dev58.dist-info → omlish-0.0.0.dev59.dist-info}/LICENSE +0 -0
- {omlish-0.0.0.dev58.dist-info → omlish-0.0.0.dev59.dist-info}/WHEEL +0 -0
- {omlish-0.0.0.dev58.dist-info → omlish-0.0.0.dev59.dist-info}/entry_points.txt +0 -0
- {omlish-0.0.0.dev58.dist-info → omlish-0.0.0.dev59.dist-info}/top_level.txt +0 -0
omlish/__about__.py
CHANGED
omlish/marshal/__init__.py
CHANGED
@@ -39,11 +39,6 @@ from .forbidden import ( # noqa
|
|
39
39
|
ForbiddenTypeUnmarshalerFactory,
|
40
40
|
)
|
41
41
|
|
42
|
-
from .naming import ( # noqa
|
43
|
-
Naming,
|
44
|
-
translate_name,
|
45
|
-
)
|
46
|
-
|
47
42
|
from .global_ import ( # noqa
|
48
43
|
GLOBAL_REGISTRY,
|
49
44
|
|
@@ -57,6 +52,16 @@ from .helpers import ( # noqa
|
|
57
52
|
update_object_metadata,
|
58
53
|
)
|
59
54
|
|
55
|
+
from .naming import ( # noqa
|
56
|
+
Naming,
|
57
|
+
translate_name,
|
58
|
+
)
|
59
|
+
|
60
|
+
from .nop import ( # noqa
|
61
|
+
NOP_MARSHALER_UNMARSHALER,
|
62
|
+
NopMarshalerUnmarshaler,
|
63
|
+
)
|
64
|
+
|
60
65
|
from .objects import ( # noqa
|
61
66
|
FieldInfo,
|
62
67
|
FieldInfos,
|
omlish/marshal/nop.py
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
import typing as ta
|
2
|
+
|
3
|
+
from .base import MarshalContext
|
4
|
+
from .base import Marshaler
|
5
|
+
from .base import UnmarshalContext
|
6
|
+
from .base import Unmarshaler
|
7
|
+
from .values import Value
|
8
|
+
|
9
|
+
|
10
|
+
class NopMarshalerUnmarshaler(Marshaler, Unmarshaler):
|
11
|
+
def marshal(self, ctx: MarshalContext, o: ta.Any) -> Value:
|
12
|
+
return o # noqa
|
13
|
+
|
14
|
+
def unmarshal(self, ctx: UnmarshalContext, v: Value) -> ta.Any:
|
15
|
+
return v
|
16
|
+
|
17
|
+
|
18
|
+
NOP_MARSHALER_UNMARSHALER = NopMarshalerUnmarshaler()
|
omlish/marshal/primitives.py
CHANGED
@@ -1,5 +1,10 @@
|
|
1
|
+
"""
|
2
|
+
TODO:
|
3
|
+
- field-configurable coercion
|
4
|
+
"""
|
1
5
|
import typing as ta
|
2
6
|
|
7
|
+
from .. import dataclasses as dc
|
3
8
|
from .base import MarshalContext
|
4
9
|
from .base import Marshaler
|
5
10
|
from .base import TypeMapMarshalerFactory
|
@@ -25,24 +30,29 @@ PRIMITIVE_TYPES: tuple[type, ...] = (
|
|
25
30
|
##
|
26
31
|
|
27
32
|
|
33
|
+
@dc.dataclass(frozen=True)
|
28
34
|
class PrimitiveMarshalerUnmarshaler(Marshaler, Unmarshaler):
|
35
|
+
ty: type
|
36
|
+
|
29
37
|
def marshal(self, ctx: MarshalContext, o: ta.Any) -> Value:
|
30
|
-
if isinstance(o,
|
38
|
+
if isinstance(o, self.ty):
|
31
39
|
return o # type: ignore
|
40
|
+
if isinstance(o, PRIMITIVE_TYPES):
|
41
|
+
return self.ty(o)
|
32
42
|
raise TypeError(o)
|
33
43
|
|
34
44
|
def unmarshal(self, ctx: UnmarshalContext, v: Value) -> ta.Any:
|
35
|
-
if isinstance(v,
|
45
|
+
if isinstance(v, self.ty):
|
36
46
|
return v
|
47
|
+
if isinstance(v, PRIMITIVE_TYPES):
|
48
|
+
return self.ty(v)
|
37
49
|
raise TypeError(v)
|
38
50
|
|
39
51
|
|
40
|
-
PRIMITIVE_MARSHALER_UNMARSHALER = PrimitiveMarshalerUnmarshaler()
|
41
|
-
|
42
52
|
PRIMITIVE_MARSHALER_FACTORY = TypeMapMarshalerFactory({ # noqa
|
43
|
-
t:
|
53
|
+
t: PrimitiveMarshalerUnmarshaler(t) for t in PRIMITIVE_TYPES
|
44
54
|
})
|
45
55
|
|
46
56
|
PRIMITIVE_UNMARSHALER_FACTORY = TypeMapUnmarshalerFactory({ # noqa
|
47
|
-
t:
|
57
|
+
t: PrimitiveMarshalerUnmarshaler(t) for t in PRIMITIVE_TYPES
|
48
58
|
})
|
@@ -1,5 +1,5 @@
|
|
1
1
|
omlish/.manifests.json,sha256=wTGXwNmvtaKsDWtTwwj3Uib5Inaj8ZBn0MB69bE80X4,1419
|
2
|
-
omlish/__about__.py,sha256=
|
2
|
+
omlish/__about__.py,sha256=t66E-GURVsnkjRDYrn6EsT04bijeOMPMW4sjivdIPig,3420
|
3
3
|
omlish/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
4
4
|
omlish/argparse.py,sha256=Vr70_85EVLJLgEkRtwOr264tMRtqtlN7ncFfXRUk5aM,6914
|
5
5
|
omlish/c3.py,sha256=4vogWgwPb8TbNS2KkZxpoWbwjj7MuHG2lQG-hdtkvjI,8062
|
@@ -286,7 +286,7 @@ omlish/logs/formatters.py,sha256=q79nMnR2mRIStPyGrydQHpYTXgC5HHptt8lH3W2Wwbs,671
|
|
286
286
|
omlish/logs/handlers.py,sha256=nyuFgmO05By_Xwq7es58ClzS51-F53lJL7gD0x5IqAg,228
|
287
287
|
omlish/logs/noisy.py,sha256=Ubc-eTH6ZbGYsLfUUi69JAotwuUwzb-SJBeGo_0dIZI,348
|
288
288
|
omlish/logs/utils.py,sha256=MgGovbP0zUrZ3FGD3qYNQWn-l0jy0Y0bStcQvv5BOmQ,391
|
289
|
-
omlish/marshal/__init__.py,sha256=
|
289
|
+
omlish/marshal/__init__.py,sha256=G0MDeBStBjz9Njq-rt5C6WbuCik6c8st7cipwMVw668,2139
|
290
290
|
omlish/marshal/any.py,sha256=e82OyYK3Emm1P1ClnsnxP7fIWC2iNVyW0H5nK4mLmWM,779
|
291
291
|
omlish/marshal/base.py,sha256=I7IOzFGn_DFeBRFCH8F0ONBa-NzM4mmMDld6bmoW-rc,6501
|
292
292
|
omlish/marshal/base64.py,sha256=F-3ogJdcFCtWINRgJgWT0rErqgx6f4qahhcg8OrkqhE,1089
|
@@ -302,11 +302,12 @@ omlish/marshal/iterables.py,sha256=6I_ZdJemLSQtJ4J5NrB9wi-eyxiJZS61HzHXp1yeiX8,2
|
|
302
302
|
omlish/marshal/mappings.py,sha256=zhLtyot7tzQtBNj7C4RBxjMELxA5r2q2Mth8Br7xkFs,2803
|
303
303
|
omlish/marshal/maybes.py,sha256=mgK3QsWHkXgRqo076KxYKH6elRxzJ_QDTodv93mgHR0,2198
|
304
304
|
omlish/marshal/naming.py,sha256=lIklR_Od4x1ghltAgOzqcKhHs-leeSv2YmFhCHO7GIs,613
|
305
|
+
omlish/marshal/nop.py,sha256=2mWve_dicFAiUQ2Y5asKkUW-XGmEE9Qi2ClIasFad0c,461
|
305
306
|
omlish/marshal/numbers.py,sha256=oY_yMNJEnJhjfLh89gpPXvKqeUyhQcaTcQB6ecyHiG8,1704
|
306
307
|
omlish/marshal/objects.py,sha256=8-w4Vc222gGGmTiTnUIIZBe1XXdAy0yo9aa1ZUAi1b4,8435
|
307
308
|
omlish/marshal/optionals.py,sha256=r0XB5rqfasvgZJNrKYd6Unq2U4nHt3JURi26j0dYHlw,1499
|
308
309
|
omlish/marshal/polymorphism.py,sha256=doA8aLUhna6aco5b2Ok3jsem1V4NsF3rM5RTfJt0a7U,5708
|
309
|
-
omlish/marshal/primitives.py,sha256=
|
310
|
+
omlish/marshal/primitives.py,sha256=f_6m24Cb-FDGsZpYSas11nLt3xCCEUXugw3Hv4-aNhg,1291
|
310
311
|
omlish/marshal/registries.py,sha256=FvC6qXHCizNB2QmU_N3orxW7iqfGYkiUXYYdTRWS6HA,2353
|
311
312
|
omlish/marshal/standard.py,sha256=uQZIGiCwihmhB1tmhpKnZWZly0DDkdGjCnN0d41WHho,2985
|
312
313
|
omlish/marshal/unions.py,sha256=ZWl0maHwh1V_cSnNmuCbbCQZzqlNtOModsTwnVTXNPA,2735
|
@@ -406,9 +407,9 @@ omlish/text/delimit.py,sha256=ubPXcXQmtbOVrUsNh5gH1mDq5H-n1y2R4cPL5_DQf68,4928
|
|
406
407
|
omlish/text/glyphsplit.py,sha256=Ug-dPRO7x-OrNNr8g1y6DotSZ2KH0S-VcOmUobwa4B0,3296
|
407
408
|
omlish/text/indent.py,sha256=6Jj6TFY9unaPa4xPzrnZemJ-fHsV53IamP93XGjSUHs,1274
|
408
409
|
omlish/text/parts.py,sha256=7vPF1aTZdvLVYJ4EwBZVzRSy8XB3YqPd7JwEnNGGAOo,6495
|
409
|
-
omlish-0.0.0.
|
410
|
-
omlish-0.0.0.
|
411
|
-
omlish-0.0.0.
|
412
|
-
omlish-0.0.0.
|
413
|
-
omlish-0.0.0.
|
414
|
-
omlish-0.0.0.
|
410
|
+
omlish-0.0.0.dev59.dist-info/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
|
411
|
+
omlish-0.0.0.dev59.dist-info/METADATA,sha256=k7fwGFZLfmvFM8ALQDrVnGZ6KzO-ThQwJcmfIkg3Opk,4167
|
412
|
+
omlish-0.0.0.dev59.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
413
|
+
omlish-0.0.0.dev59.dist-info/entry_points.txt,sha256=Lt84WvRZJskWCAS7xnQGZIeVWksprtUHj0llrvVmod8,35
|
414
|
+
omlish-0.0.0.dev59.dist-info/top_level.txt,sha256=pePsKdLu7DvtUiecdYXJ78iO80uDNmBlqe-8hOzOmfs,7
|
415
|
+
omlish-0.0.0.dev59.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|