diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9498e32..69250ae 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -5,21 +5,21 @@ exclude: ^tests/.*\.md|tests/.*\.rst|tests/.*\.xml|docs/apidocs/.* repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.6.0 + rev: v5.0.0 hooks: - id: trailing-whitespace - id: end-of-file-fixer - id: check-yaml - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.4.4 + rev: v0.12.3 hooks: - id: ruff args: [--fix] - id: ruff-format - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.10.0 + rev: v1.16.1 hooks: - id: mypy args: [--config-file=pyproject.toml] diff --git a/docs/conf.py b/docs/conf.py index e2a02b3..5dc85cb 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( @@ -122,7 +123,7 @@ def run(self) -> t.List[nodes.Node]: config = Config() for name, value, field in config.as_triple(): text.append(f"``````{{confval}} {CONFIG_PREFIX}{name}") - text.append(f'{field.metadata.get("help", "")}') + text.append(f"{field.metadata.get('help', '')}") text.append("") # if "category" in field.metadata: # text.append(f"**category**: { field.metadata['category']}") @@ -156,7 +157,7 @@ def run(self) -> t.List[nodes.Node]: pkg_config = PackageConfig("") for name, value, field in pkg_config.as_triple(): text.append(f"``````{{confval}} {CONFIG_PREFIX}packages[{name}]") - text.append(f'{field.metadata.get("help", "")}') + text.append(f"{field.metadata.get('help', '')}") text.append("") type_ = type_to_string(field.type) text.append(f"**type**: {type_}") diff --git a/src/autodoc2/cli.py b/src/autodoc2/cli.py index 5ff7b60..8d3d14f 100644 --- a/src/autodoc2/cli.py +++ b/src/autodoc2/cli.py @@ -109,7 +109,7 @@ def list_items( if not private and data["full_name"].split(".")[-1].startswith("_"): continue if one_line: - console.print(f'{data["full_name"]} ({data["type"]})') + console.print(f"{data['full_name']} ({data['type']})") else: console.print(data) 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(