omdev 0.0.0.dev152__py3-none-any.whl → 0.0.0.dev154__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.
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
@@ -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
 
@@ -92,7 +92,7 @@ TomlParseFloat = ta.Callable[[str], ta.Any]
92
92
  TomlKey = ta.Tuple[str, ...]
93
93
  TomlPos = int # ta.TypeAlias
94
94
 
95
- # ../../omlish/lite/asyncio/asyncio.py
95
+ # ../../omlish/asyncs/asyncio/timeouts.py
96
96
  AwaitableT = ta.TypeVar('AwaitableT', bound=ta.Awaitable)
97
97
 
98
98
  # ../../omlish/lite/cached.py
@@ -1779,54 +1779,7 @@ class WheelFile(zipfile.ZipFile):
1779
1779
 
1780
1780
 
1781
1781
  ########################################
1782
- # ../../../omlish/lite/asyncio/asyncio.py
1783
-
1784
-
1785
- ##
1786
-
1787
-
1788
- ASYNCIO_DEFAULT_BUFFER_LIMIT = 2 ** 16
1789
-
1790
-
1791
- async def asyncio_open_stream_reader(
1792
- f: ta.IO,
1793
- loop: ta.Any = None,
1794
- *,
1795
- limit: int = ASYNCIO_DEFAULT_BUFFER_LIMIT,
1796
- ) -> asyncio.StreamReader:
1797
- if loop is None:
1798
- loop = asyncio.get_running_loop()
1799
-
1800
- reader = asyncio.StreamReader(limit=limit, loop=loop)
1801
- await loop.connect_read_pipe(
1802
- lambda: asyncio.StreamReaderProtocol(reader, loop=loop),
1803
- f,
1804
- )
1805
-
1806
- return reader
1807
-
1808
-
1809
- async def asyncio_open_stream_writer(
1810
- f: ta.IO,
1811
- loop: ta.Any = None,
1812
- ) -> asyncio.StreamWriter:
1813
- if loop is None:
1814
- loop = asyncio.get_running_loop()
1815
-
1816
- writer_transport, writer_protocol = await loop.connect_write_pipe(
1817
- lambda: asyncio.streams.FlowControlMixin(loop=loop),
1818
- f,
1819
- )
1820
-
1821
- return asyncio.streams.StreamWriter(
1822
- writer_transport,
1823
- writer_protocol,
1824
- None,
1825
- loop,
1826
- )
1827
-
1828
-
1829
- ##
1782
+ # ../../../omlish/asyncs/asyncio/timeouts.py
1830
1783
 
1831
1784
 
