Skip to content

Commit 8be80ed

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent a9b777e commit 8be80ed

File tree

6 files changed

+10
-11
lines changed

6 files changed

+10
-11
lines changed

src/compwa_policy/check_dev_files/citation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ def add_json_schema_precommit(precommit: ModifiablePrecommit) -> None:
204204
else:
205205
existing_hooks[hook_idx] = expected_hook
206206
existing_repos = precommit.document["repos"]
207-
repos_yaml = cast(CommentedSeq, existing_repos)
207+
repos_yaml = cast("CommentedSeq", existing_repos)
208208
repos_yaml.yaml_set_comment_before_after_key(repo_idx + 1, before="\n")
209209
msg = f"Updated pre-commit hook {repo_url}"
210210
precommit.changelog.append(msg)

src/compwa_policy/check_dev_files/precommit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def _update_precommit_ci_skip(precommit: ModifiablePrecommit) -> None:
118118
existing_skips = precommit_ci.get("skip")
119119
if existing_skips != expected_skips:
120120
precommit_ci["skip"] = sorted(expected_skips)
121-
yaml_config = cast(CommentedMap, precommit.document)
121+
yaml_config = cast("CommentedMap", precommit.document)
122122
yaml_config.yaml_set_comment_before_after_key("repos", before="\n")
123123
msg = "Updated ci.skip section"
124124
precommit.changelog.append(msg)

src/compwa_policy/check_dev_files/readthedocs.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def main(
5151

5252

5353
def _update_os(config: ReadTheDocs) -> None:
54-
build = cast(CommentedMap, config.document.get("build"))
54+
build = cast("CommentedMap", config.document.get("build"))
5555
if build is None:
5656
return
5757
os: str | None = build.get("os")
@@ -64,7 +64,7 @@ def _update_os(config: ReadTheDocs) -> None:
6464

6565

6666
def _update_python_version(config: ReadTheDocs, python_version: PythonVersion) -> None:
67-
tools = cast(CommentedMap, config.document.get("build", {}).get("tools"))
67+
tools = cast("CommentedMap", config.document.get("build", {}).get("tools"))
6868
if tools is None:
6969
return
7070
existing_version: str | None = tools.get("python")
@@ -307,9 +307,9 @@ def __init__(self, source: IO | Path | str) -> None:
307307
self.source = source
308308
if isinstance(source, (Path, str)):
309309
with open(source) as f:
310-
self.document = cast(dict, self.__parser.load(f))
310+
self.document = cast("dict", self.__parser.load(f))
311311
else:
312-
self.document = cast(dict, self.__parser.load(source))
312+
self.document = cast("dict", self.__parser.load(source))
313313

314314
def dump(self, target: IO | Path | str | None = None) -> None:
315315
if target is None:

src/compwa_policy/utilities/precommit/setters.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def update_single_hook_precommit_repo(
6464
expected_yaml.pop("rev", None)
6565
expected_yaml.insert(1, "rev", "PLEASE-UPDATE")
6666
idx = _determine_expected_repo_index(precommit.document, hook_id)
67-
repos_yaml = cast(CommentedSeq, repos)
67+
repos_yaml = cast("CommentedSeq", repos)
6868
repos_yaml.insert(idx, expected_yaml)
6969
if isinstance(repos_yaml, CommentedSeq):
7070
repos_yaml.yaml_set_comment_before_after_key(
@@ -81,7 +81,7 @@ def update_single_hook_precommit_repo(
8181
if existing_rev is not None:
8282
expected_yaml.insert(1, "rev", PlainScalarString(existing_rev))
8383
repos[idx] = expected_yaml # type: ignore[assignment,call-overload]
84-
repos_map = cast(CommentedMap, repos)
84+
repos_map = cast("CommentedMap", repos)
8585
repos_map.yaml_set_comment_before_after_key(idx + 1, before="\n")
8686
msg = f"Updated {hook_id} hook"
8787
precommit.changelog.append(msg)
@@ -126,7 +126,7 @@ def update_precommit_hook(
126126
hook_idx = __determine_expected_hook_idx(hooks, expected_hook["id"])
127127
hooks.insert(hook_idx, expected_hook)
128128
if hook_idx == len(hooks) - 1:
129-
repos = cast(CommentedMap, precommit.document["repos"][hook_idx])
129+
repos = cast("CommentedMap", precommit.document["repos"][hook_idx])
130130
repos.yaml_set_comment_before_after_key(repo_idx + 1, before="\n")
131131
msg = f"Added {expected_hook['id']!r} to {repo_name} pre-commit config"
132132
precommit.changelog.append(msg)

src/compwa_policy/utilities/pyproject/_struct.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# noqa: A005
21
"""This module is hidden Sphinx can't handle `typing.TypedDict` with hyphens.
32
43
See https://github.com/sphinx-doc/sphinx/issues/11039.

src/compwa_policy/utilities/pyproject/setters.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def get_sub_table(
126126
) -> MutableMapping[str, Any]:
127127
create_sub_table(config, dotted_header)
128128
table = get_immutable_sub_table(config, dotted_header)
129-
return cast(MutableMapping[str, Any], table)
129+
return cast("MutableMapping[str, Any]", table)
130130

131131

132132
def remove_dependency( # noqa: C901, PLR0912

0 commit comments

Comments
 (0)