dycw-actions 0.8.4__py3-none-any.whl → 0.8.11__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 CHANGED
@@ -1,3 +1,3 @@
1
1
  from __future__ import annotations
2
2
 
3
- __version__ = "0.8.4"
3
+ __version__ = "0.8.11"
actions/clean_dir/lib.py CHANGED
@@ -4,11 +4,9 @@ from pathlib import Path
4
4
  from shutil import rmtree
5
5
  from typing import TYPE_CHECKING
6
6
 
7
- from utilities.text import strip_and_dedent
8
-
9
- from actions import __version__
10
7
  from actions.clean_dir.settings import SETTINGS
11
8
  from actions.logging import LOGGER
9
+ from actions.utilities import log_func_call
12
10
 
13
11
  if TYPE_CHECKING:
14
12
  from collections.abc import Iterator
@@ -18,15 +16,7 @@ if TYPE_CHECKING:
18
16
 
19
17
  def clean_dir(*, dir_: PathLike = SETTINGS.dir) -> None:
20
18
  """Clean a directory."""
21
- LOGGER.info(
22
- strip_and_dedent("""
23
- Running '%s' (version %s) with settings:
24
- - dir = %s
25
- """),
26
- clean_dir.__name__,
27
- __version__,
28
- dir_,
29
- )
19
+ LOGGER.info(log_func_call(clean_dir, f"{dir_=}"))
30
20
  dir_ = Path(dir_)
31
21
  if not dir_.is_dir():
32
22
  msg = f"{str(dir_)!r} is a not a directory"
actions/constants.py CHANGED
@@ -4,7 +4,6 @@ from pathlib import Path
4
4
 
5
5
  from ruamel.yaml import YAML
6
6
  from utilities.importlib import files
7
- from utilities.pathlib import get_repo_root
8
7
  from xdg_base_dirs import xdg_cache_home
9
8
 
10
9
  ACTIONS_URL = "https://github.com/dycw/actions"
@@ -21,7 +20,6 @@ PYPROJECT_TOML = Path("pyproject.toml")
21
20
  PYRIGHTCONFIG_JSON = Path("pyrightconfig.json")
22
21
  PYTEST_TOML = Path("pytest.toml")
23
22
  README_MD = Path("README.md")
24
- REPO_ROOT = get_repo_root()
25
23
  RUFF_TOML = Path("ruff.toml")
26
24
 
27
25
 
@@ -39,7 +37,6 @@ MAX_PYTHON_VERSION = "3.14"
39
37
 
40
38
  PATH_ACTIONS = files(anchor="actions")
41
39
  PATH_CACHE = xdg_cache_home() / "actions"
42
- PATH_THROTTLE_CACHE = PATH_CACHE / "throttle" / get_repo_root().name
43
40
 
44
41
 
45
42
  YAML_INSTANCE = YAML()
