omlish 0.0.0.dev152__py3-none-any.whl → 0.0.0.dev154__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- omlish/__about__.py +2 -2
- omlish/asyncs/asyncio/__init__.py +0 -0
- omlish/asyncs/asyncio/all.py +7 -0
- omlish/asyncs/asyncio/channels.py +40 -0
- omlish/{lite/asyncio/asyncio.py → asyncs/asyncio/streams.py} +2 -20
- omlish/asyncs/asyncio/timeouts.py +16 -0
- omlish/lite/asyncio/subprocesses.py +16 -8
- omlish/testing/pytest/marks.py +2 -2
- {omlish-0.0.0.dev152.dist-info → omlish-0.0.0.dev154.dist-info}/METADATA +1 -1
- {omlish-0.0.0.dev152.dist-info → omlish-0.0.0.dev154.dist-info}/RECORD +15 -11
- /omlish/asyncs/{asyncio.py → asyncio/asyncio.py} +0 -0
- {omlish-0.0.0.dev152.dist-info → omlish-0.0.0.dev154.dist-info}/LICENSE +0 -0
- {omlish-0.0.0.dev152.dist-info → omlish-0.0.0.dev154.dist-info}/WHEEL +0 -0
- {omlish-0.0.0.dev152.dist-info → omlish-0.0.0.dev154.dist-info}/entry_points.txt +0 -0
- {omlish-0.0.0.dev152.dist-info → omlish-0.0.0.dev154.dist-info}/top_level.txt +0 -0
omlish/__about__.py
CHANGED
File without changes
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# ruff: noqa: UP006 UP007
|
2
|
+
# @omlish-lite
|
3
|
+
import asyncio
|
4
|
+
import typing as ta
|
5
|
+
|
6
|
+
|
7
|
+
class AsyncioBytesChannelTransport(asyncio.Transport):
|
8
|
+
def __init__(self, reader: asyncio.StreamReader) -> None:
|
9
|
+
super().__init__()
|
10
|
+
|
11
|
+
self.reader = reader
|
12
|
+
self.closed: asyncio.Future = asyncio.Future()
|
13
|
+
|
14
|
+
# @ta.override
|
15
|
+
def write(self, data: bytes) -> None:
|
16
|
+
self.reader.feed_data(data)
|
17
|
+
|
18
|
+
# @ta.override
|
19
|
+
def close(self) -> None:
|
20
|
+
self.reader.feed_eof()
|
21
|
+
if not self.closed.done():
|
22
|
+
self.closed.set_result(True)
|
23
|
+
|
24
|
+
# @ta.override
|
25
|
+
def is_closing(self) -> bool:
|
26
|
+
return self.closed.done()
|
27
|
+
|
28
|
+
|
29
|
+
def asyncio_create_bytes_channel(
|
30
|
+
loop: ta.Any = None,
|
31
|
+
) -> ta.Tuple[asyncio.StreamReader, asyncio.StreamWriter]:
|
32
|
+
if loop is None:
|
33
|
+
loop = asyncio.get_running_loop()
|
34
|
+
|
35
|
+
reader = asyncio.StreamReader()
|
36
|
+
protocol = asyncio.StreamReaderProtocol(reader)
|
37
|
+
transport = AsyncioBytesChannelTransport(reader)
|
38
|
+
writer = asyncio.StreamWriter(transport, protocol, reader, loop)
|
39
|
+
|
40
|
+
return reader, writer
|
@@ -1,15 +1,9 @@
|
|
1
1
|
# ruff: noqa: UP006 UP007
|
2
|
-
|
3
|
-
import asyncio
|
2
|
+
# @omlish-lite
|
3
|
+
import asyncio
|
4
4
|
import typing as ta
|
5
5
|
|
6
6
|
|
7
|
-
AwaitableT = ta.TypeVar('AwaitableT', bound=ta.Awaitable)
|
8
|
-
|
9
|
-
|
10
|
-
##
|
11
|
-
|
12
|
-
|
13
7
|
ASYNCIO_DEFAULT_BUFFER_LIMIT = 2 ** 16
|
14
8
|
|
15
9
|
|
@@ -49,15 +43,3 @@ async def asyncio_open_stream_writer(
|
|
49
43
|
None,
|
50
44
|
loop,
|
51
45
|
)
|
52
|
-
|
53
|
-
|
54
|
-
##
|
55
|
-
|
56
|
-
|
57
|
-
def asyncio_maybe_timeout(
|
58
|
-
fut: AwaitableT,
|
59
|
-
timeout: ta.Optional[float] = None,
|
60
|
-
) -> AwaitableT:
|
61
|
-
if timeout is not None:
|
62
|
-
fut = asyncio.wait_for(fut, timeout) # type: ignore
|
63
|
-
return fut
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# ruff: noqa: UP006 UP007
|
2
|
+
# @omlish-lite
|
3
|
+
import asyncio
|
4
|
+
import typing as ta
|
5
|
+
|
6
|
+
|
7
|
+
AwaitableT = ta.TypeVar('AwaitableT', bound=ta.Awaitable)
|
8
|
+
|
9
|
+
|
10
|
+
def asyncio_maybe_timeout(
|
11
|
+
fut: AwaitableT,
|
12
|
+
timeout: ta.Optional[float] = None,
|
13
|
+
) -> AwaitableT:
|
14
|
+
if timeout is not None:
|
15
|
+
fut = asyncio.wait_for(fut, timeout) # type: ignore
|
16
|
+
return fut
|
@@ -8,12 +8,12 @@ import subprocess
|
|
8
8
|
import sys
|
9
9
|
import typing as ta
|
10
10
|
|
11
|
+
from ...asyncs.asyncio.timeouts import asyncio_maybe_timeout
|
11
12
|
from ..check import check
|
12
13
|
from ..logs import log
|
13
14
|
from ..subprocesses import DEFAULT_SUBPROCESS_TRY_EXCEPTIONS
|
14
15
|
from ..subprocesses import prepare_subprocess_invocation
|
15
16
|
from ..subprocesses import subprocess_common_context
|
16
|
-
from .asyncio import asyncio_maybe_timeout
|
17
17
|
|
18
18
|
|
19
19
|
T = ta.TypeVar('T')
|
@@ -177,22 +177,25 @@ async def asyncio_subprocess_communicate(
|
|
177
177
|
return await AsyncioProcessCommunicator(proc).communicate(input, timeout) # noqa
|
178
178
|
|
179
179
|
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
async def _asyncio_subprocess_check_run(
|
180
|
+
async def asyncio_subprocess_run(
|
184
181
|
*args: str,
|
185
182
|
input: ta.Any = None, # noqa
|
186
183
|
timeout: ta.Optional[float] = None,
|
184
|
+
check: bool = False, # noqa
|
185
|
+
capture_output: ta.Optional[bool] = None,
|
187
186
|
**kwargs: ta.Any,
|
188
187
|
) -> ta.Tuple[ta.Optional[bytes], ta.Optional[bytes]]:
|
188
|
+
if capture_output:
|
189
|
+
kwargs.setdefault('stdout', subprocess.PIPE)
|
190
|
+
kwargs.setdefault('stderr', subprocess.PIPE)
|
191
|
+
|
189
192
|
args, kwargs = prepare_subprocess_invocation(*args, **kwargs)
|
190
193
|
|
191
194
|
proc: asyncio.subprocess.Process
|
192
195
|
async with asyncio_subprocess_popen(*args, **kwargs) as proc:
|
193
196
|
stdout, stderr = await asyncio_subprocess_communicate(proc, input, timeout)
|
194
197
|
|
195
|
-
if proc.returncode:
|
198
|
+
if check and proc.returncode:
|
196
199
|
raise subprocess.CalledProcessError(
|
197
200
|
proc.returncode,
|
198
201
|
args,
|
@@ -203,6 +206,9 @@ async def _asyncio_subprocess_check_run(
|
|
203
206
|
return stdout, stderr
|
204
207
|
|
205
208
|
|
209
|
+
##
|
210
|
+
|
211
|
+
|
206
212
|
async def asyncio_subprocess_check_call(
|
207
213
|
*args: str,
|
208
214
|
stdout: ta.Any = sys.stderr,
|
@@ -210,11 +216,12 @@ async def asyncio_subprocess_check_call(
|
|
210
216
|
timeout: ta.Optional[float] = None,
|
211
217
|
**kwargs: ta.Any,
|
212
218
|
) -> None:
|
213
|
-
_, _ = await
|
219
|
+
_, _ = await asyncio_subprocess_run(
|
214
220
|
*args,
|
215
221
|
stdout=stdout,
|
216
222
|
input=input,
|
217
223
|
timeout=timeout,
|
224
|
+
check=True,
|
218
225
|
**kwargs,
|
219
226
|
)
|
220
227
|
|
@@ -225,11 +232,12 @@ async def asyncio_subprocess_check_output(
|
|
225
232
|
timeout: ta.Optional[float] = None,
|
226
233
|
**kwargs: ta.Any,
|
227
234
|
) -> bytes:
|
228
|
-
stdout, stderr = await
|
235
|
+
stdout, stderr = await asyncio_subprocess_run(
|
229
236
|
*args,
|
230
237
|
stdout=asyncio.subprocess.PIPE,
|
231
238
|
input=input,
|
232
239
|
timeout=timeout,
|
240
|
+
check=True,
|
233
241
|
**kwargs,
|
234
242
|
)
|
235
243
|
|
omlish/testing/pytest/marks.py
CHANGED
@@ -7,9 +7,9 @@ from .plugins.managermarks import ManagerMark # noqa
|
|
7
7
|
|
8
8
|
|
9
9
|
if ta.TYPE_CHECKING:
|
10
|
-
from ...asyncs import
|
10
|
+
from ...asyncs.asyncio import all as aiu
|
11
11
|
else:
|
12
|
-
aiu = lang.proxy_import('...asyncs.asyncio', __package__)
|
12
|
+
aiu = lang.proxy_import('...asyncs.asyncio.all', __package__)
|
13
13
|
|
14
14
|
|
15
15
|
class drain_asyncio(ManagerMark): # noqa
|
@@ -1,5 +1,5 @@
|
|
1
1
|
omlish/.manifests.json,sha256=RX24SRc6DCEg77PUVnaXOKCWa5TF_c9RQJdGIf7gl9c,1135
|
2
|
-
omlish/__about__.py,sha256=
|
2
|
+
omlish/__about__.py,sha256=no3iSNufNaOKVGIBmbUyL3Db7mURdDw5k36iYSBSAkQ,3409
|
3
3
|
omlish/__init__.py,sha256=SsyiITTuK0v74XpKV8dqNaCmjOlan1JZKrHQv5rWKPA,253
|
4
4
|
omlish/c3.py,sha256=ubu7lHwss5V4UznbejAI0qXhXahrU01MysuHOZI9C4U,8116
|
5
5
|
omlish/cached.py,sha256=UI-XTFBwA6YXWJJJeBn-WkwBkfzDjLBBaZf4nIJA9y0,510
|
@@ -79,12 +79,17 @@ omlish/argparse/cli.py,sha256=RrFql1bS1Lw3GA1ooLCJDQX4bK_Ci-dDqD5nEkVgHGI,8072
|
|
79
79
|
omlish/asyncs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
80
80
|
omlish/asyncs/all.py,sha256=uUz9ziKh4_QrgmdhKFMgq6j7mFbiZd3LiogguDCQsGI,587
|
81
81
|
omlish/asyncs/anyio.py,sha256=gfpx-D8QGmUfhnQxHEaHXcAP8zSMQjcGw4COFTGNnHI,8021
|
82
|
-
omlish/asyncs/asyncio.py,sha256=JfM59QgB3asgEbrps0zoVbNjWD4kL2XdsEkRMEIoFos,971
|
83
82
|
omlish/asyncs/asyncs.py,sha256=Tf7ZodTGepkM7HAuFcDNh9lLzzrMw6rELWvopGmFkh4,2035
|
84
83
|
omlish/asyncs/bridge.py,sha256=GJOjXVwZJvpq2q9rCwRI2u7Tg-KLUx-SY92b873-M4c,9738
|
85
84
|
omlish/asyncs/flavors.py,sha256=1mNxGNRVmjUHzA13K5ht8vdJv4CLEmzYTQ6BZXr1520,4866
|
86
85
|
omlish/asyncs/trio.py,sha256=fmZ5b_lKdVV8NQ3euCUutWgnkqTFzSnOjvJSA_jvmrE,367
|
87
86
|
omlish/asyncs/trio_asyncio.py,sha256=oqdOHy0slj9PjVxaDf3gJkq9AAgg7wYZbB469jOftVw,1327
|
87
|
+
omlish/asyncs/asyncio/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
88
|
+
omlish/asyncs/asyncio/all.py,sha256=cyfe1tOXxQYmgfyF9X1dwx0LPQ0Gsub3tFFZGjWGMr8,142
|
89
|
+
omlish/asyncs/asyncio/asyncio.py,sha256=JfM59QgB3asgEbrps0zoVbNjWD4kL2XdsEkRMEIoFos,971
|
90
|
+
omlish/asyncs/asyncio/channels.py,sha256=ZbmsEmdK1fV96liHdcVpRqA2dAMkXJt4Q3rFAg3YOIw,1074
|
91
|
+
omlish/asyncs/asyncio/streams.py,sha256=Uc9PCWSfBqrK2kdVtfjjQU1eaYTWYmZm8QISDj2xiuw,1004
|
92
|
+
omlish/asyncs/asyncio/timeouts.py,sha256=Rj5OU9BIAPcVZZKp74z7SzUXF5xokh4dgsWkUqOy1aE,355
|
88
93
|
omlish/bootstrap/__init__.py,sha256=-Rtsg7uPQNhh1dIT9nqrz96XlqizwoLnWf-FwOEstJI,730
|
89
94
|
omlish/bootstrap/__main__.py,sha256=4jCwsaogp0FrJjJZ85hzF4-WqluPeheHbfeoKynKvNs,194
|
90
95
|
omlish/bootstrap/base.py,sha256=d8hqn4hp1XMMi5PgcJBQXPKmW47epu8CxBlqDZiRZb4,1073
|
@@ -347,8 +352,7 @@ omlish/lite/strings.py,sha256=QURcE4-1pKVW8eT_5VCJpXaHDWR2dW2pYOChTJnZDiQ,1504
|
|
347
352
|
omlish/lite/subprocesses.py,sha256=iN-HX44g9uxkZ7HII2Upvkfjp7YK6qQuhPrBqM4Hnp0,4934
|
348
353
|
omlish/lite/typing.py,sha256=U3-JaEnkDSYxK4tsu_MzUn3RP6qALBe5FXQXpD-licE,1090
|
349
354
|
omlish/lite/asyncio/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
350
|
-
omlish/lite/asyncio/
|
351
|
-
omlish/lite/asyncio/subprocesses.py,sha256=uav2ZD70HQKGhRvFgDcptW_HFYwA_x0AKviCBwL0K_0,8163
|
355
|
+
omlish/lite/asyncio/subprocesses.py,sha256=FB9PbS17MCE2fvgbSUb30KOg8kiJe37DNioD51T8HOk,8427
|
352
356
|
omlish/logs/__init__.py,sha256=FbOyAW-lGH8gyBlSVArwljdYAU6RnwZLI5LwAfuNnrk,438
|
353
357
|
omlish/logs/abc.py,sha256=ho4ABKYMKX-V7g4sp1BByuOLzslYzLlQ0MESmjEpT-o,8005
|
354
358
|
omlish/logs/configs.py,sha256=EE0jlNaXJbGnM7V-y4xS5VwyTBSTzFzc0BYaVjg0JmA,1283
|
@@ -492,7 +496,7 @@ omlish/testing/__init__.py,sha256=M_BQrcCHkoL-ZvE-UpQ8XxXNYRRawhjUz4rCJnAqM2A,15
|
|
492
496
|
omlish/testing/testing.py,sha256=TT2wwSzPZ_KhIvKxpM1qc1yHKD-LHDNgGrcr_h8vs7c,2895
|
493
497
|
omlish/testing/pytest/__init__.py,sha256=B2nyJrjIoNcEopbg0IZ5UUDs4OHmQ8qqElFJfGcDdas,257
|
494
498
|
omlish/testing/pytest/helpers.py,sha256=TJpD60mBtLi9FtxX4TThfuXvg5FIRPSiZk1aeRwe-D4,197
|
495
|
-
omlish/testing/pytest/marks.py,sha256=
|
499
|
+
omlish/testing/pytest/marks.py,sha256=4-3WgunN_fcmhkmQ6mtX_AFo5QRDwflNSH7NoyoXui4,432
|
496
500
|
omlish/testing/pytest/skip.py,sha256=NxTkAQiS3HKZR3sfFdxOR2LCFwtCveY6Ap-qtexiZbw,839
|
497
501
|
omlish/testing/pytest/inject/__init__.py,sha256=pdRKv1HcDmJ_yArKJbYITPXXZthRSGgBJWqITr0Er38,117
|
498
502
|
omlish/testing/pytest/inject/harness.py,sha256=v4DaKJ0KL8oQjzIMK43Gh8GHP4hiI6-lY37O9lyOHRk,5724
|
@@ -515,9 +519,9 @@ omlish/text/glyphsplit.py,sha256=Ug-dPRO7x-OrNNr8g1y6DotSZ2KH0S-VcOmUobwa4B0,329
|
|
515
519
|
omlish/text/indent.py,sha256=6Jj6TFY9unaPa4xPzrnZemJ-fHsV53IamP93XGjSUHs,1274
|
516
520
|
omlish/text/parts.py,sha256=7vPF1aTZdvLVYJ4EwBZVzRSy8XB3YqPd7JwEnNGGAOo,6495
|
517
521
|
omlish/text/random.py,sha256=jNWpqiaKjKyTdMXC-pWAsSC10AAP-cmRRPVhm59ZWLk,194
|
518
|
-
omlish-0.0.0.
|
519
|
-
omlish-0.0.0.
|
520
|
-
omlish-0.0.0.
|
521
|
-
omlish-0.0.0.
|
522
|
-
omlish-0.0.0.
|
523
|
-
omlish-0.0.0.
|
522
|
+
omlish-0.0.0.dev154.dist-info/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
|
523
|
+
omlish-0.0.0.dev154.dist-info/METADATA,sha256=O0HqplgGpRM3tro7bLoHJSny__RfQOk1o0vB84-Tyic,4264
|
524
|
+
omlish-0.0.0.dev154.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
525
|
+
omlish-0.0.0.dev154.dist-info/entry_points.txt,sha256=Lt84WvRZJskWCAS7xnQGZIeVWksprtUHj0llrvVmod8,35
|
526
|
+
omlish-0.0.0.dev154.dist-info/top_level.txt,sha256=pePsKdLu7DvtUiecdYXJ78iO80uDNmBlqe-8hOzOmfs,7
|
527
|
+
omlish-0.0.0.dev154.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|