dycw-utilities 0.174.11__tar.gz → 0.174.13__tar.gz
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.174.11 → dycw_utilities-0.174.13}/PKG-INFO +1 -1
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/pyproject.toml +2 -2
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/__init__.py +1 -1
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/permissions.py +11 -1
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/subprocess.py +154 -6
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/README.md +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/aeventkit.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/altair.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/asyncio.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/atomicwrites.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/atools.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/cachetools.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/click.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/concurrent.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/contextlib.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/contextvars.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/cryptography.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/cvxpy.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/dataclasses.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/docker.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/enum.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/errors.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/fastapi.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/fpdf2.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/functions.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/functools.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/getpass.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/git.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/grp.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/gzip.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/hashlib.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/http.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/hypothesis.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/importlib.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/inflect.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/ipython.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/iterables.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/jinja2.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/json.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/jupyter.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/libcst.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/lightweight_charts.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/logging.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/math.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/memory_profiler.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/modules.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/more_itertools.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/numpy.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/operator.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/optuna.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/orjson.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/os.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/parse.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/pathlib.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/pickle.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/platform.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/polars.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/polars_ols.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/postgres.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/pottery.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/pqdm.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/psutil.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/pwd.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/py.typed +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/pydantic.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/pydantic_settings.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/pydantic_settings_sops.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/pyinstrument.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/pytest.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/pytest_plugins/__init__.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/pytest_plugins/pytest_randomly.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/pytest_plugins/pytest_regressions.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/pytest_regressions.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/random.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/re.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/redis.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/reprlib.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/scipy.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/sentinel.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/shelve.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/shutil.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/slack_sdk.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/socket.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/sqlalchemy.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/sqlalchemy_polars.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/statsmodels.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/string.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/tempfile.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/testbook.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/text.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/threading.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/timer.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/traceback.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/types.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/typing.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/tzdata.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/tzlocal.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/uuid.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/version.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/warnings.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/whenever.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/zipfile.py +0 -0
- {dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/zoneinfo.py +0 -0
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
name = "dycw-utilities"
|
|
102
102
|
readme = "README.md"
|
|
103
103
|
requires-python = ">= 3.12"
|
|
104
|
-
version = "0.174.
|
|
104
|
+
version = "0.174.13"
|
|
105
105
|
|
|
106
106
|
[project.entry-points.pytest11]
|
|
107
107
|
pytest-randomly = "utilities.pytest_plugins.pytest_randomly"
|
|
@@ -135,7 +135,7 @@
|
|
|
135
135
|
# bump-my-version
|
|
136
136
|
[tool.bumpversion]
|
|
137
137
|
allow_dirty = true
|
|
138
|
-
current_version = "0.174.
|
|
138
|
+
current_version = "0.174.13"
|
|
139
139
|
|
|
140
140
|
[[tool.bumpversion.files]]
|
|
141
141
|
filename = "src/utilities/__init__.py"
|
|
@@ -3,7 +3,9 @@ from __future__ import annotations
|
|
|
3
3
|
from dataclasses import dataclass
|
|
4
4
|
from functools import reduce
|
|
5
5
|
from operator import or_
|
|
6
|
+
from pathlib import Path
|
|
6
7
|
from stat import (
|
|
8
|
+
S_IMODE,
|
|
7
9
|
S_IRGRP,
|
|
8
10
|
S_IROTH,
|
|
9
11
|
S_IRUSR,
|
|
@@ -14,12 +16,16 @@ from stat import (
|
|
|
14
16
|
S_IXOTH,
|
|
15
17
|
S_IXUSR,
|
|
16
18
|
)
|
|
17
|
-
from typing import Literal, Self, assert_never, override
|
|
19
|
+
from typing import TYPE_CHECKING, Literal, Self, assert_never, override
|
|
18
20
|
|
|
19
21
|
from utilities.dataclasses import replace_non_sentinel
|
|
20
22
|
from utilities.re import ExtractGroupsError, extract_groups
|
|
21
23
|
from utilities.sentinel import Sentinel, sentinel
|
|
22
24
|
|
|
25
|
+
if TYPE_CHECKING:
|
|
26
|
+
from utilities.types import PathLike
|
|
27
|
+
|
|
28
|
+
|
|
23
29
|
type PermissionsLike = Permissions | int | str
|
|
24
30
|
|
|
25
31
|
|
|
@@ -154,6 +160,10 @@ class Permissions:
|
|
|
154
160
|
)
|
|
155
161
|
raise PermissionsFromIntError(n=n)
|
|
156
162
|
|
|
163
|
+
@classmethod
|
|
164
|
+
def from_path(cls, path: PathLike, /) -> Self:
|
|
165
|
+
return cls.from_int(S_IMODE(Path(path).stat().st_mode))
|
|
166
|
+
|
|
157
167
|
@classmethod
|
|
158
168
|
def from_text(cls, text: str, /) -> Self:
|
|
159
169
|
try:
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
+
import shutil
|
|
3
4
|
import sys
|
|
4
5
|
from contextlib import contextmanager
|
|
5
6
|
from dataclasses import dataclass
|
|
6
7
|
from io import StringIO
|
|
7
8
|
from pathlib import Path
|
|
8
9
|
from shlex import join
|
|
10
|
+
from shutil import copyfile, copytree, move, rmtree
|
|
9
11
|
from string import Template
|
|
10
12
|
from subprocess import PIPE, CalledProcessError, Popen
|
|
11
13
|
from threading import Thread
|
|
@@ -15,12 +17,14 @@ from typing import IO, TYPE_CHECKING, Literal, assert_never, overload, override
|
|
|
15
17
|
from utilities.errors import ImpossibleCaseError
|
|
16
18
|
from utilities.iterables import always_iterable
|
|
17
19
|
from utilities.logging import to_logger
|
|
20
|
+
from utilities.permissions import ensure_perms
|
|
18
21
|
from utilities.text import strip_and_dedent
|
|
19
22
|
from utilities.whenever import to_seconds
|
|
20
23
|
|
|
21
24
|
if TYPE_CHECKING:
|
|
22
25
|
from collections.abc import Iterator
|
|
23
26
|
|
|
27
|
+
from utilities.permissions import PermissionsLike
|
|
24
28
|
from utilities.types import (
|
|
25
29
|
LoggerLike,
|
|
26
30
|
MaybeIterable,
|
|
@@ -64,24 +68,67 @@ def cd_cmd(path: PathLike, /) -> list[str]:
|
|
|
64
68
|
##
|
|
65
69
|
|
|
66
70
|
|
|
67
|
-
def
|
|
68
|
-
|
|
71
|
+
def chmod(path: PathLike, perms: PermissionsLike, /, *, sudo: bool = False) -> None:
|
|
72
|
+
if sudo: # pragma: no cover
|
|
73
|
+
run(*sudo_cmd(*chmod_cmd(path, perms)))
|
|
74
|
+
else:
|
|
75
|
+
Path(path).chmod(int(ensure_perms(perms)))
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
##
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def chmod_cmd(path: PathLike, perms: PermissionsLike, /) -> list[str]:
|
|
82
|
+
return ["chmod", str(ensure_perms(perms)), str(path)]
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
##
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
def chown(
|
|
89
|
+
path: PathLike,
|
|
90
|
+
/,
|
|
91
|
+
*,
|
|
92
|
+
sudo: bool = False,
|
|
93
|
+
user: str | int | None = None,
|
|
94
|
+
group: str | int | None = None,
|
|
95
|
+
) -> None:
|
|
96
|
+
if sudo: # pragma: no cover
|
|
97
|
+
match user, group:
|
|
98
|
+
case None, None:
|
|
99
|
+
...
|
|
100
|
+
case str() | int() | None, str() | int() | None:
|
|
101
|
+
run(*sudo_cmd(*chown_cmd(path, user=user, group=group)))
|
|
102
|
+
case never:
|
|
103
|
+
assert_never(never)
|
|
104
|
+
else:
|
|
105
|
+
match user, group:
|
|
106
|
+
case None, None:
|
|
107
|
+
...
|
|
108
|
+
case str() | int(), None:
|
|
109
|
+
shutil.chown(path, user, group)
|
|
110
|
+
case None, str() | int():
|
|
111
|
+
shutil.chown(path, user, group)
|
|
112
|
+
case str() | int(), str() | int():
|
|
113
|
+
shutil.chown(path, user, group)
|
|
114
|
+
case never:
|
|
115
|
+
assert_never(never)
|
|
69
116
|
|
|
70
117
|
|
|
71
118
|
##
|
|
72
119
|
|
|
73
120
|
|
|
74
121
|
def chown_cmd(
|
|
75
|
-
path: PathLike, /, *, user: str | None = None, group: str | None = None
|
|
122
|
+
path: PathLike, /, *, user: str | int | None = None, group: str | int | None = None
|
|
76
123
|
) -> list[str]:
|
|
77
124
|
match user, group:
|
|
78
125
|
case None, None:
|
|
79
126
|
raise ChownCmdError
|
|
80
|
-
case str(), None:
|
|
127
|
+
case str() | int(), None:
|
|
81
128
|
ownership = "user"
|
|
82
|
-
case None, str():
|
|
129
|
+
case None, str() | int():
|
|
83
130
|
ownership = f":{group}"
|
|
84
|
-
case str(), str():
|
|
131
|
+
case str() | int(), str() | int():
|
|
85
132
|
ownership = f"{user}:{group}"
|
|
86
133
|
case never:
|
|
87
134
|
assert_never(never)
|
|
@@ -98,6 +145,47 @@ class ChownCmdError(Exception):
|
|
|
98
145
|
##
|
|
99
146
|
|
|
100
147
|
|
|
148
|
+
def copy_file(
|
|
149
|
+
src: PathLike,
|
|
150
|
+
dest: PathLike,
|
|
151
|
+
/,
|
|
152
|
+
*,
|
|
153
|
+
sudo: bool = False,
|
|
154
|
+
perms: PermissionsLike | None = None,
|
|
155
|
+
owner: str | int | None = None,
|
|
156
|
+
group: str | int | None = None,
|
|
157
|
+
) -> None:
|
|
158
|
+
"""Copy a file/directory from one location to another."""
|
|
159
|
+
mkdir(dest, sudo=sudo, parent=True)
|
|
160
|
+
if sudo:
|
|
161
|
+
run(*sudo_cmd(*cp_cmd(src, dest)))
|
|
162
|
+
else:
|
|
163
|
+
src, dest = map(Path, [src, dest])
|
|
164
|
+
if src.is_file():
|
|
165
|
+
_ = copyfile(src, dest)
|
|
166
|
+
elif src.is_dir():
|
|
167
|
+
_ = copytree(src, dest, dirs_exist_ok=True)
|
|
168
|
+
else:
|
|
169
|
+
raise CopyFileError(src=src, dest=dest)
|
|
170
|
+
if perms is not None:
|
|
171
|
+
chmod(dest, perms, sudo=sudo)
|
|
172
|
+
if (owner is not None) or (group is not None):
|
|
173
|
+
chown(dest, sudo=sudo, user=owner, group=group)
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
@dataclass(kw_only=True, slots=True)
|
|
177
|
+
class CopyFileError(Exception):
|
|
178
|
+
src: Path
|
|
179
|
+
dest: Path
|
|
180
|
+
|
|
181
|
+
@override
|
|
182
|
+
def __str__(self) -> str:
|
|
183
|
+
return f"Unable to copy {str(self.src)!r} to {str(self.dest)!r}; source does not exist"
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
##
|
|
187
|
+
|
|
188
|
+
|
|
101
189
|
def cp_cmd(src: PathLike, dest: PathLike, /) -> list[str]:
|
|
102
190
|
return ["cp", "-r", str(src), str(dest)]
|
|
103
191
|
|
|
@@ -173,6 +261,45 @@ def mkdir_cmd(path: PathLike, /, *, parent: bool = False) -> list[str]:
|
|
|
173
261
|
##
|
|
174
262
|
|
|
175
263
|
|
|
264
|
+
def move_file(
|
|
265
|
+
src: PathLike,
|
|
266
|
+
dest: PathLike,
|
|
267
|
+
/,
|
|
268
|
+
*,
|
|
269
|
+
sudo: bool = False,
|
|
270
|
+
perms: PermissionsLike | None = None,
|
|
271
|
+
owner: str | int | None = None,
|
|
272
|
+
group: str | int | None = None,
|
|
273
|
+
) -> None:
|
|
274
|
+
"""Move a file/directory from one location to another."""
|
|
275
|
+
mkdir(dest, sudo=sudo, parent=True)
|
|
276
|
+
if sudo:
|
|
277
|
+
run(*sudo_cmd(*cp_cmd(src, dest)))
|
|
278
|
+
else:
|
|
279
|
+
src, dest = map(Path, [src, dest])
|
|
280
|
+
if src.exists():
|
|
281
|
+
_ = move(src, dest)
|
|
282
|
+
else:
|
|
283
|
+
raise MoveFileError(src=src, dest=dest)
|
|
284
|
+
if perms is not None:
|
|
285
|
+
chmod(dest, perms, sudo=sudo)
|
|
286
|
+
if (owner is not None) or (group is not None):
|
|
287
|
+
chown(dest, sudo=sudo, user=owner, group=group)
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
@dataclass(kw_only=True, slots=True)
|
|
291
|
+
class MoveFileError(Exception):
|
|
292
|
+
src: Path
|
|
293
|
+
dest: Path
|
|
294
|
+
|
|
295
|
+
@override
|
|
296
|
+
def __str__(self) -> str:
|
|
297
|
+
return f"Unable to move {str(self.src)!r} to {str(self.dest)!r}; source does not exist"
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
##
|
|
301
|
+
|
|
302
|
+
|
|
176
303
|
def mv_cmd(src: PathLike, dest: PathLike, /) -> list[str]:
|
|
177
304
|
return ["mv", str(src), str(dest)]
|
|
178
305
|
|
|
@@ -180,6 +307,20 @@ def mv_cmd(src: PathLike, dest: PathLike, /) -> list[str]:
|
|
|
180
307
|
##
|
|
181
308
|
|
|
182
309
|
|
|
310
|
+
def remove(path: PathLike, /, *, sudo: bool = False) -> None:
|
|
311
|
+
if sudo: # pragma: no cover
|
|
312
|
+
run(*sudo_cmd(*rm_cmd(path)))
|
|
313
|
+
else:
|
|
314
|
+
path = Path(path)
|
|
315
|
+
if path.is_file():
|
|
316
|
+
path.unlink(missing_ok=True)
|
|
317
|
+
elif path.is_dir():
|
|
318
|
+
rmtree(path, ignore_errors=True)
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
##
|
|
322
|
+
|
|
323
|
+
|
|
183
324
|
def rm_cmd(path: PathLike, /) -> list[str]:
|
|
184
325
|
return ["rm", "-rf", str(path)]
|
|
185
326
|
|
|
@@ -833,10 +974,15 @@ __all__ = [
|
|
|
833
974
|
"RESTART_SSHD",
|
|
834
975
|
"UPDATE_CA_CERTIFICATES",
|
|
835
976
|
"ChownCmdError",
|
|
977
|
+
"CopyFileError",
|
|
978
|
+
"MoveFileError",
|
|
836
979
|
"apt_install_cmd",
|
|
837
980
|
"cd_cmd",
|
|
981
|
+
"chmod",
|
|
838
982
|
"chmod_cmd",
|
|
983
|
+
"chown",
|
|
839
984
|
"chown_cmd",
|
|
985
|
+
"copy_file",
|
|
840
986
|
"cp_cmd",
|
|
841
987
|
"echo_cmd",
|
|
842
988
|
"expand_path",
|
|
@@ -846,7 +992,9 @@ __all__ = [
|
|
|
846
992
|
"maybe_sudo_cmd",
|
|
847
993
|
"mkdir",
|
|
848
994
|
"mkdir_cmd",
|
|
995
|
+
"move_file",
|
|
849
996
|
"mv_cmd",
|
|
997
|
+
"remove",
|
|
850
998
|
"rm_cmd",
|
|
851
999
|
"rsync",
|
|
852
1000
|
"rsync_cmd",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/pytest_plugins/__init__.py
RENAMED
|
File without changes
|
{dycw_utilities-0.174.11 → dycw_utilities-0.174.13}/src/utilities/pytest_plugins/pytest_randomly.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|