dycw-utilities 0.175.12__py3-none-any.whl → 0.175.14__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.
- {dycw_utilities-0.175.12.dist-info → dycw_utilities-0.175.14.dist-info}/METADATA +1 -1
- {dycw_utilities-0.175.12.dist-info → dycw_utilities-0.175.14.dist-info}/RECORD +6 -6
- utilities/__init__.py +1 -1
- utilities/subprocess.py +48 -1
- {dycw_utilities-0.175.12.dist-info → dycw_utilities-0.175.14.dist-info}/WHEEL +0 -0
- {dycw_utilities-0.175.12.dist-info → dycw_utilities-0.175.14.dist-info}/entry_points.txt +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
utilities/__init__.py,sha256=
|
|
1
|
+
utilities/__init__.py,sha256=BPQLImIyoL3MqLo2IQpQFaliGFVZmxQJLSwMiVrwkhA,61
|
|
2
2
|
utilities/altair.py,sha256=TLfRFbG9HwG7SLXoJ-v0r-t49ZaGgTQZD82cpjVi4vs,9085
|
|
3
3
|
utilities/asyncio.py,sha256=aJySVxBY0gqsIYnoNmH7-1r8djKuf4vSsU69VCD08t8,16772
|
|
4
4
|
utilities/atomicwrites.py,sha256=tPo6r-Rypd9u99u66B9z86YBPpnLrlHtwox_8Z7T34Y,5790
|
|
@@ -80,7 +80,7 @@ utilities/sqlalchemy.py,sha256=HQYpd7LFxdTF5WYVWYtCJeEBI71EJm7ytvCGyAH9B-U,37163
|
|
|
80
80
|
utilities/sqlalchemy_polars.py,sha256=JCGhB37raSR7fqeWV5dTsciRTMVzIdVT9YSqKT0piT0,13370
|
|
81
81
|
utilities/statsmodels.py,sha256=koyiBHvpMcSiBfh99wFUfSggLNx7cuAw3rwyfAhoKpQ,3410
|
|
82
82
|
utilities/string.py,sha256=shmBK87zZwzGyixuNuXCiUbqzfeZ9xlrFwz6JTaRvDk,582
|
|
83
|
-
utilities/subprocess.py,sha256=
|
|
83
|
+
utilities/subprocess.py,sha256=pagoVFbp_xJyHk4hei3vwZnaSZuMKgodKY6KF1ToqX8,42379
|
|
84
84
|
utilities/tempfile.py,sha256=QyvIdfV4r4YZ0NeNYsg0tCijThLKa7Z32u5Kxy6ZsGo,3619
|
|
85
85
|
utilities/testbook.py,sha256=j1KmaVbrX9VrbeMgtPh5gk55myAsn3dyRUn7jGbPbRk,1294
|
|
86
86
|
utilities/text.py,sha256=7SvwcSR2l_5cOrm1samGnR4C-ZI6qyFLHLzSpO1zeHQ,13958
|
|
@@ -97,7 +97,7 @@ utilities/warnings.py,sha256=un1LvHv70PU-LLv8RxPVmugTzDJkkGXRMZTE2-fTQHw,1771
|
|
|
97
97
|
utilities/whenever.py,sha256=F4ek0-OBWxHYrZdmoZt76N2RnNyKY5KrEHt7rqO4AQE,60183
|
|
98
98
|
utilities/zipfile.py,sha256=24lQc9ATcJxHXBPc_tBDiJk48pWyRrlxO2fIsFxU0A8,699
|
|
99
99
|
utilities/zoneinfo.py,sha256=tdIScrTB2-B-LH0ukb1HUXKooLknOfJNwHk10MuMYvA,3619
|
|
100
|
-
dycw_utilities-0.175.
|
|
101
|
-
dycw_utilities-0.175.
|
|
102
|
-
dycw_utilities-0.175.
|
|
103
|
-
dycw_utilities-0.175.
|
|
100
|
+
dycw_utilities-0.175.14.dist-info/WHEEL,sha256=RRVLqVugUmFOqBedBFAmA4bsgFcROUBiSUKlERi0Hcg,79
|
|
101
|
+
dycw_utilities-0.175.14.dist-info/entry_points.txt,sha256=cOGtKeJI0KXLSV7MJ8Dhc2G8jPgDcBDm53MVNJU4ycI,136
|
|
102
|
+
dycw_utilities-0.175.14.dist-info/METADATA,sha256=2aXs3olCrTO08_DVJn8u6uvXpl6IQpm2yiNY6oxUcVA,1443
|
|
103
|
+
dycw_utilities-0.175.14.dist-info/RECORD,,
|
utilities/__init__.py
CHANGED
utilities/subprocess.py
CHANGED
|
@@ -18,16 +18,18 @@ from typing import IO, TYPE_CHECKING, Literal, assert_never, overload, override
|
|
|
18
18
|
from utilities.errors import ImpossibleCaseError
|
|
19
19
|
from utilities.iterables import always_iterable
|
|
20
20
|
from utilities.logging import to_logger
|
|
21
|
+
from utilities.pathlib import PWD
|
|
21
22
|
from utilities.permissions import Permissions, ensure_perms
|
|
22
23
|
from utilities.tempfile import TemporaryDirectory
|
|
23
24
|
from utilities.text import strip_and_dedent
|
|
24
|
-
from utilities.whenever import to_seconds
|
|
25
|
+
from utilities.whenever import SECOND, to_seconds
|
|
25
26
|
|
|
26
27
|
if TYPE_CHECKING:
|
|
27
28
|
from collections.abc import Callable, Iterator
|
|
28
29
|
|
|
29
30
|
from utilities.permissions import PermissionsLike
|
|
30
31
|
from utilities.types import (
|
|
32
|
+
Delta,
|
|
31
33
|
LoggerLike,
|
|
32
34
|
MaybeIterable,
|
|
33
35
|
PathLike,
|
|
@@ -349,6 +351,24 @@ def mv_cmd(src: PathLike, dest: PathLike, /) -> list[str]:
|
|
|
349
351
|
##
|
|
350
352
|
|
|
351
353
|
|
|
354
|
+
def ripgrep(*args: str, path: PathLike = PWD) -> str | None:
|
|
355
|
+
"""Search for lines."""
|
|
356
|
+
try: # skipif-ci
|
|
357
|
+
return run(*ripgrep_cmd(*args, path=path), return_=True)
|
|
358
|
+
except CalledProcessError as error: # skipif-ci
|
|
359
|
+
if error.returncode == 1:
|
|
360
|
+
return None
|
|
361
|
+
raise
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
def ripgrep_cmd(*args: str, path: PathLike = PWD) -> list[str]:
|
|
365
|
+
"""Command to use 'ripgrep' to search for lines."""
|
|
366
|
+
return ["rg", *args, str(path)]
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
##
|
|
370
|
+
|
|
371
|
+
|
|
352
372
|
def rm(path: PathLike, /, *paths: PathLike, sudo: bool = False) -> None:
|
|
353
373
|
"""Remove a file/directory."""
|
|
354
374
|
if sudo: # pragma: no cover
|
|
@@ -1128,6 +1148,30 @@ def ssh_opts_cmd(
|
|
|
1128
1148
|
##
|
|
1129
1149
|
|
|
1130
1150
|
|
|
1151
|
+
def ssh_await(
|
|
1152
|
+
user: str,
|
|
1153
|
+
hostname: str,
|
|
1154
|
+
/,
|
|
1155
|
+
*,
|
|
1156
|
+
logger: LoggerLike | None = None,
|
|
1157
|
+
delta: Delta = SECOND,
|
|
1158
|
+
) -> None:
|
|
1159
|
+
while True: # skipif-ci
|
|
1160
|
+
if logger is not None:
|
|
1161
|
+
to_logger(logger).info("Waiting for '%s'...", hostname)
|
|
1162
|
+
try:
|
|
1163
|
+
ssh(user, hostname, "true")
|
|
1164
|
+
except CalledProcessError:
|
|
1165
|
+
sleep(to_seconds(delta))
|
|
1166
|
+
else:
|
|
1167
|
+
if logger is not None:
|
|
1168
|
+
to_logger(logger).info("'%s' is up", hostname)
|
|
1169
|
+
return
|
|
1170
|
+
|
|
1171
|
+
|
|
1172
|
+
##
|
|
1173
|
+
|
|
1174
|
+
|
|
1131
1175
|
def ssh_keyscan(
|
|
1132
1176
|
hostname: str, /, *, path: PathLike = KNOWN_HOSTS, port: int | None = None
|
|
1133
1177
|
) -> None:
|
|
@@ -1445,6 +1489,8 @@ __all__ = [
|
|
|
1445
1489
|
"mkdir_cmd",
|
|
1446
1490
|
"mv",
|
|
1447
1491
|
"mv_cmd",
|
|
1492
|
+
"ripgrep",
|
|
1493
|
+
"ripgrep_cmd",
|
|
1448
1494
|
"rm",
|
|
1449
1495
|
"rm_cmd",
|
|
1450
1496
|
"rsync",
|
|
@@ -1453,6 +1499,7 @@ __all__ = [
|
|
|
1453
1499
|
"run",
|
|
1454
1500
|
"set_hostname_cmd",
|
|
1455
1501
|
"ssh",
|
|
1502
|
+
"ssh_await",
|
|
1456
1503
|
"ssh_cmd",
|
|
1457
1504
|
"ssh_keygen_remove",
|
|
1458
1505
|
"ssh_keygen_remove_cmd",
|
|
File without changes
|
|
File without changes
|