From c6ea61d802bbf87e37477d65c3cd20df4e25a68c Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sat, 28 Sep 2024 10:15:35 +0200 Subject: [PATCH] pre-commit autoupdate 2024-09-28 --- .pre-commit-config.yaml | 4 ++-- docs/conf.py | 3 ++- src/autodoc2/render/base.py | 2 +- src/autodoc2/sphinx/extension.py | 4 ++-- tests/test_analyse_module.py | 3 ++- tests/test_render.py | 7 ++++--- 6 files changed, 13 insertions(+), 10 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9498e32..534dd08 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -12,14 +12,14 @@ repos: - id: check-yaml - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.4.4 + rev: v0.6.8 hooks: - id: ruff args: [--fix] - id: ruff-format - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.10.0 + rev: v1.11.2 hooks: - id: mypy args: [--config-file=pyproject.toml] diff --git a/docs/conf.py b/docs/conf.py index e2a02b3..10ebdfe 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -96,11 +96,12 @@ import typing as t # noqa: E402 -from autodoc2.config import CONFIG_PREFIX, Config, PackageConfig # noqa: E402 from docutils import nodes # noqa: E402 from sphinx.application import Sphinx # noqa: E402 from sphinx.util.docutils import SphinxDirective # noqa: E402 +from autodoc2.config import CONFIG_PREFIX, Config, PackageConfig # noqa: E402 + def setup(app: Sphinx) -> None: app.add_object_type( diff --git a/src/autodoc2/render/base.py b/src/autodoc2/render/base.py index 6c93b75..b3020d7 100644 --- a/src/autodoc2/render/base.py +++ b/src/autodoc2/render/base.py @@ -207,7 +207,7 @@ def show_docstring(self, item: ItemData) -> bool: """Whether to show the docstring.""" if self.config.docstrings == "all": return True - if self.config.docstrings == "direct" and not ( + if self.config.docstrings == "direct" and not ( # noqa: SIM103 (item.get("inherited")) or (item.get("doc_inherited")) ): return True diff --git a/src/autodoc2/sphinx/extension.py b/src/autodoc2/sphinx/extension.py index 50ad969..d00b2d0 100644 --- a/src/autodoc2/sphinx/extension.py +++ b/src/autodoc2/sphinx/extension.py @@ -42,8 +42,8 @@ def setup(app: Sphinx) -> dict[str, str | bool]: sphinx_type = t.Any if "sphinx_type" in field.metadata: sphinx_type = field.metadata["sphinx_type"] - if sphinx_type in (str, int, float, bool, list): - sphinx_type = (sphinx_type,) + if sphinx_type in (str, int, float, bool, list): # type: ignore[comparison-overlap] + sphinx_type = (sphinx_type,) # type: ignore[assignment] app.add_config_value( f"{CONFIG_PREFIX}{name}", field.metadata.get("sphinx_default", default), diff --git a/tests/test_analyse_module.py b/tests/test_analyse_module.py index 93e7192..0133c71 100644 --- a/tests/test_analyse_module.py +++ b/tests/test_analyse_module.py @@ -4,9 +4,10 @@ import typing as t -from autodoc2.analysis import analyse_module import pytest +from autodoc2.analysis import analyse_module + def clean_item(item: dict[str, t.Any]) -> dict[str, t.Any]: """Remove non-deterministic data.""" diff --git a/tests/test_render.py b/tests/test_render.py index e4b3148..36ef497 100644 --- a/tests/test_render.py +++ b/tests/test_render.py @@ -4,6 +4,10 @@ from pathlib import Path from textwrap import dedent +import pytest +from sphinx.testing.util import SphinxTestApp +from sphinx.testing.util import path as sphinx_path + from autodoc2.analysis import analyse_module from autodoc2.config import Config from autodoc2.db import InMemoryDb @@ -11,9 +15,6 @@ from autodoc2.render.myst_ import MystRenderer from autodoc2.render.rst_ import RstRenderer from autodoc2.utils import yield_modules -import pytest -from sphinx.testing.util import SphinxTestApp -from sphinx.testing.util import path as sphinx_path @pytest.mark.parametrize(