omlish 0.0.0.dev16__py3-none-any.whl → 0.0.0.dev18__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 -3
- omlish/asyncs/anyio.py +22 -12
- omlish/asyncs/flavors.py +4 -2
- omlish/marshal/base.py +6 -1
- omlish/multiprocessing.py +7 -3
- {omlish-0.0.0.dev16.dist-info → omlish-0.0.0.dev18.dist-info}/METADATA +1 -1
- {omlish-0.0.0.dev16.dist-info → omlish-0.0.0.dev18.dist-info}/RECORD +10 -10
- {omlish-0.0.0.dev16.dist-info → omlish-0.0.0.dev18.dist-info}/WHEEL +1 -1
- {omlish-0.0.0.dev16.dist-info → omlish-0.0.0.dev18.dist-info}/LICENSE +0 -0
- {omlish-0.0.0.dev16.dist-info → omlish-0.0.0.dev18.dist-info}/top_level.txt +0 -0
omlish/__about__.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
__version__ = '0.0.0.
|
2
|
-
__revision__ = '
|
1
|
+
__version__ = '0.0.0.dev18'
|
2
|
+
__revision__ = '534f2a8b308f6514a06a41bba629c71a05497327'
|
3
3
|
|
4
4
|
|
5
5
|
#
|
@@ -51,7 +51,6 @@ class Project(ProjectBase):
|
|
51
51
|
|
52
52
|
'formats': [
|
53
53
|
'orjson ~= 3.10',
|
54
|
-
# 'python-rapidjson ~= 1.18',
|
55
54
|
# 'ujson ~= 5.10',
|
56
55
|
|
57
56
|
'json5 ~= 0.9',
|
omlish/asyncs/anyio.py
CHANGED
@@ -37,6 +37,12 @@ from .. import lang
|
|
37
37
|
|
38
38
|
T = ta.TypeVar('T')
|
39
39
|
|
40
|
+
MemoryObjectReceiveStream: ta.TypeAlias = anyio.streams.memory.MemoryObjectReceiveStream
|
41
|
+
MemoryObjectSendStream: ta.TypeAlias = anyio.streams.memory.MemoryObjectSendStream
|
42
|
+
|
43
|
+
StapledByteStream: ta.TypeAlias = anyio.streams.stapled.StapledByteStream
|
44
|
+
StapledObjectStream: ta.TypeAlias = anyio.streams.stapled.StapledObjectStream
|
45
|
+
|
40
46
|
|
41
47
|
##
|
42
48
|
|
@@ -130,39 +136,43 @@ def get_current_backend_task() -> BackendTask | None:
|
|
130
136
|
def split_memory_object_streams(
|
131
137
|
*args: anyio.create_memory_object_stream[T],
|
132
138
|
) -> tuple[
|
133
|
-
|
134
|
-
|
139
|
+
MemoryObjectSendStream[T],
|
140
|
+
MemoryObjectReceiveStream[T],
|
135
141
|
]:
|
136
142
|
[tup] = args
|
137
143
|
return tup
|
138
144
|
|
139
145
|
|
146
|
+
def create_stapled_memory_object_stream(max_buffer_size: float = 0) -> StapledObjectStream:
|
147
|
+
return StapledObjectStream(*anyio.create_memory_object_stream(max_buffer_size))
|
148
|
+
|
149
|
+
|
140
150
|
# FIXME: https://github.com/python/mypy/issues/15238
|
141
151
|
# FIXME: https://youtrack.jetbrains.com/issues?q=tag:%20%7BPEP%20695%7D
|
142
152
|
def create_memory_object_stream[T](max_buffer_size: float = 0) -> tuple[
|
143
|
-
|
144
|
-
|
153
|
+
MemoryObjectSendStream[T],
|
154
|
+
MemoryObjectReceiveStream[T],
|
145
155
|
]:
|
146
156
|
return anyio.create_memory_object_stream[T](max_buffer_size) # noqa
|
147
157
|
|
148
158
|
|
149
159
|
def staple_memory_object_stream(
|
150
160
|
*args: anyio.create_memory_object_stream[T],
|
151
|
-
) ->
|
161
|
+
) -> StapledObjectStream[T]:
|
152
162
|
send, receive = args
|
153
|
-
return
|
154
|
-
check.isinstance(send,
|
155
|
-
check.isinstance(receive,
|
163
|
+
return StapledObjectStream(
|
164
|
+
check.isinstance(send, MemoryObjectSendStream), # type: ignore
|
165
|
+
check.isinstance(receive, MemoryObjectReceiveStream), # type: ignore
|
156
166
|
)
|
157
167
|
|
158
168
|
|
159
169
|
# FIXME: https://github.com/python/mypy/issues/15238
|
160
170
|
# FIXME: https://youtrack.jetbrains.com/issues?q=tag:%20%7BPEP%20695%7D
|
161
|
-
def staple_memory_object_stream2[T](max_buffer_size: float = 0) ->
|
171
|
+
def staple_memory_object_stream2[T](max_buffer_size: float = 0) -> StapledObjectStream[T]:
|
162
172
|
send, receive = anyio.create_memory_object_stream[T](max_buffer_size)
|
163
|
-
return
|
164
|
-
check.isinstance(send,
|
165
|
-
check.isinstance(receive,
|
173
|
+
return StapledObjectStream(
|
174
|
+
check.isinstance(send, MemoryObjectSendStream), # type: ignore
|
175
|
+
check.isinstance(receive, MemoryObjectReceiveStream), # type: ignore
|
166
176
|
)
|
167
177
|
|
168
178
|
|
omlish/asyncs/flavors.py
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
"""
|
2
|
+
Tools for working with the different async loop implementations - currently anyio, asyncio, trio.
|
3
|
+
|
2
4
|
TODO:
|
3
|
-
- 'get current'? -> sniffio..
|
4
5
|
- mark whole class / module?
|
5
|
-
- sync/greenlet bridge
|
6
6
|
"""
|
7
7
|
import abc
|
8
8
|
import dataclasses as dc
|
@@ -73,11 +73,13 @@ def _get_module_flavor(p: str) -> Flavor | None:
|
|
73
73
|
return _MODULE_FLAVOR_CACHE[p]
|
74
74
|
except KeyError:
|
75
75
|
pass
|
76
|
+
|
76
77
|
pf: Flavor | None = None
|
77
78
|
for cp, cf in PACKAGE_FLAVORS.items():
|
78
79
|
if p.startswith(cp) and (len(cp) == len(p) or p[len(cp)] == '.'):
|
79
80
|
pf = cf
|
80
81
|
break
|
82
|
+
|
81
83
|
_MODULE_FLAVOR_CACHE[p] = pf
|
82
84
|
return pf
|
83
85
|
|
omlish/marshal/base.py
CHANGED
@@ -6,7 +6,12 @@ TODO:
|
|
6
6
|
- strongly typed Composite/Cached Marshaler/Unmarshaler factories - footgun
|
7
7
|
- streaming? Start/EndObject, etc..
|
8
8
|
|
9
|
-
|
9
|
+
See:
|
10
|
+
- https://github.com/python-attrs/cattrs
|
11
|
+
- https://github.com/jcrist/msgspec
|
12
|
+
- https://github.com/Fatal1ty/mashumaro
|
13
|
+
|
14
|
+
cattrs:
|
10
15
|
*
|
11
16
|
|
12
17
|
Jackson:
|
omlish/multiprocessing.py
CHANGED
@@ -35,6 +35,7 @@ class ExtrasSpawnPosixPopen(mp.popen_spawn_posix.Popen):
|
|
35
35
|
for fd in self.__extra_fds:
|
36
36
|
self.duplicate_for_child(fd)
|
37
37
|
self._extra_fds = None
|
38
|
+
|
38
39
|
super()._launch(process_obj) # type: ignore # noqa
|
39
40
|
|
40
41
|
|
@@ -44,7 +45,10 @@ class ExtrasSpawnProcess(mp.context.SpawnProcess):
|
|
44
45
|
super().__init__(*args, **kwargs)
|
45
46
|
|
46
47
|
def _Popen(self, process_obj: 'ExtrasSpawnProcess') -> ExtrasSpawnPosixPopen: # type: ignore # noqa
|
47
|
-
return ExtrasSpawnPosixPopen(
|
48
|
+
return ExtrasSpawnPosixPopen(
|
49
|
+
check.isinstance(process_obj, ExtrasSpawnProcess),
|
50
|
+
extras=self.__extras,
|
51
|
+
)
|
48
52
|
|
49
53
|
def run(self) -> None:
|
50
54
|
if self.__extras.deathsig is not None and sys.platform == 'linux':
|
@@ -55,8 +59,8 @@ class ExtrasSpawnProcess(mp.context.SpawnProcess):
|
|
55
59
|
|
56
60
|
class ExtrasSpawnContext(mp.context.SpawnContext):
|
57
61
|
def __init__(self, extras: SpawnExtras = SpawnExtras()) -> None:
|
58
|
-
super().__init__()
|
59
62
|
self.__extras = extras
|
63
|
+
super().__init__()
|
60
64
|
|
61
65
|
def Process(self, *args: ta.Any, **kwargs: ta.Any): # type: ignore # noqa
|
62
66
|
return ExtrasSpawnProcess(*args, extras=self.__extras, **kwargs)
|
@@ -141,7 +145,7 @@ class PipeDeathpact(BaseDeathpact):
|
|
141
145
|
return f'{self.__class__.__name__}(rfd={self._rfd}, wfd={self._wfd})'
|
142
146
|
|
143
147
|
@property
|
144
|
-
def
|
148
|
+
def pass_fd(self) -> int:
|
145
149
|
return check.not_none(self._rfd)
|
146
150
|
|
147
151
|
def __enter__(self) -> ta.Self:
|
@@ -1,4 +1,4 @@
|
|
1
|
-
omlish/__about__.py,sha256=
|
1
|
+
omlish/__about__.py,sha256=BE5Fsw4Q9RjSfGTc8O7N1wzWfQSAUneYgx7LPzm1PyU,2451
|
2
2
|
omlish/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
3
3
|
omlish/argparse.py,sha256=QRQmX9G0-L_nATkFtGHvpd4qrpYzKATdjuFLbBqzJPM,6224
|
4
4
|
omlish/bootstrap.py,sha256=ENqzMlNbZWEAc2hzM9QwEoruShcgE_M7bdzJF6_fJ9w,19121
|
@@ -15,18 +15,18 @@ omlish/iterators.py,sha256=GGLC7RIT86uXMjhIIIqnff_Iu5SI_b9rXYywYGFyzmo,7292
|
|
15
15
|
omlish/libc.py,sha256=u0481imCiTFqP_e-v9g0pD-0WD249j5vYzhtn-fnNkY,15308
|
16
16
|
omlish/matchfns.py,sha256=o2evI7q0CAMHR8RQ_Jks6L0UoNpEDltnLjOiamJDtmU,6155
|
17
17
|
omlish/math.py,sha256=AVqp5Y8yxKA-wO0BgrzaxA0Ga3PZiCXnYcwivMneC-0,3804
|
18
|
-
omlish/multiprocessing.py,sha256=
|
18
|
+
omlish/multiprocessing.py,sha256=J5ywVOl6TcWXCzgmnNUrD-gaXLZd9ozLTqfz66jiCfs,4685
|
19
19
|
omlish/os.py,sha256=cz4nL2ujaxH_-XRq3JUD8af8mSe1JXGPIoXP9XAEd0M,2607
|
20
20
|
omlish/runmodule.py,sha256=PWvuAaJ9wQQn6bx9ftEL3_d04DyotNn8dR_twm2pgw0,700
|
21
21
|
omlish/stats.py,sha256=uqjN-focDVssFZMagj22HqmyJ1TBO4Wt-XnHp8-EtVw,9927
|
22
22
|
omlish/sync.py,sha256=AqwIfIuCMVHLwlJUa7dmaSjfA4sM5AYPCD5-nsz3XVQ,1516
|
23
23
|
omlish/term.py,sha256=NEmxqAhicyInGtmFamZAizI2xdu819MzFYPEp0Fx97M,6111
|
24
24
|
omlish/asyncs/__init__.py,sha256=uUz9ziKh4_QrgmdhKFMgq6j7mFbiZd3LiogguDCQsGI,587
|
25
|
-
omlish/asyncs/anyio.py,sha256=
|
25
|
+
omlish/asyncs/anyio.py,sha256=6AruTkEXa3e4G1jgxfkYE36dQu8ihbh13u4up7OUW5k,7788
|
26
26
|
omlish/asyncs/asyncio.py,sha256=JfM59QgB3asgEbrps0zoVbNjWD4kL2XdsEkRMEIoFos,971
|
27
27
|
omlish/asyncs/asyncs.py,sha256=Tf7ZodTGepkM7HAuFcDNh9lLzzrMw6rELWvopGmFkh4,2035
|
28
28
|
omlish/asyncs/bridge.py,sha256=AabrRVz5k75dTB59M70DWkl6JrLusjhpvsaj5jld9io,8151
|
29
|
-
omlish/asyncs/flavors.py,sha256=
|
29
|
+
omlish/asyncs/flavors.py,sha256=1mNxGNRVmjUHzA13K5ht8vdJv4CLEmzYTQ6BZXr1520,4866
|
30
30
|
omlish/asyncs/trio.py,sha256=GKG3wgelFr7gIKKHZhcflvMyCvxXHNZe862KB0Xw2uA,370
|
31
31
|
omlish/asyncs/trio_asyncio.py,sha256=oqdOHy0slj9PjVxaDf3gJkq9AAgg7wYZbB469jOftVw,1327
|
32
32
|
omlish/collections/__init__.py,sha256=h7gXQNMI_46hRRlIAI3PTaewMV8H381FV_KlONReg9s,1660
|
@@ -197,7 +197,7 @@ omlish/logs/formatters.py,sha256=AFs9C6-qrFkgXZ0nL39wih_LGck1Tc79alvGyibBdQo,720
|
|
197
197
|
omlish/logs/utils.py,sha256=MgGovbP0zUrZ3FGD3qYNQWn-l0jy0Y0bStcQvv5BOmQ,391
|
198
198
|
omlish/marshal/__init__.py,sha256=ggU_UVW-CyXZnsaGwx-Cxj4PUAY0QsXmaXVLFO8T4rQ,1453
|
199
199
|
omlish/marshal/any.py,sha256=e82OyYK3Emm1P1ClnsnxP7fIWC2iNVyW0H5nK4mLmWM,779
|
200
|
-
omlish/marshal/base.py,sha256=
|
200
|
+
omlish/marshal/base.py,sha256=EIgrqsQ1OQ4mVUMuDH5zRBCwJpn8ijVS98Nmoka_Mrs,6025
|
201
201
|
omlish/marshal/base64.py,sha256=Q3ibujdhgFgDaeHahSe7WdcqvOyalWigwUlV-U-2ckQ,1018
|
202
202
|
omlish/marshal/dataclasses.py,sha256=PMAwBblcmCNVifDul0Vl09saBZ3BYEOIOJABZ2zc4Bg,3667
|
203
203
|
omlish/marshal/datetimes.py,sha256=0ffg8cEvx9SMKIXZGD9b7MqpLfmgw0uKKdn6YTfoqok,3714
|
@@ -262,8 +262,8 @@ omlish/text/delimit.py,sha256=ubPXcXQmtbOVrUsNh5gH1mDq5H-n1y2R4cPL5_DQf68,4928
|
|
262
262
|
omlish/text/glyphsplit.py,sha256=Ug-dPRO7x-OrNNr8g1y6DotSZ2KH0S-VcOmUobwa4B0,3296
|
263
263
|
omlish/text/indent.py,sha256=6Jj6TFY9unaPa4xPzrnZemJ-fHsV53IamP93XGjSUHs,1274
|
264
264
|
omlish/text/parts.py,sha256=KGgo0wHOIMVMZtDso-rhSWKAcAkYAH2IGpg9tULabu8,6505
|
265
|
-
omlish-0.0.0.
|
266
|
-
omlish-0.0.0.
|
267
|
-
omlish-0.0.0.
|
268
|
-
omlish-0.0.0.
|
269
|
-
omlish-0.0.0.
|
265
|
+
omlish-0.0.0.dev18.dist-info/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
|
266
|
+
omlish-0.0.0.dev18.dist-info/METADATA,sha256=fvDdyhwnkrKw7WKUw0oWqatsZkjB0kRpRXBQY-L3CPo,3718
|
267
|
+
omlish-0.0.0.dev18.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
|
268
|
+
omlish-0.0.0.dev18.dist-info/top_level.txt,sha256=pePsKdLu7DvtUiecdYXJ78iO80uDNmBlqe-8hOzOmfs,7
|
269
|
+
omlish-0.0.0.dev18.dist-info/RECORD,,
|
File without changes
|
File without changes
|