omdev 0.0.0.dev151__py3-none-any.whl → 0.0.0.dev153__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.

Potentially problematic release.


This version of omdev might be problematic. Click here for more details.

omdev/scripts/interp.py CHANGED
@@ -55,7 +55,7 @@ VersionCmpLocalType = ta.Union['NegativeInfinityVersionType', _VersionCmpLocalTy
55
55
  VersionCmpKey = ta.Tuple[int, ta.Tuple[int, ...], VersionCmpPrePostDevType, VersionCmpPrePostDevType, VersionCmpPrePostDevType, VersionCmpLocalType] # noqa
56
56
  VersionComparisonMethod = ta.Callable[[VersionCmpKey, VersionCmpKey], bool]
57
57
 
58
- # ../../omlish/lite/asyncio/asyncio.py
58
+ # ../../omlish/asyncs/asyncio/timeouts.py
59
59
  AwaitableT = ta.TypeVar('AwaitableT', bound=ta.Awaitable)
60
60
 
61
61
  # ../../omlish/lite/cached.py
@@ -76,7 +76,7 @@ UnparsedVersionVar = ta.TypeVar('UnparsedVersionVar', bound=UnparsedVersion)
76
76
  CallableVersionOperator = ta.Callable[['Version', str], bool]
77
77
 
78
78
  # ../../omlish/lite/subprocesses.py
79
- SubprocessChannelOption = ta.Literal['pipe', 'stdout', 'devnull']
79
+ SubprocessChannelOption = ta.Literal['pipe', 'stdout', 'devnull'] # ta.TypeAlias
80
80
 
81
81
 
82
82
  ########################################
@@ -487,54 +487,7 @@ def canonicalize_version(
487
487
 
488
488
 
489
489
  ########################################
490
- # ../../../omlish/lite/asyncio/asyncio.py
491
-
492
-
493
- ##
494
-
495
-
496
- ASYNCIO_DEFAULT_BUFFER_LIMIT = 2 ** 16
497
-
498
-
499
- async def asyncio_open_stream_reader(
500
- f: ta.IO,
501
- loop: ta.Any = None,
502
- *,
503
- limit: int = ASYNCIO_DEFAULT_BUFFER_LIMIT,
504
- ) -> asyncio.StreamReader:
505
- if loop is None:
506
- loop = asyncio.get_running_loop()
507
-
508
- reader = asyncio.StreamReader(limit=limit, loop=loop)
509
- await loop.connect_read_pipe(
510
- lambda: asyncio.StreamReaderProtocol(reader, loop=loop),
511
- f,
512
- )
513
-
514
- return reader
515
-
516
-
517
- async def asyncio_open_stream_writer(
518
- f: ta.IO,
519
- loop: ta.Any = None,
520
- ) -> asyncio.StreamWriter:
521
- if loop is None:
522
- loop = asyncio.get_running_loop()
523
-
524
- writer_transport, writer_protocol = await loop.connect_write_pipe(
525
- lambda: asyncio.streams.FlowControlMixin(loop=loop),
526
- f,
527
- )
528
-
529
- return asyncio.streams.StreamWriter(
530
- writer_transport,
531
- writer_protocol,
532
- None,
533
- loop,
534
- )
535
-
536
-
537
- ##
490
+ # ../../../omlish/asyncs/asyncio/timeouts.py
538
491
 
539
492
 
540
493
  def asyncio_maybe_timeout(
@@ -2455,22 +2408,25 @@ async def asyncio_subprocess_communicate(
2455
2408
  return await AsyncioProcessCommunicator(proc).communicate(input, timeout) # noqa
2456
2409
 
2457
2410
 
2458
- ##
2459
-
2460
-
2461
- async def _asyncio_subprocess_check_run(
2411
+ async def asyncio_subprocess_run(
2462
2412
  *args: str,
2463
2413
  input: ta.Any = None, # noqa
2464
2414
  timeout: ta.Optional[float] = None,
2415
+ check: bool = False, # noqa
2416
+ capture_output: ta.Optional[bool] = None,
2465
2417
  **kwargs: ta.Any,
2466
2418
  ) -> ta.Tuple[ta.Optional[bytes], ta.Optional[bytes]]:
2419
+ if capture_output:
2420
+ kwargs.setdefault('stdout', subprocess.PIPE)
2421
+ kwargs.setdefault('stderr', subprocess.PIPE)
2422
+
2467
2423
  args, kwargs = prepare_subprocess_invocation(*args, **kwargs)
2468
2424
 
2469
2425
  proc: asyncio.subprocess.Process
2470
2426
  async with asyncio_subprocess_popen(*args, **kwargs) as proc:
2471
2427
  stdout, stderr = await asyncio_subprocess_communicate(proc, input, timeout)
2472
2428
 
2473
- if proc.returncode:
2429
+ if check and proc.returncode:
2474
2430
  raise subprocess.CalledProcessError(
2475
2431
  proc.returncode,
2476
2432
  args,
@@ -2481,6 +2437,9 @@ async def _asyncio_subprocess_check_run(
2481
2437
  return stdout, stderr
2482
2438
 
2483
2439
 
2440
+ ##
2441
+
2442
+
2484
2443
  async def asyncio_subprocess_check_call(
2485
2444
  *args: str,
2486
2445
  stdout: ta.Any = sys.stderr,
@@ -2488,11 +2447,12 @@ async def asyncio_subprocess_check_call(
2488
2447
  timeout: ta.Optional[float] = None,
2489
2448
  **kwargs: ta.Any,
2490
2449
  ) -> None:
2491
- _, _ = await _asyncio_subprocess_check_run(
2450
+ _, _ = await asyncio_subprocess_run(
2492
2451
  *args,
2493
2452
  stdout=stdout,
2494
2453
  input=input,
2495
2454
  timeout=timeout,
2455
+ check=True,
2496
2456
  **kwargs,
2497
2457
  )
2498
2458
 
@@ -2503,11 +2463,12 @@ async def asyncio_subprocess_check_output(
2503
2463
  timeout: ta.Optional[float] = None,
2504
2464
  **kwargs: ta.Any,
2505
2465
  ) -> bytes:
2506
- stdout, stderr = await _asyncio_subprocess_check_run(
2466
+ stdout, stderr = await asyncio_subprocess_run(
2507
2467
  *args,
2508
2468
  stdout=asyncio.subprocess.PIPE,
2509
2469
  input=input,
2510
2470
  timeout=timeout,
2471
+ check=True,
2511
2472
  **kwargs,
2512
2473
  )
2513
2474