dycw-pre-commit-hooks 0.12.7__tar.gz → 0.12.9__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_pre_commit_hooks-0.12.7 → dycw_pre_commit_hooks-0.12.9}/PKG-INFO +1 -1
- {dycw_pre_commit_hooks-0.12.7 → dycw_pre_commit_hooks-0.12.9}/pyproject.toml +2 -2
- {dycw_pre_commit_hooks-0.12.7 → dycw_pre_commit_hooks-0.12.9}/src/pre_commit_hooks/__init__.py +1 -1
- {dycw_pre_commit_hooks-0.12.7 → dycw_pre_commit_hooks-0.12.9}/src/pre_commit_hooks/check_submodules/__init__.py +12 -5
- {dycw_pre_commit_hooks-0.12.7 → dycw_pre_commit_hooks-0.12.9}/src/pre_commit_hooks/mirror_files/__init__.py +16 -6
- {dycw_pre_commit_hooks-0.12.7 → dycw_pre_commit_hooks-0.12.9}/.gitignore +0 -0
- {dycw_pre_commit_hooks-0.12.7 → dycw_pre_commit_hooks-0.12.9}/README.md +0 -0
- {dycw_pre_commit_hooks-0.12.7 → dycw_pre_commit_hooks-0.12.9}/src/pre_commit_hooks/check_submodules/__main__.py +0 -0
- {dycw_pre_commit_hooks-0.12.7 → dycw_pre_commit_hooks-0.12.9}/src/pre_commit_hooks/common.py +0 -0
- {dycw_pre_commit_hooks-0.12.7 → dycw_pre_commit_hooks-0.12.9}/src/pre_commit_hooks/format_requirements/__init__.py +0 -0
- {dycw_pre_commit_hooks-0.12.7 → dycw_pre_commit_hooks-0.12.9}/src/pre_commit_hooks/format_requirements/__main__.py +0 -0
- {dycw_pre_commit_hooks-0.12.7 → dycw_pre_commit_hooks-0.12.9}/src/pre_commit_hooks/mirror_files/__main__.py +0 -0
- {dycw_pre_commit_hooks-0.12.7 → dycw_pre_commit_hooks-0.12.9}/src/pre_commit_hooks/py.typed +0 -0
- {dycw_pre_commit_hooks-0.12.7 → dycw_pre_commit_hooks-0.12.9}/src/pre_commit_hooks/replace_sequence_str/__init__.py +0 -0
- {dycw_pre_commit_hooks-0.12.7 → dycw_pre_commit_hooks-0.12.9}/src/pre_commit_hooks/replace_sequence_str/__main__.py +0 -0
- {dycw_pre_commit_hooks-0.12.7 → dycw_pre_commit_hooks-0.12.9}/src/pre_commit_hooks/run_bump_my_version/__init__.py +0 -0
- {dycw_pre_commit_hooks-0.12.7 → dycw_pre_commit_hooks-0.12.9}/src/pre_commit_hooks/run_bump_my_version/__main__.py +0 -0
- {dycw_pre_commit_hooks-0.12.7 → dycw_pre_commit_hooks-0.12.9}/src/pre_commit_hooks/tag_commits/__init__.py +0 -0
- {dycw_pre_commit_hooks-0.12.7 → dycw_pre_commit_hooks-0.12.9}/src/pre_commit_hooks/tag_commits/__main__.py +0 -0
- {dycw_pre_commit_hooks-0.12.7 → dycw_pre_commit_hooks-0.12.9}/src/tests/__init__.py +0 -0
- {dycw_pre_commit_hooks-0.12.7 → dycw_pre_commit_hooks-0.12.9}/src/tests/format_requirements/__init__.py +0 -0
- {dycw_pre_commit_hooks-0.12.7 → dycw_pre_commit_hooks-0.12.9}/src/tests/format_requirements/in.toml +0 -0
- {dycw_pre_commit_hooks-0.12.7 → dycw_pre_commit_hooks-0.12.9}/src/tests/format_requirements/out.toml +0 -0
- {dycw_pre_commit_hooks-0.12.7 → dycw_pre_commit_hooks-0.12.9}/src/tests/format_requirements/test_format_requirements.py +0 -0
- {dycw_pre_commit_hooks-0.12.7 → dycw_pre_commit_hooks-0.12.9}/src/tests/test_main.py +0 -0
|
@@ -31,7 +31,7 @@ dependencies = [
|
|
|
31
31
|
name = "dycw-pre-commit-hooks"
|
|
32
32
|
readme = "README.md"
|
|
33
33
|
requires-python = ">= 3.12"
|
|
34
|
-
version = "0.12.
|
|
34
|
+
version = "0.12.9"
|
|
35
35
|
|
|
36
36
|
[project.scripts]
|
|
37
37
|
check-submodules = "pre_commit_hooks.check_submodules:main"
|
|
@@ -44,7 +44,7 @@ tag-commits = "pre_commit_hooks.tag_commits:main"
|
|
|
44
44
|
# bump-my-version
|
|
45
45
|
[tool.bumpversion]
|
|
46
46
|
allow_dirty = true
|
|
47
|
-
current_version = "0.12.
|
|
47
|
+
current_version = "0.12.9"
|
|
48
48
|
|
|
49
49
|
[[tool.bumpversion.files]]
|
|
50
50
|
filename = "src/pre_commit_hooks/__init__.py"
|
|
@@ -2,7 +2,8 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
from typing import TYPE_CHECKING
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
import utilities.click
|
|
6
|
+
from click import argument, command
|
|
6
7
|
from git import Repo, Submodule
|
|
7
8
|
|
|
8
9
|
from pre_commit_hooks.common import (
|
|
@@ -16,18 +17,24 @@ from pre_commit_hooks.common import (
|
|
|
16
17
|
)
|
|
17
18
|
|
|
18
19
|
if TYPE_CHECKING:
|
|
20
|
+
from pathlib import Path
|
|
21
|
+
|
|
19
22
|
from whenever import DateTimeDelta
|
|
20
23
|
|
|
21
24
|
|
|
22
25
|
@command()
|
|
26
|
+
@argument("paths", nargs=-1, type=utilities.click.Path())
|
|
23
27
|
@run_every_option
|
|
24
|
-
def main(*, run_every: DateTimeDelta | None = None) -> bool:
|
|
28
|
+
def main(*, paths: tuple[Path, ...], run_every: DateTimeDelta | None = None) -> bool:
|
|
25
29
|
"""CLI for the `check-submodules` hook."""
|
|
26
|
-
|
|
30
|
+
results = [
|
|
31
|
+
throttled_run("check-submodules", run_every, _process, p) for p in paths
|
|
32
|
+
] # run all
|
|
33
|
+
return all(results)
|
|
27
34
|
|
|
28
35
|
|
|
29
|
-
def _process() -> bool:
|
|
30
|
-
repo = Repo(
|
|
36
|
+
def _process(path: Path, /) -> bool:
|
|
37
|
+
repo = Repo(path, search_parent_directories=True)
|
|
31
38
|
results = [_process_submodule(s) for s in repo.submodules] # run all
|
|
32
39
|
return all(results)
|
|
33
40
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
-
from typing import TYPE_CHECKING
|
|
3
|
+
from typing import TYPE_CHECKING, Literal
|
|
4
4
|
|
|
5
5
|
import utilities.click
|
|
6
6
|
from click import argument, command
|
|
@@ -36,11 +36,21 @@ def _process(paths: Iterable[Path], /) -> bool:
|
|
|
36
36
|
|
|
37
37
|
def _process_pair(paths: Iterable[Path], /) -> bool:
|
|
38
38
|
path_from, path_to = paths
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
try:
|
|
40
|
+
text_from = path_from.read_text()
|
|
41
|
+
except FileNotFoundError:
|
|
42
|
+
logger.exception(f"Source file {str(path_from)!r} not found")
|
|
43
|
+
raise
|
|
44
|
+
try:
|
|
45
|
+
text_to = path_to.read_text()
|
|
46
|
+
except FileNotFoundError:
|
|
47
|
+
return _write_text(text_from, path_to)
|
|
48
|
+
return True if text_from == text_to else _write_text(text_from, path_to)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def _write_text(text: str, path: Path, /) -> Literal[False]:
|
|
52
|
+
with writer(path, overwrite=True) as temp:
|
|
53
|
+
_ = temp.write_text(text)
|
|
44
54
|
return False
|
|
45
55
|
|
|
46
56
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dycw_pre_commit_hooks-0.12.7 → dycw_pre_commit_hooks-0.12.9}/src/pre_commit_hooks/common.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
|
{dycw_pre_commit_hooks-0.12.7 → dycw_pre_commit_hooks-0.12.9}/src/tests/format_requirements/in.toml
RENAMED
|
File without changes
|
{dycw_pre_commit_hooks-0.12.7 → dycw_pre_commit_hooks-0.12.9}/src/tests/format_requirements/out.toml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|