Skip to content

Commit 17ccd64

Browse files
[pre-commit.ci] pre-commit autoupdate (#508)
* [pre-commit.ci] pre-commit autoupdate updates: - [github.com/python-jsonschema/check-jsonschema: 0.29.4 → 0.30.0](python-jsonschema/check-jsonschema@0.29.4...0.30.0) - [github.com/astral-sh/ruff-pre-commit: v0.7.4 → v0.8.2](astral-sh/ruff-pre-commit@v0.7.4...v0.8.2) - [github.com/rbubley/mirrors-prettier: v3.3.3 → v3.4.2](rbubley/mirrors-prettier@v3.3.3...v3.4.2) * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent bf8bb8d commit 17ccd64

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

.pre-commit-config.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ repos:
55
- id: end-of-file-fixer
66
- id: trailing-whitespace
77
- repo: https://github.com/python-jsonschema/check-jsonschema
8-
rev: 0.29.4
8+
rev: 0.30.0
99
hooks:
1010
- id: check-github-workflows
1111
args: ["--verbose"]
@@ -24,13 +24,13 @@ repos:
2424
hooks:
2525
- id: pyproject-fmt
2626
- repo: https://github.com/astral-sh/ruff-pre-commit
27-
rev: "v0.7.4"
27+
rev: "v0.8.2"
2828
hooks:
2929
- id: ruff-format
3030
- id: ruff
3131
args: ["--fix", "--unsafe-fixes", "--exit-non-zero-on-fix"]
3232
- repo: https://github.com/rbubley/mirrors-prettier
33-
rev: "v3.3.3" # Use the sha / tag you want to point at
33+
rev: "v3.4.2" # Use the sha / tag you want to point at
3434
hooks:
3535
- id: prettier
3636
additional_dependencies:

src/sphinx_autodoc_typehints/__init__.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -417,14 +417,14 @@ def _is_dataclass(name: str, what: str, qualname: str) -> bool:
417417

418418

419419
def _future_annotations_imported(obj: Any) -> bool:
420-
_annotations = getattr(inspect.getmodule(obj), "annotations", None)
421-
if _annotations is None:
420+
annotations_ = getattr(inspect.getmodule(obj), "annotations", None)
421+
if annotations_ is None:
422422
return False
423423

424424
# Make sure that annotations is imported from __future__ - defined in cpython/Lib/__future__.py
425425
# annotations become strings at runtime
426426
future_annotations = 0x100000 if sys.version_info[0:2] == (3, 7) else 0x1000000
427-
return bool(_annotations.compiler_flag == future_annotations)
427+
return bool(annotations_.compiler_flag == future_annotations)
428428

429429

430430
def get_all_type_hints(

tests/test_integration_autodoc_type_aliases.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ def test_integration(
151151
if regexp:
152152
msg = f"Regex pattern did not match.\n Regex: {regexp!r}\n Input: {value!r}"
153153
assert re.search(regexp, value), msg
154-
elif not re.search("WARNING: Inline strong start-string without end-string.", value):
154+
elif not re.search(r"WARNING: Inline strong start-string without end-string.", value):
155155
assert not value
156156

157157
result = (Path(app.srcdir) / "_build/text/index.txt").read_text()

tests/test_sphinx_autodoc_typehints.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ def test_format_annotation(inv: Inventory, annotation: Any, expected_result: str
491491

492492
# Test for the correct role (class vs data) using the official Sphinx inventory
493493
if "typing" in expected_result:
494-
m = re.match("^:py:(?P<role>class|data|func):`~(?P<name>[^`]+)`", result)
494+
m = re.match(r"^:py:(?P<role>class|data|func):`~(?P<name>[^`]+)`", result)
495495
assert m, "No match"
496496
name = m.group("name")
497497
expected_role = next((o.role for o in inv.objects if o.name == name), None)
@@ -905,7 +905,7 @@ def test_resolve_typing_guard_imports(app: SphinxTestApp, status: StringIO, warn
905905
out = status.getvalue()
906906
assert "build succeeded" in out
907907
err = warning.getvalue()
908-
r = re.compile("WARNING: Failed guarded type import")
908+
r = re.compile(r"WARNING: Failed guarded type import")
909909
assert len(r.findall(err)) == 1
910910
pat = r'WARNING: Failed guarded type import with ImportError\("cannot import name \'missing\' from \'functools\''
911911
assert re.search(pat, err)

0 commit comments

Comments
 (0)