@@ -62,7 +59,6 @@ __all__ = [
62
59
  "MAX_PYTHON_VERSION",
63
60
  "PATH_ACTIONS",
64
61
  "PATH_CACHE",
65
- "PATH_THROTTLE_CACHE",
66
62
  "PRE_COMMIT_CONFIG_YAML",
67
63
  "PYPROJECT_TOML",
68
64
  "PYRIGHTCONFIG_JSON",
@@ -116,7 +116,7 @@ def action_ruff_dict(*, token: str | None = SETTINGS.ci__token) -> StrDict:
116
116
  def action_run_hooks_dict(
117
117
  *,
118
118
  token: str | None = SETTINGS.ci__token,
119
- submodules: str | None = None,
119
+ submodules: str | None = SETTINGS.ci__pull_request__pre_commit__submodules,
120
120
  repos: list[str] | None = None,
121
121
  hooks: list[str] | None = None,
122
122
  hooks_exclude: list[str] | None = None,
@@ -24,6 +24,7 @@ def conformalize_repo_sub_cmd(settings: Settings, /) -> None:
24
24
  ci__pull_request__pytest__macos=settings.ci__pull_request__pytest__macos,
25
25
  ci__pull_request__pytest__ubuntu=settings.ci__pull_request__pytest__ubuntu,
26
26
  ci__pull_request__pytest__windows=settings.ci__pull_request__pytest__windows,
27
+ ci__pull_request__pytest__all_versions=settings.ci__pull_request__pytest__all_versions,
27
28
  ci__pull_request__pytest__sops_age_key=settings.ci__pull_request__pytest__sops_age_key,
28
29
  ci__pull_request__ruff=settings.ci__pull_request__ruff,
29
30
  ci__push__publish=settings.ci__push__publish,
@@ -1,10 +1,5 @@
1
1
  from __future__ import annotations
2
2
 
3
- from re import search
4
-
5
- from utilities.pytest import IS_CI
6
-
7
- from actions.constants import REPO_ROOT
8
3
  from actions.pre_commit.constants import PATH_PRE_COMMIT
9
4
 
10
5
  DOCKERFMT_URL = "https://github.com/reteps/dockerfmt"
@@ -23,18 +18,13 @@ CONFORMALIZE_REPO_SUB_CMD = "conformalize-repo"
23
18
  PATH_CONFIGS = PATH_PRE_COMMIT / "conformalize_repo/configs"
24
19
 
25
20
 
26
- RUN_VERSION_BUMP = (search("template", str(REPO_ROOT)) is None) and not IS_CI
27
-
28
-
29
21
  __all__ = [
30
22
  "CONFORMALIZE_REPO_DOCSTRING",
31
23
  "CONFORMALIZE_REPO_SUB_CMD",
32
24
  "DOCKERFMT_URL",
33
25
  "PATH_CONFIGS",
34
26
  "PRE_COMMIT_HOOKS_URL",
35
- "REPO_ROOT",
36
27
  "RUFF_URL",
37
- "RUN_VERSION_BUMP",
38
28
  "SHELLCHECK_URL",
39
29
  "SHFMT_URL",
40
30
  "TAPLO_URL",
@@ -20,9 +20,7 @@ from utilities.subprocess import ripgrep
20
20
  from utilities.text import repr_str, strip_and_dedent
21
21
  from utilities.throttle import throttle
22
22
  from utilities.version import ParseVersionError, Version, parse_version
23
- from utilities.whenever import HOUR
24
23
 
25
- from actions import __version__
26
24
  from actions.constants import (
27
25
  ACTIONS_URL,
28
26
  BUMPVERSION_TOML,
@@ -34,7 +32,6 @@ from actions.constants import (
34
32
  GITHUB_PUSH_YAML,
35
33
  GITIGNORE,
36
34
  MAX_PYTHON_VERSION,
37
- PATH_THROTTLE_CACHE,
38
35
  PRE_COMMIT_CONFIG_YAML,
39
36
  PYPROJECT_TOML,
40
37
  PYRIGHTCONFIG_JSON,
@@ -65,6 +62,7 @@ from actions.pre_commit.conformalize_repo.constants import (
65
62
  UV_URL,
66
63
  )
67
64
  from actions.pre_commit.conformalize_repo.settings import SETTINGS
65
+ from actions.pre_commit.constants import THROTTLE_DELTA
68
66
  from actions.pre_commit.format_requirements.constants import FORMAT_REQUIREMENTS_SUB_CMD
69
67
  from actions.pre_commit.replace_sequence_strs.constants import (
70
68
  REPLACE_SEQUENCE_STRS_SUB_CMD,
@@ -83,12 +81,13 @@ from actions.pre_commit.utilities import (
83
81
  get_dict,
84
82
  get_list,
85
83
  get_table,
84
+ path_throttle_cache,
86
85
  yield_json_dict,
87
86
  yield_text_file,
88
87
  yield_toml_doc,
89
88
  yield_yaml_dict,
90
89
  )
91
- from actions.utilities import logged_run
90
+ from actions.utilities import log_func_call, logged_run
92
91
 
93
92
  if TYPE_CHECKING:
94
93
  from collections.abc import Iterator, MutableSet
@@ -104,10 +103,13 @@ def conformalize_repo(
104
103
  ci__gitea: bool = SETTINGS.ci__gitea,
105
104
  ci__token: str | None = SETTINGS.ci__token,
106
105
  ci__pull_request__pre_commit: bool = SETTINGS.ci__pull_request__pre_commit,
106
+ ci__pull_request__pre_commit__submodules: str
107
+ | None = SETTINGS.ci__pull_request__pre_commit__submodules,
107
108
  ci__pull_request__pyright: bool = SETTINGS.ci__pull_request__pyright,
108
109
  ci__pull_request__pytest__macos: bool = SETTINGS.ci__pull_request__pytest__macos,
109
110
  ci__pull_request__pytest__ubuntu: bool = SETTINGS.ci__pull_request__pytest__ubuntu,
110
111
  ci__pull_request__pytest__windows: bool = SETTINGS.ci__pull_request__pytest__windows,
112
+ ci__pull_request__pytest__all_versions: bool = SETTINGS.ci__pull_request__pytest__all_versions,
111
113
  ci__pull_request__pytest__sops_age_key: str
112
114
  | None = SETTINGS.ci__pull_request__pytest__sops_age_key,
113
115
  ci__pull_request__ruff: bool = SETTINGS.ci__pull_request__ruff,
@@ -151,103 +153,56 @@ def conformalize_repo(
151
153
  script: str | None = SETTINGS.script,
152
154
  uv__native_tls: bool = SETTINGS.uv__native_tls,
153
155
  ) -> None:
154
- LOGGER.info(
155
- strip_and_dedent("""
156
- Running '%s' (version %s) with settings:
157
- - ci__ca_certificates = %s
158
- - ci__gitea = %s
159
- - ci__token = %s
160
- - ci__pull_request__pre_commit = %s
161
- - ci__pull_request__pyright = %s
162
- - ci__pull_request__pytest__macos = %s
163
- - ci__pull_request__pytest__ubuntu = %s
164
- - ci__pull_request__pytest__windows = %s
165
- - ci__pull_request__pytest__sops_age_key = %s
166
- - ci__pull_request__ruff = %s
167
- - ci__push__publish = %s
168
- - ci__push__publish__username = %s
169
- - ci__push__publish__password = %s
170
- - ci__push__publish__publish_url = %s
171
- - ci__push__tag = %s
172
- - ci__push__tag__all = %s
173
- - coverage = %s
174
- - description = %s
175
- - envrc = %s
176
- - envrc__uv = %s
177
- - gitignore = %s
178
- - package_name = %s
179
- - pre_commit__dockerfmt = %s
180
- - pre_commit__prettier = %s
181
- - pre_commit__python = %s
182
- - pre_commit__ruff = %s
183
- - pre_commit__shell = %s
184
- - pre_commit__taplo = %s
185
- - pre_commit__uv = %s
186
- - pyproject = %s
187
- - pyproject__project__optional_dependencies__scripts = %s
188
- - pyproject__tool__uv__indexes = %s
189
- - pyright = %s
190
- - pytest = %s
191
- - pytest__asyncio = %s
192
- - pytest__ignore_warnings = %s
193
- - pytest__timeout = %s
194
- - python_package_name = %s
195
- - python_version = %s
196
- - readme = %s
197
- - repo_name = %s
198
- - ruff = %s
199
- - run_version_bump = %s
200
- - script = %s
201
- - uv__native__tls = %s
202
- """),
203
- conformalize_repo.__name__,
204
- __version__,
205
- ci__ca_certificates,
206
- ci__gitea,
207
- ci__token,
208
- ci__pull_request__pre_commit,
209
- ci__pull_request__pyright,
210
- ci__pull_request__pytest__macos,
211
- ci__pull_request__pytest__ubuntu,
212
- ci__pull_request__pytest__windows,
213
- ci__pull_request__pytest__sops_age_key,
214
- ci__pull_request__ruff,
215
- ci__push__publish,
216
- ci__push__publish__username,
217
- ci__push__publish__password,
218
- ci__push__publish__publish_url,
219
- ci__push__tag,
220
- ci__push__tag__all,
221
- coverage,
222
- description,
223
- envrc,
224
- envrc__uv,
225
- gitignore,
226
- package_name,
227
- pre_commit__dockerfmt,
228
- pre_commit__prettier,
229
- pre_commit__python,
230
- pre_commit__ruff,
231
- pre_commit__shell,
232
- pre_commit__taplo,
233
- pre_commit__uv,
234
- pyproject,
235
- pyproject__project__optional_dependencies__scripts,
236
- pyproject__tool__uv__indexes,
237
- pyright,
238
- pytest,
239
- pytest__asyncio,
240
- pytest__ignore_warnings,
241
- pytest__timeout,
242
- python_package_name,
243
- python_version,
244
- readme,
245
- repo_name,
246
- ruff,
247
- run_version_bump,
248
- script,
249
- uv__native_tls,
250
- )
156
+ variables = [
157
+ f"{ci__ca_certificates=}",
158
+ f"{ci__gitea=}",
159
+ f"{ci__token=}",
160
+ f"{ci__pull_request__pre_commit=}",
161
+ f"{ci__pull_request__pre_commit__submodules=}",
162
+ f"{ci__pull_request__pyright=}",
163
+ f"{ci__pull_request__pytest__macos=}",
164
+ f"{ci__pull_request__pytest__ubuntu=}",
165
+ f"{ci__pull_request__pytest__windows=}",
166
+ f"{ci__pull_request__pytest__all_versions=}",
167
+ f"{ci__pull_request__pytest__sops_age_key=}",
168
+ f"{ci__pull_request__ruff=}",
169
+ f"{ci__push__publish=}",
170
+ f"{ci__push__publish__username=}",
171
+ f"{ci__push__publish__password=}",
172
+ f"{ci__push__publish__publish_url=}",
173
+ f"{ci__push__tag=}",
174
+ f"{ci__push__tag__all=}",
175
+ f"{coverage=}",
176
+ f"{description=}",
177
+ f"{envrc=}",
178
+ f"{envrc__uv=}",
179
+ f"{gitignore=}",
180
+ f"{package_name=}",
181
+ f"{pre_commit__dockerfmt=}",
182
+ f"{pre_commit__prettier=}",
183
+ f"{pre_commit__python=}",
184
+ f"{pre_commit__ruff=}",
185
+ f"{pre_commit__shell=}",
186
+ f"{pre_commit__taplo=}",
187
+ f"{pre_commit__uv=}",
188
+ f"{pyproject=}",
189
+ f"{pyproject__project__optional_dependencies__scripts=}",
190
+ f"{pyproject__tool__uv__indexes=}",
191
+ f"{pyright=}",
192
+ f"{pytest=}",
193
+ f"{pytest__asyncio=}",
194
+ f"{pytest__ignore_warnings=}",
195
+ f"{pytest__timeout=}",
196
+ f"{python_package_name=}",
197
+ f"{python_version=}",
198
+ f"{readme=}",
199
+ f"{repo_name=}",
200
+ f"{ruff=}",
201
+ f"{run_version_bump=}",
202
+ f"{script=}",
203
+ f"{uv__native_tls=}",
204
+ ]
205
+ LOGGER.info(log_func_call(conformalize_repo, *variables))
251
206
  modifications: set[Path] = set()
252
207
  add_bumpversion_toml(
253
208
  modifications=modifications,
@@ -273,6 +228,7 @@ def conformalize_repo(
273
228
  )
274
229
  if (
275
230
  ci__pull_request__pre_commit
231
+ or ci__pull_request__pre_commit__submodules
276
232
  or ci__pull_request__pyright
277
233
  or ci__pull_request__pytest__macos
278
234
  or ci__pull_request__pytest__ubuntu
@@ -286,6 +242,7 @@ def conformalize_repo(
286
242
  token=ci__token,
287
243
  modifications=modifications,
288
244
  pre_commit=ci__pull_request__pre_commit,
245
+ pre_commit__submodules=ci__pull_request__pre_commit__submodules,
289
246
  pyright=ci__pull_request__pyright,
290
247
  pytest__macos=ci__pull_request__pytest__macos,
291
248
  pytest__ubuntu=ci__pull_request__pytest__ubuntu,
@@ -435,10 +392,13 @@ def add_ci_pull_request_yaml(
435
392
  token: str | None = SETTINGS.ci__token,
436
393
  modifications: MutableSet[Path] | None = None,
437
394
  pre_commit: bool = SETTINGS.ci__pull_request__pre_commit,
395
+ pre_commit__submodules: str
396
+ | None = SETTINGS.ci__pull_request__pre_commit__submodules,
438
397
  pyright: bool = SETTINGS.ci__pull_request__pyright,
439
398
  pytest__macos: bool = SETTINGS.ci__pull_request__pytest__macos,
440
399
  pytest__ubuntu: bool = SETTINGS.ci__pull_request__pytest__ubuntu,
441
400
  pytest__windows: bool = SETTINGS.ci__pull_request__pytest__windows,
401
+ pytest__all_versions: bool = SETTINGS.ci__pull_request__pytest__all_versions,
442
402
  pytest__sops_age_key: str | None = SETTINGS.ci__pull_request__pytest__sops_age_key,
443
403
  pytest__timeout: int | None = SETTINGS.pytest__timeout,
444
404
  python_version: str = SETTINGS.python_version,
@@ -466,7 +426,10 @@ def add_ci_pull_request_yaml(
466
426
  ensure_contains(
467
427
  steps,
468
428
  action_run_hooks_dict(
469
- token=token, repos=["pre-commit/pre-commit-hooks"], gitea=gitea
429
+ token=token,
430
+ submodules=pre_commit__submodules,
431
+ repos=["pre-commit/pre-commit-hooks"],
432
+ gitea=gitea,
470
433
  ),
471
434
  )
472
435
  if pyright:
@@ -489,6 +452,7 @@ def add_ci_pull_request_yaml(
489
452
  or pytest__ubuntu
490
453
  or pytest__windows
491
454
  or (pytest__sops_age_key is not None)
455
+ or pytest__all_versions
492
456
  or pytest__timeout
493
457
  ):
494
458
  pytest_dict = get_dict(jobs, "pytest")
@@ -523,7 +487,12 @@ def add_ci_pull_request_yaml(
523
487
  if pytest__windows:
524
488
  ensure_contains(os, "windows-latest")
525
489
  python_version_dict = get_list(matrix, "python-version")
526
- ensure_contains(python_version_dict, *yield_python_versions(python_version))
490
+ if pytest__all_versions:
491
+ ensure_contains(
492
+ python_version_dict, *yield_python_versions(python_version)
493
+ )
494
+ else:
495
+ ensure_contains(python_version_dict, python_version)
527
496
  resolution = get_list(matrix, "resolution")
528
497
  ensure_contains(resolution, "highest", "lowest-direct")
529
498
  if pytest__timeout is not None:
@@ -1210,7 +1179,7 @@ def _run_pre_commit_update(*, modifications: MutableSet[Path] | None = None) ->
1210
1179
 
1211
1180
 
1212
1181
  run_pre_commit_update = throttle(
1213
- delta=12 * HOUR, path=PATH_THROTTLE_CACHE / _run_pre_commit_update.__name__
1182
+ delta=THROTTLE_DELTA, path=path_throttle_cache(_run_pre_commit_update)
1214
1183
  )(_run_pre_commit_update)
1215
1184
 
1216
1185
 
@@ -1,8 +1,8 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  from typed_settings import Secret, load_settings, option, secret, settings
4
+ from utilities.pytest import IS_CI
4
5
 
5
- from actions.pre_commit.conformalize_repo.constants import RUN_VERSION_BUMP
6
6
  from actions.utilities import LOADER
7
7
 
8
8
 
@@ -16,6 +16,9 @@ class Settings:
16
16
  ci__pull_request__pre_commit: bool = option(
17
17
  default=False, help="Set up CI 'pull-request.yaml' pre-commit"
18
18
  )
19
+ ci__pull_request__pre_commit__submodules: str | None = option(
20
+ default=None, help="Set up CI 'pull-request.yaml' pre-commit with submodules"
21
+ )
19
22
  ci__pull_request__pyright: bool = option(
20
23
  default=False, help="Set up CI 'pull-request.yaml' pyright"
21
24
  )
@@ -28,6 +31,9 @@ class Settings:
28
31
  ci__pull_request__pytest__windows: bool = option(
29
32
  default=False, help="Set up CI 'pull-request.yaml' pytest with Windows"
30
33
  )
34
+ ci__pull_request__pytest__all_versions: bool = option(
35
+ default=False, help="Set up CI 'pull-request.yaml' pytest with all versions"
36
+ )
31
37
  ci__pull_request__pytest__sops_age_key: str | None = option(
32
38
  default=None,
33
39
  help="Set up CI 'pull-request.yaml' pytest with this 'age' key for 'sops'",
@@ -102,7 +108,7 @@ class Settings:
102
108
  readme: bool = option(default=False, help="Set up 'README.md'")
103
109
  repo_name: str | None = option(default=None, help="Repo name")
104
110
  ruff: bool = option(default=False, help="Set up 'ruff.toml'")
105
- run_version_bump: bool = option(default=RUN_VERSION_BUMP, help="Run version bump")
111
+ run_version_bump: bool = option(default=not IS_CI, help="Run version bump")
106
112
  uv__native_tls: bool = option(default=False, help="Setup 'uv' with native TLS")
107
113
  script: str | None = option(
108
114
  default=None, help="Set up a script instead of a package"
@@ -1,8 +1,11 @@
1
1
  from __future__ import annotations
2
2
 
3
+ from utilities.whenever import HOUR
4
+
3
5
  from actions.constants import PATH_ACTIONS
4
6
 
5
7
  PATH_PRE_COMMIT = PATH_ACTIONS / "pre_commit"
8
+ THROTTLE_DELTA = 12 * HOUR
6
9
 
7
10
 
8
- __all__ = ["PATH_PRE_COMMIT"]
11
+ __all__ = ["PATH_PRE_COMMIT", "THROTTLE_DELTA"]
@@ -3,11 +3,11 @@ from __future__ import annotations
3
3
  import sys
4
4
  from typing import TYPE_CHECKING
5
5
 
6
- from utilities.text import repr_str, strip_and_dedent
6
+ from utilities.text import repr_str
7
7
 
8
- from actions import __version__
9
8
  from actions.logging import LOGGER
10
9
  from actions.pre_commit.utilities import get_pyproject_dependencies, yield_toml_doc
10
+ from actions.utilities import log_func_call
11
11
 
12
12
  if TYPE_CHECKING:
13
13
  from collections.abc import MutableSet
@@ -18,15 +18,7 @@ if TYPE_CHECKING:
18
18
 
19
19
 
20
20
  def format_requirements(*paths: PathLike) -> None:
21
- LOGGER.info(
22
- strip_and_dedent("""
23
- Running '%s' (version %s) with settings:
24
- - paths = %s
25
- """),
26
- format_requirements.__name__,
27
- __version__,
28
- paths,
29
- )
21
+ LOGGER.info(log_func_call(format_requirements, f"{paths=}"))
30
22
  modifications: set[Path] = set()
31
23
  for path in paths:
32
24
  _format_path(path, modifications=modifications)
@@ -10,11 +10,11 @@ from libcst.matchers import Subscript as MSubscript
10
10
  from libcst.matchers import SubscriptElement as MSubscriptElement
11
11
  from libcst.matchers import matches
12
12
  from libcst.metadata import MetadataWrapper
13
- from utilities.text import repr_str, strip_and_dedent
13
+ from utilities.text import repr_str
14
14
 
15
- from actions import __version__
16
15
  from actions.logging import LOGGER
17
16
  from actions.pre_commit.utilities import yield_python_file
17
+ from actions.utilities import log_func_call
18
18
 
19
19
  if TYPE_CHECKING:
20
20
  from collections.abc import MutableSet
@@ -24,15 +24,7 @@ if TYPE_CHECKING:
24
24
 
25
25
 
26
26
  def replace_sequence_strs(*paths: PathLike) -> None:
27
- LOGGER.info(
28
- strip_and_dedent("""
29
- Running '%s' (version %s) with settings:
30
- - paths = %s
31
- """),
32
- replace_sequence_strs.__name__,
33
- __version__,
34
- paths,
35
- )
27
+ LOGGER.info(log_func_call(replace_sequence_strs, f"{paths=}"))
36
28
  modifications: set[Path] = set()
37
29
  for path in paths:
38
30
  _format_path(path, modifications=modifications)
@@ -4,14 +4,13 @@ import sys
4
4
  from typing import TYPE_CHECKING
5
5
 
6
6
  from libcst import parse_statement
7
- from utilities.text import repr_str, strip_and_dedent
7
+ from utilities.text import repr_str
8
8
  from utilities.throttle import throttle
9
- from utilities.whenever import HOUR
10
9
 
11
- from actions import __version__
12
- from actions.constants import PATH_THROTTLE_CACHE
13
10
  from actions.logging import LOGGER
14
- from actions.pre_commit.utilities import yield_python_file
11
+ from actions.pre_commit.constants import THROTTLE_DELTA
12
+ from actions.pre_commit.utilities import path_throttle_cache, yield_python_file
13
+ from actions.utilities import log_func_call
15
14
 
16
15
  if TYPE_CHECKING:
17
16
  from collections.abc import MutableSet
@@ -21,15 +20,7 @@ if TYPE_CHECKING:
21
20
 
22
21
 
23
22
  def _touch_empty_py(*paths: PathLike) -> None:
24
- LOGGER.info(
25
- strip_and_dedent("""
26
- Running '%s' (version %s) with settings:
27
- - paths = %s
28
- """),
29
- touch_empty_py.__name__,
30
- __version__,
31
- paths,
32
- )
23
+ LOGGER.info(log_func_call(touch_empty_py, f"{paths=}"))
33
24
  modifications: set[Path] = set()
34
25
  for path in paths:
35
26
  _format_path(path, modifications=modifications)
@@ -42,7 +33,7 @@ def _touch_empty_py(*paths: PathLike) -> None:
42
33
 
43
34
 
44
35
  touch_empty_py = throttle(
45
- delta=12 * HOUR, path=PATH_THROTTLE_CACHE / _touch_empty_py.__name__
36
+ delta=THROTTLE_DELTA, path=path_throttle_cache(_touch_empty_py)
46
37
  )(_touch_empty_py)
47
38
 
48
39
 
@@ -5,13 +5,13 @@ from pathlib import Path
5
5
  from typing import TYPE_CHECKING
6
6
 
7
7
  from utilities.iterables import one
8
- from utilities.text import repr_str, strip_and_dedent
8
+ from utilities.text import repr_str
9
9
  from utilities.throttle import throttle
10
- from utilities.whenever import HOUR
11
10
 
12
- from actions import __version__
13
- from actions.constants import PATH_THROTTLE_CACHE
14
11
  from actions.logging import LOGGER
12
+ from actions.pre_commit.constants import THROTTLE_DELTA
13
+ from actions.pre_commit.utilities import path_throttle_cache
14
+ from actions.utilities import log_func_call
15
15
 
16
16
  if TYPE_CHECKING:
17
17
  from collections.abc import MutableSet
@@ -20,15 +20,7 @@ if TYPE_CHECKING:
20
20
 
21
21
 
22
22
  def _touch_py_typed(*paths: PathLike) -> None:
23
- LOGGER.info(
24
- strip_and_dedent("""
25
- Running '%s' (version %s) with settings:
26
- - paths = %s
27
- """),
28
- touch_py_typed.__name__,
29
- __version__,
30
- paths,
31
- )
23
+ LOGGER.info(log_func_call(touch_py_typed, f"{paths=}"))
32
24
  modifications: set[Path] = set()
33
25
  for path in paths:
34
26
  _format_path(path, modifications=modifications)
@@ -41,7 +33,7 @@ def _touch_py_typed(*paths: PathLike) -> None:
41
33
 
42
34
 
43
35
  touch_py_typed = throttle(
44
- delta=12 * HOUR, path=PATH_THROTTLE_CACHE / _touch_py_typed.__name__
36
+ delta=THROTTLE_DELTA, path=path_throttle_cache(_touch_py_typed)
45
37
  )(_touch_py_typed)
46
38
 
47
39
 
@@ -6,9 +6,8 @@ from typing import TYPE_CHECKING
6
6
 
7
7
  from pydantic import TypeAdapter
8
8
  from utilities.functions import max_nullable
9
- from utilities.text import repr_str, strip_and_dedent
9
+ from utilities.text import repr_str
10
10
 
11
- from actions import __version__
12
11
  from actions.logging import LOGGER
13
12
  from actions.pre_commit.update_requirements.classes import (
14
13
  PipListOutdatedOutput,
@@ -20,7 +19,7 @@ from actions.pre_commit.update_requirements.classes import (
20
19
  parse_version2_or_3,
21
20
  )
22
21
  from actions.pre_commit.utilities import get_pyproject_dependencies, yield_toml_doc
23
- from actions.utilities import logged_run
22
+ from actions.utilities import log_func_call, logged_run
24
23
 
25
24
  if TYPE_CHECKING:
26
25
  from collections.abc import MutableSet
@@ -33,15 +32,7 @@ if TYPE_CHECKING:
33
32
 
34
33
 
35
34
  def update_requirements(*paths: PathLike) -> None:
36
- LOGGER.info(
37
- strip_and_dedent("""
38
- Running '%s' (version %s) with settings:
39
- - paths = %s
40
- """),
41
- update_requirements.__name__,
42
- __version__,
43
- paths,
44
- )
35
+ LOGGER.info(log_func_call(update_requirements, f"{paths=}"))
45
36
  modifications: set[Path] = set()
46
37
  for path in paths:
47
38
  _format_path(path, modifications=modifications)