1832
1785
  def asyncio_maybe_timeout(
@@ -5269,22 +5222,25 @@ async def asyncio_subprocess_communicate(
5269
5222
  return await AsyncioProcessCommunicator(proc).communicate(input, timeout) # noqa
5270
5223
 
5271
5224
 
5272
- ##
5273
-
5274
-
5275
- async def _asyncio_subprocess_check_run(
5225
+ async def asyncio_subprocess_run(
5276
5226
  *args: str,
5277
5227
  input: ta.Any = None, # noqa
5278
5228
  timeout: ta.Optional[float] = None,
5229
+ check: bool = False, # noqa
5230
+ capture_output: ta.Optional[bool] = None,
5279
5231
  **kwargs: ta.Any,
5280
5232
  ) -> ta.Tuple[ta.Optional[bytes], ta.Optional[bytes]]:
5233
+ if capture_output:
5234
+ kwargs.setdefault('stdout', subprocess.PIPE)
5235
+ kwargs.setdefault('stderr', subprocess.PIPE)
5236
+
5281
5237
  args, kwargs = prepare_subprocess_invocation(*args, **kwargs)
5282
5238
 
5283
5239
  proc: asyncio.subprocess.Process
5284
5240
  async with asyncio_subprocess_popen(*args, **kwargs) as proc:
5285
5241
  stdout, stderr = await asyncio_subprocess_communicate(proc, input, timeout)
5286
5242
 
5287
- if proc.returncode:
5243
+ if check and proc.returncode:
5288
5244
  raise subprocess.CalledProcessError(
5289
5245
  proc.returncode,
5290
5246
  args,
@@ -5295,6 +5251,9 @@ async def _asyncio_subprocess_check_run(
5295
5251
  return stdout, stderr
5296
5252
 
5297
5253
 
5254
+ ##
5255
+
5256
+
5298
5257
  async def asyncio_subprocess_check_call(
5299
5258
  *args: str,
5300
5259
  stdout: ta.Any = sys.stderr,
@@ -5302,11 +5261,12 @@ async def asyncio_subprocess_check_call(
5302
5261
  timeout: ta.Optional[float] = None,
5303
5262
  **kwargs: ta.Any,
5304
5263
  ) -> None:
5305
- _, _ = await _asyncio_subprocess_check_run(
5264
+ _, _ = await asyncio_subprocess_run(
5306
5265
  *args,
5307
5266
  stdout=stdout,
5308
5267
  input=input,
5309
5268
  timeout=timeout,
5269
+ check=True,
5310
5270
  **kwargs,
5311
5271
  )
5312
5272
 
@@ -5317,11 +5277,12 @@ async def asyncio_subprocess_check_output(
5317
5277
  timeout: ta.Optional[float] = None,
5318
5278
  **kwargs: ta.Any,
5319
5279
  ) -> bytes:
5320
- stdout, stderr = await _asyncio_subprocess_check_run(
5280
+ stdout, stderr = await asyncio_subprocess_run(
5321
5281
  *args,
5322
5282
  stdout=asyncio.subprocess.PIPE,
5323
5283
  input=input,
5324
5284
  timeout=timeout,
5285
+ check=True,
5325
5286
  **kwargs,
5326
5287
  )
5327
5288
 
omdev/tools/git.py CHANGED
@@ -119,10 +119,10 @@ class Cli(ap.Cli):
119
119
  day_rev = check.not_none(get_first_commit_of_day(rev))
120
120
  base_rev = rev_parse(f'{day_rev}~1')
121
121
 
122
- if self.args.diff or self.args.diff_stat:
123
- os.execvp('git', ['git', 'diff', *(['--stat'] if self.args.diff_stat else []), base_rev, rev])
122
+ if self.args.diff or self.args.stat:
123
+ os.execvp('git', ['git', 'diff', *(['--stat'] if self.args.stat else []), base_rev, rev])
124
124
 
125
- elif self.args.github:
125
+ elif self.args.github or self.args.open:
126
126
  rm_url = subprocess.check_output(['git', 'remote', 'get-url', 'origin']).decode('utf-8').strip()
127
127
 
128
128
  if rm_url.startswith(git_pfx := 'git@github.com:'):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: omdev
3
- Version: 0.0.0.dev152
3
+ Version: 0.0.0.dev154
4
4
  Summary: omdev
5
5
  Author: wrmsr
6
6
  License: BSD-3-Clause
@@ -12,7 +12,7 @@ Classifier: Operating System :: OS Independent
12
12
  Classifier: Operating System :: POSIX
13
13
  Requires-Python: >=3.12
14
14
  License-File: LICENSE
15
- Requires-Dist: omlish==0.0.0.dev152
15
+ Requires-Dist: omlish==0.0.0.dev154
16
16
  Provides-Extra: all
17
17
  Requires-Dist: black~=24.10; extra == "all"
18
18
  Requires-Dist: pycparser~=2.22; extra == "all"
@@ -123,8 +123,8 @@ omdev/scripts/bumpversion.py,sha256=Kn7fo73Hs8uJh3Hi3EIyLOlzLPWAC6dwuD_lZ3cIzuY,
123
123
  omdev/scripts/execrss.py,sha256=mR0G0wERBYtQmVIn63lCIIFb5zkCM6X_XOENDFYDBKc,651
124
124
  omdev/scripts/exectime.py,sha256=sFb376GflU6s9gNX-2-we8hgH6w5MuQNS9g6i4SqJIo,610
125
125
  omdev/scripts/importtrace.py,sha256=oa7CtcWJVMNDbyIEiRHej6ICfABfErMeo4_haIqe18Q,14041
126
- omdev/scripts/interp.py,sha256=lcyDBkhT7ckwlFE7ao_4O48LMZquS00dZqEssKujokk,97172
127
- omdev/scripts/pyproject.py,sha256=Bq0CTRGHtQR6wY5syLvZZnfsrPQBnirDcXI-lWEWppg,210754
126
+ omdev/scripts/interp.py,sha256=ux5BECj6yHWWeJp7DJyOI9343qTUua2KJcakm_HjO6M,96486
127
+ omdev/scripts/pyproject.py,sha256=HUPHXgADQS1tvo3ZB-2jbz6QvWKb6bpVf0TWpn9UFwI,210068
128
128
  omdev/scripts/slowcat.py,sha256=lssv4yrgJHiWfOiHkUut2p8E8Tq32zB-ujXESQxFFHY,2728
129
129
  omdev/scripts/tmpexec.py,sha256=WTYcf56Tj2qjYV14AWmV8SfT0u6Y8eIU6cKgQRvEK3c,1442
130
130
  omdev/toml/__init__.py,sha256=Y3l4WY4JRi2uLG6kgbGp93fuGfkxkKwZDvhsa0Rwgtk,15
@@ -134,7 +134,7 @@ omdev/tools/__init__.py,sha256=iVJAOQ0viGTQOm0DLX4uZLro-9jOioYJGLg9s0kDx1A,78
134
134
  omdev/tools/cloc.py,sha256=13lUsYLyn1LoelhsCeKrRkIwwPE0x54JmdhXJ_lvWh0,3811
135
135
  omdev/tools/doc.py,sha256=iblgUq9_7JZN2i8qmvewrz4OX0paObscBaCj8u77WqI,2555
136
136
  omdev/tools/docker.py,sha256=eotslH8Mu-Z9yaT_8ikgkVx3PBXF7ZK2DDPrMtO6gnc,7144
137
- omdev/tools/git.py,sha256=2x8SjO4_-pMZ0u4J9KpZIh4kDOUX08VaCUGem3FQyNs,6980
137
+ omdev/tools/git.py,sha256=1PGHAVPNTb-ezCrPaQWCxwpUyEy_1QVSWDAa5Wbm9iA,6988
138
138
  omdev/tools/importscan.py,sha256=nhJIhtjDY6eFVlReP7fegvv6L5ZjN-Z2VeyhsBonev4,4639
139
139
  omdev/tools/mkrelimp.py,sha256=wsJAjTIf3nqcSfnT9TkDpS1VUOoM9W2Az5tZdWuzyLM,4054
140
140
  omdev/tools/notebook.py,sha256=lIQIG-ytxGistyt7twuTbquSKbd7HQzR2jgBcGApwu8,3498
@@ -153,9 +153,9 @@ omdev/tools/json/rendering.py,sha256=jNShMfCpFR9-Kcn6cUFuOChXHjg71diuTC4x7Ofmz-o
153
153
  omdev/tools/pawk/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
154
154
  omdev/tools/pawk/__main__.py,sha256=VCqeRVnqT1RPEoIrqHFSu4PXVMg4YEgF4qCQm90-eRI,66
155
155
  omdev/tools/pawk/pawk.py,sha256=Eckymn22GfychCQcQi96BFqRo_LmiJ-EPhC8TTUJdB4,11446
156
- omdev-0.0.0.dev152.dist-info/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
157
- omdev-0.0.0.dev152.dist-info/METADATA,sha256=CvNyiCIsaXgOGDAMiFJdIXZFvNBEOWzIa_EjoEbL6qI,1760
158
- omdev-0.0.0.dev152.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
159
- omdev-0.0.0.dev152.dist-info/entry_points.txt,sha256=dHLXFmq5D9B8qUyhRtFqTGWGxlbx3t5ejedjrnXNYLU,33
160
- omdev-0.0.0.dev152.dist-info/top_level.txt,sha256=1nr7j30fEWgLYHW3lGR9pkdHkb7knv1U1ES1XRNVQ6k,6
161
- omdev-0.0.0.dev152.dist-info/RECORD,,
156
+ omdev-0.0.0.dev154.dist-info/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
157
+ omdev-0.0.0.dev154.dist-info/METADATA,sha256=SRsM3R6XFAWPkaAbynTocfqVhSFMRAiukbhE_7emv_Q,1760
158
+ omdev-0.0.0.dev154.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
159
+ omdev-0.0.0.dev154.dist-info/entry_points.txt,sha256=dHLXFmq5D9B8qUyhRtFqTGWGxlbx3t5ejedjrnXNYLU,33
160
+ omdev-0.0.0.dev154.dist-info/top_level.txt,sha256=1nr7j30fEWgLYHW3lGR9pkdHkb7knv1U1ES1XRNVQ6k,6
161
+ omdev-0.0.0.dev154.dist-info/RECORD,,