dycw-utilities 0.175.23__py3-none-any.whl → 0.175.25__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.23.dist-info → dycw_utilities-0.175.25.dist-info}/METADATA +1 -1
- {dycw_utilities-0.175.23.dist-info → dycw_utilities-0.175.25.dist-info}/RECORD +6 -6
- utilities/__init__.py +1 -1
- utilities/subprocess.py +40 -9
- {dycw_utilities-0.175.23.dist-info → dycw_utilities-0.175.25.dist-info}/WHEEL +0 -0
- {dycw_utilities-0.175.23.dist-info → dycw_utilities-0.175.25.dist-info}/entry_points.txt +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
utilities/__init__.py,sha256=
|
|
1
|
+
utilities/__init__.py,sha256=8quKfYtIALxr2dJjYj4P-tikKRy9QAyyLARzWiVHZFo,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=uZ2HR9hJOnqhrS-uwfZZuERxO_pSLfHZZbMFfms7lQA,46604
|
|
84
84
|
utilities/tempfile.py,sha256=a3_M1QyxGZql_VcGkBOQBeWbbkItjgkfIpVyzU1UAic,3843
|
|
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.25.dist-info/WHEEL,sha256=RRVLqVugUmFOqBedBFAmA4bsgFcROUBiSUKlERi0Hcg,79
|
|
101
|
+
dycw_utilities-0.175.25.dist-info/entry_points.txt,sha256=cOGtKeJI0KXLSV7MJ8Dhc2G8jPgDcBDm53MVNJU4ycI,136
|
|
102
|
+
dycw_utilities-0.175.25.dist-info/METADATA,sha256=1NhbVd1HVupBPJX0m3EMxTTXc-gKJXj1rpewpUjPddg,1443
|
|
103
|
+
dycw_utilities-0.175.25.dist-info/RECORD,,
|
utilities/__init__.py
CHANGED
utilities/subprocess.py
CHANGED
|
@@ -7,7 +7,7 @@ from dataclasses import dataclass
|
|
|
7
7
|
from io import StringIO
|
|
8
8
|
from itertools import repeat
|
|
9
9
|
from pathlib import Path
|
|
10
|
-
from re import search
|
|
10
|
+
from re import MULTILINE, search
|
|
11
11
|
from shlex import join
|
|
12
12
|
from shutil import copyfile, copytree, move, rmtree
|
|
13
13
|
from string import Template
|
|
@@ -80,16 +80,43 @@ def append_text(
|
|
|
80
80
|
##
|
|
81
81
|
|
|
82
82
|
|
|
83
|
-
def apt_install(
|
|
84
|
-
|
|
83
|
+
def apt_install(
|
|
84
|
+
package: str, /, *packages: str, update: bool = False, sudo: bool = False
|
|
85
|
+
) -> None:
|
|
86
|
+
"""Install packages."""
|
|
85
87
|
if update: # pragma: no cover
|
|
86
|
-
|
|
87
|
-
run(
|
|
88
|
+
apt_update(sudo=sudo)
|
|
89
|
+
run( # pragma: no cover
|
|
90
|
+
*maybe_sudo_cmd(*apt_install_cmd(package, *packages), sudo=sudo)
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
def apt_install_cmd(package: str, /, *packages: str) -> list[str]:
|
|
95
|
+
"""Command to use 'apt' to install packages."""
|
|
96
|
+
return ["apt", "install", "-y", package, *packages]
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
##
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
def apt_remove(package: str, /, *packages: str, sudo: bool = False) -> None:
|
|
103
|
+
"""Remove a package."""
|
|
104
|
+
run( # pragma: no cover
|
|
105
|
+
*maybe_sudo_cmd(*apt_remove_cmd(package, *packages), sudo=sudo)
|
|
106
|
+
)
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
def apt_remove_cmd(package: str, /, *packages: str) -> list[str]:
|
|
110
|
+
"""Command to use 'apt' to remove packages."""
|
|
111
|
+
return ["apt", "remove", "-y", package, *packages]
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
##
|
|
88
115
|
|
|
89
116
|
|
|
90
|
-
def
|
|
91
|
-
"""
|
|
92
|
-
|
|
117
|
+
def apt_update(*, sudo: bool = False) -> None:
|
|
118
|
+
"""Update 'apt'."""
|
|
119
|
+
run(*maybe_sudo_cmd(*APT_UPDATE, sudo=sudo))
|
|
93
120
|
|
|
94
121
|
|
|
95
122
|
##
|
|
@@ -1169,8 +1196,9 @@ def _ssh_retry_skip(return_code: int, stdout: str, stderr: str, /) -> bool:
|
|
|
1169
1196
|
|
|
1170
1197
|
def _ssh_is_strict_checking_error(text: str, /) -> bool:
|
|
1171
1198
|
match = search(
|
|
1172
|
-
"No ED25519 host key is known for .* and you have requested strict checking",
|
|
1199
|
+
"(Host key for .* has changed|No ED25519 host key is known for .*) and you have requested strict checking",
|
|
1173
1200
|
text,
|
|
1201
|
+
flags=MULTILINE,
|
|
1174
1202
|
)
|
|
1175
1203
|
return match is not None
|
|
1176
1204
|
|
|
@@ -1601,6 +1629,9 @@ __all__ = [
|
|
|
1601
1629
|
"append_text",
|
|
1602
1630
|
"apt_install",
|
|
1603
1631
|
"apt_install_cmd",
|
|
1632
|
+
"apt_remove",
|
|
1633
|
+
"apt_remove_cmd",
|
|
1634
|
+
"apt_update",
|
|
1604
1635
|
"cat",
|
|
1605
1636
|
"cd_cmd",
|
|
1606
1637
|
"chmod",
|
|
File without changes
|
|
File without changes
|