Skip to content

Commit 89988e6

Browse files
[pre-commit.ci] pre-commit autoupdate (#372)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 55b62de commit 89988e6

File tree

3 files changed

+16
-15
lines changed

3 files changed

+16
-15
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ repos:
55
- id: end-of-file-fixer
66
- id: trailing-whitespace
77
- repo: https://github.com/astral-sh/ruff-pre-commit
8-
rev: "v0.0.277"
8+
rev: "v0.0.278"
99
hooks:
1010
- id: ruff
1111
args: [--fix, --exit-non-zero-on-fix]
1212
- repo: https://github.com/psf/black
13-
rev: 23.3.0
13+
rev: 23.7.0
1414
hooks:
1515
- id: black
1616
- repo: https://github.com/tox-dev/tox-ini-fmt

src/sphinx_autodoc_typehints/patches.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def napoleon_numpy_docstring_return_type_processor( # noqa: PLR0913
5656
# Underline detection.
5757
chars = set(lines[pos + 1].strip())
5858
# Napoleon allows the underline to consist of a bunch of weirder things...
59-
if len(chars) != 1 or list(chars)[0] not in "=-~_*+#":
59+
if len(chars) != 1 or next(iter(chars)) not in "=-~_*+#":
6060
continue
6161
pos = pos + 2 # noqa: PLW2901
6262
break

tests/test_sphinx_autodoc_typehints.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@
5555
nptyping = None # type: ignore[assignment]
5656

5757
T = TypeVar("T")
58-
U = TypeVar("U", covariant=True)
59-
V = TypeVar("V", contravariant=True)
58+
U_co = TypeVar("U_co", covariant=True)
59+
V_contra = TypeVar("V_contra", contravariant=True)
6060
X = TypeVar("X", str, int)
6161
Y = TypeVar("Y", bound=str)
6262
Z = TypeVar("Z", bound="A")
@@ -211,13 +211,14 @@ def test_parse_annotation(annotation: Any, module: str, class_name: str, args: t
211211
":py:class:`~typing.Mapping`\\[:py:class:`~typing.TypeVar`\\(``T``), :py:class:`int`]",
212212
),
213213
(
214-
Mapping[str, V], # type: ignore[valid-type]
215-
":py:class:`~typing.Mapping`\\[:py:class:`str`, :py:class:`~typing.TypeVar`\\(``V``, contravariant=True)]",
214+
Mapping[str, V_contra], # type: ignore[valid-type]
215+
":py:class:`~typing.Mapping`\\[:py:class:`str`, :py:class:`~typing.TypeVar`\\("
216+
"``V_contra``, contravariant=True)]",
216217
),
217218
(
218-
Mapping[T, U], # type: ignore[valid-type]
219+
Mapping[T, U_co], # type: ignore[valid-type]
219220
":py:class:`~typing.Mapping`\\[:py:class:`~typing.TypeVar`\\(``T``), "
220-
":py:class:`~typing.TypeVar`\\(``U``, covariant=True)]",
221+
":py:class:`~typing.TypeVar`\\(``U_co``, covariant=True)]",
221222
),
222223
(Mapping[str, bool], ":py:class:`~typing.Mapping`\\[:py:class:`str`, :py:class:`bool`]"),
223224
(Dict, ":py:class:`~typing.Dict`"),
@@ -226,13 +227,13 @@ def test_parse_annotation(annotation: Any, module: str, class_name: str, args: t
226227
":py:class:`~typing.Dict`\\[:py:class:`~typing.TypeVar`\\(``T``), :py:class:`int`]",
227228
),
228229
(
229-
Dict[str, V], # type: ignore[valid-type]
230-
":py:class:`~typing.Dict`\\[:py:class:`str`, :py:class:`~typing.TypeVar`\\(``V``, contravariant=True)]",
230+
Dict[str, V_contra], # type: ignore[valid-type]
231+
":py:class:`~typing.Dict`\\[:py:class:`str`, :py:class:`~typing.TypeVar`\\(``V_contra``, contravariant=True)]",
231232
),
232233
(
233-
Dict[T, U], # type: ignore[valid-type]
234+
Dict[T, U_co], # type: ignore[valid-type]
234235
":py:class:`~typing.Dict`\\[:py:class:`~typing.TypeVar`\\(``T``),"
235-
" :py:class:`~typing.TypeVar`\\(``U``, covariant=True)]",
236+
" :py:class:`~typing.TypeVar`\\(``U_co``, covariant=True)]",
236237
),
237238
(Dict[str, bool], ":py:class:`~typing.Dict`\\[:py:class:`str`, :py:class:`bool`]"),
238239
(Tuple, ":py:data:`~typing.Tuple`"),
@@ -283,8 +284,8 @@ def test_parse_annotation(annotation: Any, module: str, class_name: str, args: t
283284
(E[int], ":py:class:`~%s.E`\\[:py:class:`int`]" % __name__),
284285
(W, f":py:{'class' if PY310_PLUS else 'func'}:`~typing.NewType`\\(``W``, :py:class:`str`)"),
285286
(T, ":py:class:`~typing.TypeVar`\\(``T``)"),
286-
(U, ":py:class:`~typing.TypeVar`\\(``U``, covariant=True)"),
287-
(V, ":py:class:`~typing.TypeVar`\\(``V``, contravariant=True)"),
287+
(U_co, ":py:class:`~typing.TypeVar`\\(``U_co``, covariant=True)"),
288+
(V_contra, ":py:class:`~typing.TypeVar`\\(``V_contra``, contravariant=True)"),
288289
(X, ":py:class:`~typing.TypeVar`\\(``X``, :py:class:`str`, :py:class:`int`)"),
289290
(Y, ":py:class:`~typing.TypeVar`\\(``Y``, bound= :py:class:`str`)"),
290291
(Z, ":py:class:`~typing.TypeVar`\\(``Z``, bound= A)"),

0 commit comments

Comments
 (0)