dycw-actions 0.6.4__py3-none-any.whl → 0.7.1__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.
- actions/__init__.py +1 -1
- actions/action_dicts/lib.py +8 -8
- actions/clean_dir/cli.py +0 -12
- actions/clean_dir/constants.py +7 -0
- actions/cli.py +81 -30
- actions/pre_commit/click.py +15 -0
- actions/{conformalize_repo → pre_commit/conformalize_repo}/cli.py +2 -14
- actions/{conformalize_repo → pre_commit/conformalize_repo}/constants.py +8 -2
- actions/{conformalize_repo → pre_commit/conformalize_repo}/lib.py +79 -308
- actions/{conformalize_repo → pre_commit/conformalize_repo}/settings.py +1 -1
- actions/pre_commit/constants.py +8 -0
- actions/pre_commit/format_requirements/cli.py +24 -0
- actions/pre_commit/format_requirements/constants.py +7 -0
- actions/pre_commit/format_requirements/lib.py +52 -0
- actions/pre_commit/replace_sequence_strs/__init__.py +1 -0
- actions/pre_commit/replace_sequence_strs/cli.py +24 -0
- actions/pre_commit/replace_sequence_strs/constants.py +7 -0
- actions/{replace_sequence_strs → pre_commit/replace_sequence_strs}/lib.py +16 -22
- actions/pre_commit/touch_empty_py/__init__.py +1 -0
- actions/pre_commit/touch_empty_py/cli.py +24 -0
- actions/pre_commit/touch_empty_py/constants.py +7 -0
- actions/pre_commit/touch_empty_py/lib.py +54 -0
- actions/pre_commit/touch_py_typed/__init__.py +1 -0
- actions/pre_commit/touch_py_typed/cli.py +24 -0
- actions/pre_commit/touch_py_typed/constants.py +7 -0
- actions/pre_commit/touch_py_typed/lib.py +64 -0
- actions/pre_commit/update_requirements/__init__.py +1 -0
- actions/pre_commit/update_requirements/classes.py +117 -0
- actions/pre_commit/update_requirements/cli.py +24 -0
- actions/pre_commit/update_requirements/constants.py +7 -0
- actions/pre_commit/update_requirements/lib.py +128 -0
- actions/pre_commit/utilities.py +386 -0
- actions/publish_package/cli.py +7 -19
- actions/publish_package/constants.py +7 -0
- actions/publish_package/lib.py +3 -3
- actions/py.typed +0 -0
- actions/random_sleep/cli.py +6 -15
- actions/random_sleep/constants.py +7 -0
- actions/run_hooks/cli.py +3 -15
- actions/run_hooks/constants.py +7 -0
- actions/run_hooks/lib.py +2 -2
- actions/setup_cronjob/cli.py +0 -12
- actions/setup_cronjob/constants.py +5 -1
- actions/tag_commit/cli.py +7 -19
- actions/tag_commit/constants.py +7 -0
- actions/tag_commit/lib.py +8 -8
- actions/types.py +4 -1
- actions/utilities.py +68 -14
- {dycw_actions-0.6.4.dist-info → dycw_actions-0.7.1.dist-info}/METADATA +3 -2
- dycw_actions-0.7.1.dist-info/RECORD +77 -0
- actions/format_requirements/cli.py +0 -37
- actions/format_requirements/lib.py +0 -121
- actions/publish_package/doc.py +0 -6
- actions/random_sleep/doc.py +0 -6
- actions/replace_sequence_strs/cli.py +0 -37
- actions/run_hooks/doc.py +0 -6
- actions/tag_commit/doc.py +0 -6
- dycw_actions-0.6.4.dist-info/RECORD +0 -56
- /actions/{conformalize_repo → pre_commit}/__init__.py +0 -0
- /actions/{format_requirements → pre_commit/conformalize_repo}/__init__.py +0 -0
- /actions/{conformalize_repo → pre_commit/conformalize_repo}/configs/gitignore +0 -0
- /actions/{replace_sequence_strs → pre_commit/format_requirements}/__init__.py +0 -0
- {dycw_actions-0.6.4.dist-info → dycw_actions-0.7.1.dist-info}/WHEEL +0 -0
- {dycw_actions-0.6.4.dist-info → dycw_actions-0.7.1.dist-info}/entry_points.txt +0 -0
actions/tag_commit/lib.py
CHANGED
|
@@ -9,7 +9,7 @@ from utilities.version import parse_version
|
|
|
9
9
|
from actions import __version__
|
|
10
10
|
from actions.logging import LOGGER
|
|
11
11
|
from actions.tag_commit.settings import SETTINGS
|
|
12
|
-
from actions.utilities import
|
|
12
|
+
from actions.utilities import logged_run
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
def tag_commit(
|
|
@@ -37,10 +37,10 @@ def tag_commit(
|
|
|
37
37
|
major,
|
|
38
38
|
latest,
|
|
39
39
|
)
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
logged_run("git", "config", "--global", "user.name", user_name)
|
|
41
|
+
logged_run("git", "config", "--global", "user.email", user_email)
|
|
42
42
|
version = parse_version(
|
|
43
|
-
|
|
43
|
+
logged_run("bump-my-version", "show", "current_version", return_=True)
|
|
44
44
|
)
|
|
45
45
|
_tag(str(version))
|
|
46
46
|
if major_minor:
|
|
@@ -53,11 +53,11 @@ def tag_commit(
|
|
|
53
53
|
|
|
54
54
|
def _tag(version: str, /) -> None:
|
|
55
55
|
with suppress(CalledProcessError):
|
|
56
|
-
|
|
56
|
+
logged_run("git", "tag", "--delete", version)
|
|
57
57
|
with suppress(CalledProcessError):
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
logged_run("git", "push", "--delete", "origin", version)
|
|
59
|
+
logged_run("git", "tag", "-a", version, "HEAD", "-m", version)
|
|
60
|
+
logged_run("git", "push", "--tags", "--force", "--set-upstream", "origin")
|
|
61
61
|
|
|
62
62
|
|
|
63
63
|
__all__ = ["tag_commit"]
|
actions/types.py
CHANGED
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
+
from collections.abc import Callable
|
|
3
4
|
from typing import TYPE_CHECKING, Any
|
|
4
5
|
|
|
5
6
|
from tomlkit.items import Array, Table
|
|
6
7
|
from typed_settings import Secret
|
|
8
|
+
from utilities.packaging import Requirement
|
|
7
9
|
|
|
8
10
|
if TYPE_CHECKING:
|
|
9
11
|
from tomlkit.container import Container
|
|
10
12
|
|
|
11
13
|
|
|
14
|
+
type FuncRequirement = Callable[[Requirement], Requirement]
|
|
12
15
|
type HasAppend = Array | list[Any]
|
|
13
16
|
type HasSetDefault = Container | StrDict | Table
|
|
14
17
|
type SecretLike = str | Secret[str]
|
|
15
18
|
type StrDict = dict[str, Any]
|
|
16
19
|
|
|
17
20
|
|
|
18
|
-
__all__ = ["HasAppend", "HasSetDefault", "SecretLike", "StrDict"]
|
|
21
|
+
__all__ = ["FuncRequirement", "HasAppend", "HasSetDefault", "SecretLike", "StrDict"]
|
actions/utilities.py
CHANGED
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
-
from
|
|
3
|
+
from io import StringIO
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
from typing import TYPE_CHECKING, Any, Literal, assert_never, overload
|
|
4
6
|
|
|
5
7
|
from typed_settings import EnvLoader, Secret
|
|
8
|
+
from utilities.atomicwrites import writer
|
|
6
9
|
from utilities.subprocess import run
|
|
7
10
|
|
|
11
|
+
from actions.constants import YAML_INSTANCE
|
|
8
12
|
from actions.logging import LOGGER
|
|
9
13
|
|
|
10
14
|
if TYPE_CHECKING:
|
|
11
|
-
from
|
|
15
|
+
from collections.abc import MutableSet
|
|
16
|
+
|
|
17
|
+
from utilities.types import PathLike, StrStrMapping
|
|
12
18
|
|
|
13
19
|
from actions.types import SecretLike
|
|
14
20
|
|
|
@@ -16,6 +22,10 @@ if TYPE_CHECKING:
|
|
|
16
22
|
LOADER = EnvLoader("")
|
|
17
23
|
|
|
18
24
|
|
|
25
|
+
def are_equal_modulo_new_line(x: str, y: str, /) -> bool:
|
|
26
|
+
return ensure_new_line(x) == ensure_new_line(y)
|
|
27
|
+
|
|
28
|
+
|
|
19
29
|
def convert_list_strs(
|
|
20
30
|
x: str | list[str] | tuple[str, ...] | None, /
|
|
21
31
|
) -> list[str] | None:
|
|
@@ -60,51 +70,95 @@ def convert_str(x: str | None, /) -> str | None:
|
|
|
60
70
|
assert_never(never)
|
|
61
71
|
|
|
62
72
|
|
|
73
|
+
def copy_text(
|
|
74
|
+
src: PathLike, dest: PathLike, /, *, modifications: MutableSet[Path] | None = None
|
|
75
|
+
) -> None:
|
|
76
|
+
LOGGER.info("Copying '%s' -> '%s'...", str(src), str(dest))
|
|
77
|
+
text = Path(src).read_text()
|
|
78
|
+
write_text(dest, text, modifications=modifications)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def ensure_new_line(text: str, /) -> str:
|
|
82
|
+
return text.strip("\n") + "\n"
|
|
83
|
+
|
|
84
|
+
|
|
63
85
|
@overload
|
|
64
|
-
def
|
|
86
|
+
def logged_run(
|
|
65
87
|
cmd: SecretLike,
|
|
66
88
|
/,
|
|
67
|
-
*
|
|
89
|
+
*cmds_or_args: SecretLike,
|
|
68
90
|
env: StrStrMapping | None = None,
|
|
69
91
|
print: bool = False,
|
|
70
92
|
return_: Literal[True],
|
|
71
93
|
) -> str: ...
|
|
72
94
|
@overload
|
|
73
|
-
def
|
|
95
|
+
def logged_run(
|
|
74
96
|
cmd: SecretLike,
|
|
75
97
|
/,
|
|
76
|
-
*
|
|
98
|
+
*cmds_or_args: SecretLike,
|
|
77
99
|
env: StrStrMapping | None = None,
|
|
78
100
|
print: bool = False,
|
|
79
101
|
return_: Literal[False] = False,
|
|
80
102
|
) -> None: ...
|
|
81
103
|
@overload
|
|
82
|
-
def
|
|
104
|
+
def logged_run(
|
|
83
105
|
cmd: SecretLike,
|
|
84
106
|
/,
|
|
85
|
-
*
|
|
107
|
+
*cmds_or_args: SecretLike,
|
|
86
108
|
env: StrStrMapping | None = None,
|
|
87
109
|
print: bool = False,
|
|
88
110
|
return_: bool = False,
|
|
89
111
|
) -> str | None: ...
|
|
90
|
-
def
|
|
112
|
+
def logged_run(
|
|
91
113
|
cmd: SecretLike,
|
|
92
114
|
/,
|
|
93
|
-
*
|
|
115
|
+
*cmds_or_args: SecretLike,
|
|
94
116
|
env: StrStrMapping | None = None,
|
|
95
117
|
print: bool = False, # noqa: A002
|
|
96
118
|
return_: bool = False,
|
|
97
119
|
) -> str | None:
|
|
98
|
-
|
|
99
|
-
LOGGER.info("Running '%s'...", " ".join(map(str,
|
|
100
|
-
unwrapped
|
|
120
|
+
cmds_and_args = [cmd, *cmds_or_args]
|
|
121
|
+
LOGGER.info("Running '%s'...", " ".join(map(str, cmds_and_args)))
|
|
122
|
+
unwrapped: list[str] = []
|
|
123
|
+
for ca in cmds_and_args:
|
|
124
|
+
match ca:
|
|
125
|
+
case Secret():
|
|
126
|
+
unwrapped.append(ca.get_secret_value())
|
|
127
|
+
case str():
|
|
128
|
+
unwrapped.append(ca)
|
|
129
|
+
case never:
|
|
130
|
+
assert_never(never)
|
|
101
131
|
return run(*unwrapped, env=env, print=print, return_=return_, logger=LOGGER)
|
|
102
132
|
|
|
103
133
|
|
|
134
|
+
def write_text(
|
|
135
|
+
path: PathLike, text: str, /, *, modifications: MutableSet[Path] | None = None
|
|
136
|
+
) -> None:
|
|
137
|
+
LOGGER.info("Writing '%s'...", str(path))
|
|
138
|
+
with writer(path, overwrite=True) as temp:
|
|
139
|
+
_ = temp.write_text(ensure_new_line(text))
|
|
140
|
+
if modifications is not None:
|
|
141
|
+
modifications.add(Path(path))
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
def yaml_dump(obj: Any, /) -> str:
|
|
145
|
+
stream = StringIO()
|
|
146
|
+
YAML_INSTANCE.dump(obj, stream)
|
|
147
|
+
return stream.getvalue()
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
##
|
|
151
|
+
|
|
152
|
+
|
|
104
153
|
__all__ = [
|
|
105
154
|
"LOADER",
|
|
155
|
+
"are_equal_modulo_new_line",
|
|
106
156
|
"convert_list_strs",
|
|
107
157
|
"convert_secret_str",
|
|
108
158
|
"convert_str",
|
|
109
|
-
"
|
|
159
|
+
"copy_text",
|
|
160
|
+
"ensure_new_line",
|
|
161
|
+
"logged_run",
|
|
162
|
+
"write_text",
|
|
163
|
+
"yaml_dump",
|
|
110
164
|
]
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: dycw-actions
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.7.1
|
|
4
4
|
Summary: Library of actions
|
|
5
5
|
Requires-Dist: click>=8.3.1,<9
|
|
6
|
-
Requires-Dist: dycw-utilities>=0.
|
|
6
|
+
Requires-Dist: dycw-utilities>=0.177.0,<1
|
|
7
7
|
Requires-Dist: inflect>=7.5.0,<8
|
|
8
8
|
Requires-Dist: libcst>=1.8.6,<2
|
|
9
9
|
Requires-Dist: packaging>=25.0,<26
|
|
10
|
+
Requires-Dist: pydantic>=2.12.5,<3
|
|
10
11
|
Requires-Dist: pyyaml>=6.0.3,<7
|
|
11
12
|
Requires-Dist: rich>=14.2.0,<15
|
|
12
13
|
Requires-Dist: ruamel-yaml>=0.19.0,<1
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
actions/__init__.py,sha256=_OevY0-QRr7A22CyPm0BKMCDflx5qu_IVMMkCcVHxdE,58
|
|
2
|
+
actions/action_dicts/__init__.py,sha256=U4S_2y3zgLZVfMenHRaJFBW8yqh2mUBuI291LGQVOJ8,35
|
|
3
|
+
actions/action_dicts/constants.py,sha256=tYYLr3aRRRvnR6NSADOJMN-B6gtqg2A9gBuheEPyGy4,189
|
|
4
|
+
actions/action_dicts/lib.py,sha256=MpK_y5Jao0-3p6bWeYX5QQy3-JjMxwyzXRU5LjO25Iw,5547
|
|
5
|
+
actions/clean_dir/__init__.py,sha256=U4S_2y3zgLZVfMenHRaJFBW8yqh2mUBuI291LGQVOJ8,35
|
|
6
|
+
actions/clean_dir/cli.py,sha256=OrFA2nEN2LyGF22mhTNEBr7KSuKgX54sGy9RyE73qUc,569
|
|
7
|
+
actions/clean_dir/constants.py,sha256=aDNaYtemEv3lcMXo96Oh4pw_HASMby1GZC1D_gbjPAc,167
|
|
8
|
+
actions/clean_dir/lib.py,sha256=s8FdQBd9-PVmPixWFRmpcK6oOHrdutIxtsCSf1N1Tws,1577
|
|
9
|
+
actions/clean_dir/settings.py,sha256=mqM0Oq-yz4dXKcUi3JmOCvDhoeBNQm_Qe70cGmhdcQE,345
|
|
10
|
+
actions/cli.py,sha256=NPiRNWXUyYLcalbDdsQaYDtjdkfSPvR3i6SyVrD5NUQ,4079
|
|
11
|
+
actions/constants.py,sha256=SO0SBwEW8Wn5Uzt95OvlwTctyH0K7uvXMnNf1uCkrxk,212
|
|
12
|
+
actions/logging.py,sha256=rMTcQMGndUHTCaXXtyOHt_VXUMhQGRHoN7okpoX0y5I,120
|
|
13
|
+
actions/pre_commit/__init__.py,sha256=U4S_2y3zgLZVfMenHRaJFBW8yqh2mUBuI291LGQVOJ8,35
|
|
14
|
+
actions/pre_commit/click.py,sha256=BLHjkO0gIW7rgLabuWnszwXmI4yb8Li5D8gt81GR-FQ,270
|
|
15
|
+
actions/pre_commit/conformalize_repo/__init__.py,sha256=U4S_2y3zgLZVfMenHRaJFBW8yqh2mUBuI291LGQVOJ8,35
|
|
16
|
+
actions/pre_commit/conformalize_repo/cli.py,sha256=rPrxobdo4sKnq0de_UWDtrHqlhF6GTAabRhw_1XBeZY,3063
|
|
17
|
+
actions/pre_commit/conformalize_repo/configs/gitignore,sha256=8YCRPwysCD8-67yFXaTg6O8TTl4xeNIh7_DVmaU5Ix0,5063
|
|
18
|
+
actions/pre_commit/conformalize_repo/constants.py,sha256=7WMbc1BwkVPJIf3eh3MaCoWj5A7pSPvNic28nrFTcoA,2148
|
|
19
|
+
actions/pre_commit/conformalize_repo/lib.py,sha256=rgUQjX1ScjQcLeXx9cPqFqGYQmHprUhDodxEjp7RonM,47604
|
|
20
|
+
actions/pre_commit/conformalize_repo/settings.py,sha256=Oz2AeStS64DFzT1HKJ888_7tiU1TdJIGBarvyKYfp4E,4985
|
|
21
|
+
actions/pre_commit/constants.py,sha256=NBJ5GBMg5qhMAhAfxx1FKw0CdPwW_wG2cUJJ0dkF5HE,158
|
|
22
|
+
actions/pre_commit/format_requirements/__init__.py,sha256=U4S_2y3zgLZVfMenHRaJFBW8yqh2mUBuI291LGQVOJ8,35
|
|
23
|
+
actions/pre_commit/format_requirements/cli.py,sha256=c9UdOFDLEei5AEzrVvo6FopIEOf2EqyOliA-bOR5a2o,584
|
|
24
|
+
actions/pre_commit/format_requirements/constants.py,sha256=ly41jgwq0VVyHQqHaIXRc5ZmbWrNY_C3ET4G9gtE7rI,228
|
|
25
|
+
actions/pre_commit/format_requirements/lib.py,sha256=AGgtJ-4fBesv-BSFYExLu5rcLV6hfElVk1IxNtCXIAs,1399
|
|
26
|
+
actions/pre_commit/replace_sequence_strs/__init__.py,sha256=U4S_2y3zgLZVfMenHRaJFBW8yqh2mUBuI291LGQVOJ8,35
|
|
27
|
+
actions/pre_commit/replace_sequence_strs/cli.py,sha256=S8T-p0ex5lLmJz-5G7xDwPYnrwV82mf8UtwWtLIr36E,594
|
|
28
|
+
actions/pre_commit/replace_sequence_strs/constants.py,sha256=yEEgJUpw3URzv8Cb4nIgBY2xAzEfJIF6yzyUy6K55J4,250
|
|
29
|
+
actions/pre_commit/replace_sequence_strs/lib.py,sha256=FzfwYeL3bhTCYbb1T-Yk1NtdH3SFNKFC2x0JgdT4bXA,2166
|
|
30
|
+
actions/pre_commit/touch_empty_py/__init__.py,sha256=U4S_2y3zgLZVfMenHRaJFBW8yqh2mUBuI291LGQVOJ8,35
|
|
31
|
+
actions/pre_commit/touch_empty_py/cli.py,sha256=s2S5OfAGcSLtd2aGm1ooa1k20oNK-LQ1PZWz6T30vO8,559
|
|
32
|
+
actions/pre_commit/touch_empty_py/constants.py,sha256=zSwH60zfn9RhIAbBFnXjHrm2s1nFpPUskX3CZuJpQLk,198
|
|
33
|
+
actions/pre_commit/touch_empty_py/lib.py,sha256=avGiqWRi0x7E4zvvyxaqv_ccRpOT8Le7ol4_ETaXx2s,1458
|
|
34
|
+
actions/pre_commit/touch_py_typed/__init__.py,sha256=U4S_2y3zgLZVfMenHRaJFBW8yqh2mUBuI291LGQVOJ8,35
|
|
35
|
+
actions/pre_commit/touch_py_typed/cli.py,sha256=CDJV4NuUHJlSdJ84dY0XvdwYHMdqygZ7C6x07B-iN3E,559
|
|
36
|
+
actions/pre_commit/touch_py_typed/constants.py,sha256=kLZOm_wgypp7MaXRYq-6AZqVE4OttOMKmUqt11V2zn0,191
|
|
37
|
+
actions/pre_commit/touch_py_typed/lib.py,sha256=Vsi1oDC6nUvWlQdA_a5t-kM5W5o3v0PBZZQe3_QS3Zo,1772
|
|
38
|
+
actions/pre_commit/update_requirements/__init__.py,sha256=U4S_2y3zgLZVfMenHRaJFBW8yqh2mUBuI291LGQVOJ8,35
|
|
39
|
+
actions/pre_commit/update_requirements/classes.py,sha256=STRC3LS_2PkdvHPgPxkNAcSIDiomzsKhyiP5uhcLUe0,3266
|
|
40
|
+
actions/pre_commit/update_requirements/cli.py,sha256=CBfm8M7hwSRw8KS6ttiNE86IFHJ52V42AxlfakqTDN0,584
|
|
41
|
+
actions/pre_commit/update_requirements/constants.py,sha256=ve44_RYed_41ckgQNPkb08u7Y1cpLpzutGSL9FdGBF8,228
|
|
42
|
+
actions/pre_commit/update_requirements/lib.py,sha256=o3wUfeof-6oLYziHE74Q8WIHk4nyOv5PcK8cFkazm1k,4107
|
|
43
|
+
actions/pre_commit/utilities.py,sha256=L1HCi3l778REPfomMuYbxrrnCn0FDRFaWAfmFR0lsTY,11422
|
|
44
|
+
actions/publish_package/__init__.py,sha256=U4S_2y3zgLZVfMenHRaJFBW8yqh2mUBuI291LGQVOJ8,35
|
|
45
|
+
actions/publish_package/cli.py,sha256=nAPHCq67mxUb3yHepVGcoQ69qgaQahM1-cxdbHfxQg0,803
|
|
46
|
+
actions/publish_package/constants.py,sha256=C68ZCVL_jVlYdLGpOK6saZccWoFy5AmC_NMBIWYdYOE,209
|
|
47
|
+
actions/publish_package/lib.py,sha256=WSGpXtZsTWL5tkoih4VTKLvtX6B8KmsO1jolT83S22A,1754
|
|
48
|
+
actions/publish_package/settings.py,sha256=UucS_yb-es9bDz0EPeWTIql6B1Dr4kcaEMdXpt23BNQ,935
|
|
49
|
+
actions/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
50
|
+
actions/random_sleep/__init__.py,sha256=U4S_2y3zgLZVfMenHRaJFBW8yqh2mUBuI291LGQVOJ8,35
|
|
51
|
+
actions/random_sleep/cli.py,sha256=-d9y63oWgvQtNp9j_8v3zt5gKl-GrUq8-b3Ky52R42c,693
|
|
52
|
+
actions/random_sleep/constants.py,sha256=5GMqCD1f12uyKDVTZBbnDDn6TQa99mUYZb9p-crg5BA,190
|
|
53
|
+
actions/random_sleep/lib.py,sha256=JzgpeEONdKXSBeNc3ex9goVyJR3bsa76lB_tkH1Ggc0,1762
|
|
54
|
+
actions/random_sleep/settings.py,sha256=F8gO2j2EEX8moemwhWWCPdRuOpZ_qLtqzSfWhjIy3P8,529
|
|
55
|
+
actions/run_hooks/__init__.py,sha256=U4S_2y3zgLZVfMenHRaJFBW8yqh2mUBuI291LGQVOJ8,35
|
|
56
|
+
actions/run_hooks/cli.py,sha256=xKBw6iIlHpUlHl6-QWQLSL6KKVjnsihBeJ7h58Rl8P4,616
|
|
57
|
+
actions/run_hooks/constants.py,sha256=JRhDk08qbzo5C-zwHdXZV5ajvNSKh4GcOcBvOIY6IGU,172
|
|
58
|
+
actions/run_hooks/lib.py,sha256=a-eUOtgTouxJYCsLRjsPIXl6nP58T2RB4jhr-Hhz0Sg,2850
|
|
59
|
+
actions/run_hooks/settings.py,sha256=XbQe1j1oEvDnbl4H6B-YEY6Ms6qlsj-N2XSJhdVHCWA,606
|
|
60
|
+
actions/setup_cronjob/__init__.py,sha256=U4S_2y3zgLZVfMenHRaJFBW8yqh2mUBuI291LGQVOJ8,35
|
|
61
|
+
actions/setup_cronjob/cli.py,sha256=l6t2WjCUprACV0rY8kHvpHLt3LgMI4q2XY4AEOiutkk,891
|
|
62
|
+
actions/setup_cronjob/configs/cron.tmpl,sha256=UD_d0LYlB6tbkXAcUTzpGDWVNgIhCR45Jgky91iSCP8,412
|
|
63
|
+
actions/setup_cronjob/configs/logrotate.tmpl,sha256=kkMuCRe4l03er6cFmRI0CXerHYmDumnMXLGKBjXLVxo,137
|
|
64
|
+
actions/setup_cronjob/constants.py,sha256=CNebyWFymrXBx3X9X7XXpU9PSd5wzUN6XkUVomSBnWQ,301
|
|
65
|
+
actions/setup_cronjob/lib.py,sha256=p6ndCc4e01pS-aLK_Qqn26qSto9krt26cOR23m4YiYg,3411
|
|
66
|
+
actions/setup_cronjob/settings.py,sha256=SxSe25f0sHUgq2-xdJN6rbbaSVFQE7FuEisiO_fmZNw,990
|
|
67
|
+
actions/tag_commit/__init__.py,sha256=U4S_2y3zgLZVfMenHRaJFBW8yqh2mUBuI291LGQVOJ8,35
|
|
68
|
+
actions/tag_commit/cli.py,sha256=1E6cM0XKTCt_Ukb7pxqOojHpJjoa63dVBO6DXoESe9Q,745
|
|
69
|
+
actions/tag_commit/constants.py,sha256=ceOvQpY4dgtJSd7v_jI1V00S0SjRq2ToGeZu41-DL7M,176
|
|
70
|
+
actions/tag_commit/lib.py,sha256=rq1SqAkNp98cPsNOsFY4F1D6nNi7N3wqVbFPno8lsuI,1849
|
|
71
|
+
actions/tag_commit/settings.py,sha256=TOeKG_GODP--2lBSyGzH_M32jDIfh4vk_Ts06R3_ak4,629
|
|
72
|
+
actions/types.py,sha256=GRXLoJtYWmRjgfatDDRMcXKZkN9ZtK1Fi2MEyAZ84uk,591
|
|
73
|
+
actions/utilities.py,sha256=VpFLBiAezgSRlm9dvnyPyQohreaV2Lv7cJ9HAxqZ4WI,4086
|
|
74
|
+
dycw_actions-0.7.1.dist-info/WHEEL,sha256=KSLUh82mDPEPk0Bx0ScXlWL64bc8KmzIPNcpQZFV-6E,79
|
|
75
|
+
dycw_actions-0.7.1.dist-info/entry_points.txt,sha256=2Uu7wAZOm0mmcsGBEsGB370HAWgVWECRFJ9rKgfC3-I,46
|
|
76
|
+
dycw_actions-0.7.1.dist-info/METADATA,sha256=T4208DBQxD3yT09fwfKIiVGyOvSax8tyqNt8MxNGBLM,619
|
|
77
|
+
dycw_actions-0.7.1.dist-info/RECORD,,
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
from pathlib import Path
|
|
4
|
-
|
|
5
|
-
import click
|
|
6
|
-
from click import argument
|
|
7
|
-
from utilities.logging import basic_config
|
|
8
|
-
from utilities.os import is_pytest
|
|
9
|
-
from utilities.text import strip_and_dedent
|
|
10
|
-
|
|
11
|
-
from actions import __version__
|
|
12
|
-
from actions.format_requirements.lib import format_requirements
|
|
13
|
-
from actions.logging import LOGGER
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
@argument(
|
|
17
|
-
"paths",
|
|
18
|
-
nargs=-1,
|
|
19
|
-
type=click.Path(exists=True, file_okay=True, dir_okay=False, path_type=Path),
|
|
20
|
-
)
|
|
21
|
-
def format_requirements_sub_cmd(*, paths: tuple[Path, ...]) -> None:
|
|
22
|
-
if is_pytest():
|
|
23
|
-
return
|
|
24
|
-
basic_config(obj=LOGGER)
|
|
25
|
-
LOGGER.info(
|
|
26
|
-
strip_and_dedent("""
|
|
27
|
-
Running '%s' (version %s) with settings:
|
|
28
|
-
- paths = %s
|
|
29
|
-
"""),
|
|
30
|
-
format_requirements.__name__,
|
|
31
|
-
__version__,
|
|
32
|
-
paths,
|
|
33
|
-
)
|
|
34
|
-
format_requirements(*paths)
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
__all__ = ["format_requirements_sub_cmd"]
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
import sys
|
|
4
|
-
from pathlib import Path
|
|
5
|
-
from typing import TYPE_CHECKING, Any, override
|
|
6
|
-
|
|
7
|
-
from packaging._tokenizer import ParserSyntaxError
|
|
8
|
-
from packaging.requirements import InvalidRequirement, Requirement, _parse_requirement
|
|
9
|
-
from packaging.specifiers import Specifier, SpecifierSet
|
|
10
|
-
from tomlkit import TOMLDocument, array, dumps, loads, string
|
|
11
|
-
from tomlkit.items import Array, Table
|
|
12
|
-
from utilities.text import repr_str, strip_and_dedent
|
|
13
|
-
|
|
14
|
-
from actions import __version__
|
|
15
|
-
from actions.logging import LOGGER
|
|
16
|
-
|
|
17
|
-
if TYPE_CHECKING:
|
|
18
|
-
from collections.abc import Iterator
|
|
19
|
-
|
|
20
|
-
from utilities.types import PathLike
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
_MODIFICATIONS: set[Path] = set()
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
def format_requirements(*paths: PathLike) -> None:
|
|
27
|
-
LOGGER.info(
|
|
28
|
-
strip_and_dedent("""
|
|
29
|
-
Running '%s' (version %s) with settings:
|
|
30
|
-
- paths = %s
|
|
31
|
-
"""),
|
|
32
|
-
format_requirements.__name__,
|
|
33
|
-
__version__,
|
|
34
|
-
paths,
|
|
35
|
-
)
|
|
36
|
-
for path in paths:
|
|
37
|
-
_format_path(path)
|
|
38
|
-
if len(_MODIFICATIONS) >= 1:
|
|
39
|
-
LOGGER.info(
|
|
40
|
-
"Exiting due to modifications: %s",
|
|
41
|
-
", ".join(map(repr_str, sorted(_MODIFICATIONS))),
|
|
42
|
-
)
|
|
43
|
-
sys.exit(1)
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
def _format_path(path: PathLike, /) -> None:
|
|
47
|
-
path = Path(path)
|
|
48
|
-
current = loads(path.read_text())
|
|
49
|
-
expected = _get_formatted(path)
|
|
50
|
-
is_equal = current == expected # tomlkit cannot handle !=
|
|
51
|
-
if not is_equal:
|
|
52
|
-
_ = path.write_text(dumps(expected).rstrip("\n") + "\n")
|
|
53
|
-
_MODIFICATIONS.add(path)
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
def _get_formatted(path: PathLike, /) -> TOMLDocument:
|
|
57
|
-
path = Path(path)
|
|
58
|
-
doc = loads(path.read_text())
|
|
59
|
-
if isinstance(dep_grps := doc.get("dependency-groups"), Table):
|
|
60
|
-
for key, value in dep_grps.items():
|
|
61
|
-
if isinstance(value, Array):
|
|
62
|
-
dep_grps[key] = _format_array(value)
|
|
63
|
-
if isinstance(project := doc["project"], Table):
|
|
64
|
-
if isinstance(deps := project["dependencies"], Array):
|
|
65
|
-
project["dependencies"] = _format_array(deps)
|
|
66
|
-
if isinstance(optional := project.get("optional-dependencies"), Table):
|
|
67
|
-
for key, value in optional.items():
|
|
68
|
-
if isinstance(value, Array):
|
|
69
|
-
optional[key] = _format_array(value)
|
|
70
|
-
return doc
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
def _format_array(dependencies: Array, /) -> Array:
|
|
74
|
-
new = array().multiline(multiline=True)
|
|
75
|
-
new.extend(map(_format_item, dependencies))
|
|
76
|
-
return new
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
def _format_item(item: Any, /) -> Any:
|
|
80
|
-
if not isinstance(item, str):
|
|
81
|
-
return item
|
|
82
|
-
return string(str(_CustomRequirement(item)))
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
class _CustomRequirement(Requirement):
|
|
86
|
-
@override
|
|
87
|
-
def __init__(self, requirement_string: str) -> None:
|
|
88
|
-
super().__init__(requirement_string)
|
|
89
|
-
try:
|
|
90
|
-
parsed = _parse_requirement(requirement_string)
|
|
91
|
-
except ParserSyntaxError as e:
|
|
92
|
-
raise InvalidRequirement(str(e)) from e
|
|
93
|
-
self.specifier = _CustomSpecifierSet(parsed.specifier)
|
|
94
|
-
|
|
95
|
-
@override
|
|
96
|
-
def _iter_parts(self, name: str) -> Iterator[str]:
|
|
97
|
-
yield name
|
|
98
|
-
if self.extras:
|
|
99
|
-
formatted_extras = ",".join(sorted(self.extras))
|
|
100
|
-
yield f"[{formatted_extras}]"
|
|
101
|
-
if self.specifier:
|
|
102
|
-
yield f" {self.specifier}"
|
|
103
|
-
if self.url:
|
|
104
|
-
yield f"@ {self.url}"
|
|
105
|
-
if self.marker:
|
|
106
|
-
yield " "
|
|
107
|
-
if self.marker:
|
|
108
|
-
yield f"; {self.marker}"
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
class _CustomSpecifierSet(SpecifierSet):
|
|
112
|
-
@override
|
|
113
|
-
def __str__(self) -> str:
|
|
114
|
-
specs = sorted(self._specs, key=self._key)
|
|
115
|
-
return ", ".join(map(str, specs))
|
|
116
|
-
|
|
117
|
-
def _key(self, spec: Specifier, /) -> int:
|
|
118
|
-
return [">=", "<"].index(spec.operator)
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
__all__ = ["format_requirements"]
|
actions/publish_package/doc.py
DELETED
actions/random_sleep/doc.py
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
from pathlib import Path
|
|
4
|
-
|
|
5
|
-
import click
|
|
6
|
-
from click import argument
|
|
7
|
-
from utilities.logging import basic_config
|
|
8
|
-
from utilities.os import is_pytest
|
|
9
|
-
from utilities.text import strip_and_dedent
|
|
10
|
-
|
|
11
|
-
from actions import __version__
|
|
12
|
-
from actions.logging import LOGGER
|
|
13
|
-
from actions.replace_sequence_strs.lib import replace_sequence_strs
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
@argument(
|
|
17
|
-
"paths",
|
|
18
|
-
nargs=-1,
|
|
19
|
-
type=click.Path(exists=True, file_okay=True, dir_okay=False, path_type=Path),
|
|
20
|
-
)
|
|
21
|
-
def sequence_strs_sub_cmd(*, paths: tuple[Path, ...]) -> None:
|
|
22
|
-
if is_pytest():
|
|
23
|
-
return
|
|
24
|
-
basic_config(obj=LOGGER)
|
|
25
|
-
LOGGER.info(
|
|
26
|
-
strip_and_dedent("""
|
|
27
|
-
Running '%s' (version %s) with settings:
|
|
28
|
-
- paths = %s
|
|
29
|
-
"""),
|
|
30
|
-
replace_sequence_strs.__name__,
|
|
31
|
-
__version__,
|
|
32
|
-
paths,
|
|
33
|
-
)
|
|
34
|
-
replace_sequence_strs(*paths)
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
__all__ = ["sequence_strs_sub_cmd"]
|
actions/run_hooks/doc.py
DELETED
actions/tag_commit/doc.py
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
actions/__init__.py,sha256=mcL5eixWYUyfOx2GXC_AEe0GPlGaIobkG5nOgff8q_8,58
|
|
2
|
-
actions/action_dicts/__init__.py,sha256=U4S_2y3zgLZVfMenHRaJFBW8yqh2mUBuI291LGQVOJ8,35
|
|
3
|
-
actions/action_dicts/constants.py,sha256=tYYLr3aRRRvnR6NSADOJMN-B6gtqg2A9gBuheEPyGy4,189
|
|
4
|
-
actions/action_dicts/lib.py,sha256=5qtDFe3yuYkCKBbGMDTiljzmptB41D7SbZxQjxngTqg,5461
|
|
5
|
-
actions/clean_dir/__init__.py,sha256=U4S_2y3zgLZVfMenHRaJFBW8yqh2mUBuI291LGQVOJ8,35
|
|
6
|
-
actions/clean_dir/cli.py,sha256=rLD6s_xND4gI3SunDv0x0O26aD7r29sZox9BzTLOFls,895
|
|
7
|
-
actions/clean_dir/lib.py,sha256=s8FdQBd9-PVmPixWFRmpcK6oOHrdutIxtsCSf1N1Tws,1577
|
|
8
|
-
actions/clean_dir/settings.py,sha256=mqM0Oq-yz4dXKcUi3JmOCvDhoeBNQm_Qe70cGmhdcQE,345
|
|
9
|
-
actions/cli.py,sha256=PG3ZptwRUlO986dEZVDkgnkyoKxYtj0uzF0eVnNu8sI,2030
|
|
10
|
-
actions/conformalize_repo/__init__.py,sha256=U4S_2y3zgLZVfMenHRaJFBW8yqh2mUBuI291LGQVOJ8,35
|
|
11
|
-
actions/conformalize_repo/cli.py,sha256=gyEq22d8yCh_1LjGrcVV036s6--3G521aRLuruTmYUw,3375
|
|
12
|
-
actions/conformalize_repo/configs/gitignore,sha256=8YCRPwysCD8-67yFXaTg6O8TTl4xeNIh7_DVmaU5Ix0,5063
|
|
13
|
-
actions/conformalize_repo/constants.py,sha256=r8bi7QQckhzd-uJgHoAy04x_qTPt0ocSFXsEVxxmrcg,1961
|
|
14
|
-
actions/conformalize_repo/lib.py,sha256=Txob9thmmeqJz1eH7W3f8f-4x4LZ_5mwA11FlKTsurk,53140
|
|
15
|
-
actions/conformalize_repo/settings.py,sha256=uCCIrDEdPpP_SvVgQlJ-1KtQmB3T_CTsVykYx898328,4974
|
|
16
|
-
actions/constants.py,sha256=SO0SBwEW8Wn5Uzt95OvlwTctyH0K7uvXMnNf1uCkrxk,212
|
|
17
|
-
actions/format_requirements/__init__.py,sha256=U4S_2y3zgLZVfMenHRaJFBW8yqh2mUBuI291LGQVOJ8,35
|
|
18
|
-
actions/format_requirements/cli.py,sha256=AyG-J2udPO92hH7-p_M2tInSllxM74WrR2ttz7iODbo,908
|
|
19
|
-
actions/format_requirements/lib.py,sha256=ovZAolTQQAAMVabBxyWNuY13ENp8-vRnRt1ymFurVhQ,3709
|
|
20
|
-
actions/logging.py,sha256=rMTcQMGndUHTCaXXtyOHt_VXUMhQGRHoN7okpoX0y5I,120
|
|
21
|
-
actions/publish_package/__init__.py,sha256=U4S_2y3zgLZVfMenHRaJFBW8yqh2mUBuI291LGQVOJ8,35
|
|
22
|
-
actions/publish_package/cli.py,sha256=J4RWGM6jYLCFJ38eLkzf0w_dmH5VFUS2zQi3P0Qf62M,1147
|
|
23
|
-
actions/publish_package/doc.py,sha256=wQ4Dktc78r5CTlqHi-LycXTKdyJqUPpI5r-YYabNCMw,106
|
|
24
|
-
actions/publish_package/lib.py,sha256=gZBbeCE45hCIvjaV5Pg7LBscBAYj2feoH4cz5TFg2wA,1745
|
|
25
|
-
actions/publish_package/settings.py,sha256=UucS_yb-es9bDz0EPeWTIql6B1Dr4kcaEMdXpt23BNQ,935
|
|
26
|
-
actions/random_sleep/__init__.py,sha256=U4S_2y3zgLZVfMenHRaJFBW8yqh2mUBuI291LGQVOJ8,35
|
|
27
|
-
actions/random_sleep/cli.py,sha256=z8ZrB8bKbxZ6JI7ypG1Ob3yVr0nNvU9T_XkM5u3XHUI,996
|
|
28
|
-
actions/random_sleep/doc.py,sha256=mmMYy8XbeiuyMACzq8uYru7FqlDZToMTdubblM2cKAY,102
|
|
29
|
-
actions/random_sleep/lib.py,sha256=JzgpeEONdKXSBeNc3ex9goVyJR3bsa76lB_tkH1Ggc0,1762
|
|
30
|
-
actions/random_sleep/settings.py,sha256=F8gO2j2EEX8moemwhWWCPdRuOpZ_qLtqzSfWhjIy3P8,529
|
|
31
|
-
actions/replace_sequence_strs/__init__.py,sha256=U4S_2y3zgLZVfMenHRaJFBW8yqh2mUBuI291LGQVOJ8,35
|
|
32
|
-
actions/replace_sequence_strs/cli.py,sha256=XSGTTLBOpbwtfFZLTv31pUlD07yoEJfNXRrptiTOs84,904
|
|
33
|
-
actions/replace_sequence_strs/lib.py,sha256=F1YFX9nrcMWnfvDtnx4jEXIHiX7LgB3vQGfjOQsjKXA,2260
|
|
34
|
-
actions/run_hooks/__init__.py,sha256=U4S_2y3zgLZVfMenHRaJFBW8yqh2mUBuI291LGQVOJ8,35
|
|
35
|
-
actions/run_hooks/cli.py,sha256=mDbUBC1BEwfbyJ-vp-7vBqjtQ2AjPioYSaAi3FAL9Fk,944
|
|
36
|
-
actions/run_hooks/doc.py,sha256=DPE1g-sJ_7jhffHZA6sIsCRUvkVPpTxRm4UM42XK8hU,99
|
|
37
|
-
actions/run_hooks/lib.py,sha256=8brWxMn333eVzjHn2-hCTm6ca8tnyD_dQQqPc7rFqTY,2844
|
|
38
|
-
actions/run_hooks/settings.py,sha256=XbQe1j1oEvDnbl4H6B-YEY6Ms6qlsj-N2XSJhdVHCWA,606
|
|
39
|
-
actions/setup_cronjob/__init__.py,sha256=U4S_2y3zgLZVfMenHRaJFBW8yqh2mUBuI291LGQVOJ8,35
|
|
40
|
-
actions/setup_cronjob/cli.py,sha256=Hb-4SiWGV5S18YAOK7_rc1SmHEM-z-Zg0qNSPlCmh4U,1221
|
|
41
|
-
actions/setup_cronjob/configs/cron.tmpl,sha256=UD_d0LYlB6tbkXAcUTzpGDWVNgIhCR45Jgky91iSCP8,412
|
|
42
|
-
actions/setup_cronjob/configs/logrotate.tmpl,sha256=kkMuCRe4l03er6cFmRI0CXerHYmDumnMXLGKBjXLVxo,137
|
|
43
|
-
actions/setup_cronjob/constants.py,sha256=lq3snzPD7HPGqo0j7Mdjz-Di9sHCaWOslZjZptM6UC0,163
|
|
44
|
-
actions/setup_cronjob/lib.py,sha256=p6ndCc4e01pS-aLK_Qqn26qSto9krt26cOR23m4YiYg,3411
|
|
45
|
-
actions/setup_cronjob/settings.py,sha256=SxSe25f0sHUgq2-xdJN6rbbaSVFQE7FuEisiO_fmZNw,990
|
|
46
|
-
actions/tag_commit/__init__.py,sha256=U4S_2y3zgLZVfMenHRaJFBW8yqh2mUBuI291LGQVOJ8,35
|
|
47
|
-
actions/tag_commit/cli.py,sha256=IB3xE-eS6lX41zL4lr8hdIU6KMp1rO0b4OQuleiGtEc,1052
|
|
48
|
-
actions/tag_commit/doc.py,sha256=sY4orbkesFLTdfW4xJIE2bU1wQU-mWAYGU7k1nwMgec,98
|
|
49
|
-
actions/tag_commit/lib.py,sha256=MklNv3A3yy5RrOABhJQQJVi_rIbM_R3gVPf1ULMDTKQ,1825
|
|
50
|
-
actions/tag_commit/settings.py,sha256=TOeKG_GODP--2lBSyGzH_M32jDIfh4vk_Ts06R3_ak4,629
|
|
51
|
-
actions/types.py,sha256=sCMcl4ukOD9ct6hf-m6KAM6ZypdVZ32K1s_W6NxKdyQ,431
|
|
52
|
-
actions/utilities.py,sha256=lzfDRBwhGYsLAN__r6vnxSkpUINdQVf6Hclz6Q-jCGM,2606
|
|
53
|
-
dycw_actions-0.6.4.dist-info/WHEEL,sha256=KSLUh82mDPEPk0Bx0ScXlWL64bc8KmzIPNcpQZFV-6E,79
|
|
54
|
-
dycw_actions-0.6.4.dist-info/entry_points.txt,sha256=2Uu7wAZOm0mmcsGBEsGB370HAWgVWECRFJ9rKgfC3-I,46
|
|
55
|
-
dycw_actions-0.6.4.dist-info/METADATA,sha256=pjDIBgx3QZwt2Pg5LLUmos1ZlrmG1hswxcqdY_9uC68,584
|
|
56
|
-
dycw_actions-0.6.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|