From eff10ccf0fa1b2e73df912048a15c2d6406a2c8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?= Date: Thu, 25 Jul 2024 17:30:45 +0200 Subject: [PATCH] refactor: Update code for Griffe 0.48 (removing deprecation warnings) Issue-173: https://github.com/mkdocstrings/python/issues/173 --- config/pytest.ini | 3 +++ pyproject.toml | 2 +- src/mkdocstrings_handlers/python/handler.py | 17 ++++++++++------- src/mkdocstrings_handlers/python/rendering.py | 15 +++++++-------- .../material/_base/attribute.html.jinja | 2 +- .../material/_base/children.html.jinja | 2 +- .../templates/material/_base/class.html.jinja | 2 +- .../material/_base/docstring.html.jinja | 2 +- .../_base/docstring/admonition.html.jinja | 2 +- .../_base/docstring/attributes.html.jinja | 2 +- .../material/_base/docstring/classes.html.jinja | 2 +- .../_base/docstring/examples.html.jinja | 2 +- .../_base/docstring/functions.html.jinja | 2 +- .../material/_base/docstring/modules.html.jinja | 2 +- .../_base/docstring/other_parameters.html.jinja | 2 +- .../_base/docstring/parameters.html.jinja | 2 +- .../material/_base/docstring/raises.html.jinja | 2 +- .../_base/docstring/receives.html.jinja | 2 +- .../material/_base/docstring/returns.html.jinja | 2 +- .../material/_base/docstring/warns.html.jinja | 2 +- .../material/_base/docstring/yields.html.jinja | 2 +- .../material/_base/expression.html.jinja | 4 ++-- .../material/_base/function.html.jinja | 2 +- .../templates/material/_base/module.html.jinja | 2 +- .../material/_base/signature.html.jinja | 2 +- .../_base/docstring/attributes.html.jinja | 2 +- .../_base/docstring/other_parameters.html.jinja | 2 +- .../_base/docstring/parameters.html.jinja | 2 +- .../_base/docstring/raises.html.jinja | 2 +- .../_base/docstring/receives.html.jinja | 2 +- .../_base/docstring/returns.html.jinja | 2 +- .../_base/docstring/warns.html.jinja | 2 +- .../_base/docstring/yields.html.jinja | 2 +- tests/test_handler.py | 3 +-- tests/test_rendering.py | 3 +-- 35 files changed, 53 insertions(+), 50 deletions(-) diff --git a/config/pytest.ini b/config/pytest.ini index 052a2f18..9d75f5c6 100644 --- a/config/pytest.ini +++ b/config/pytest.ini @@ -12,3 +12,6 @@ filterwarnings = error # TODO: remove once pytest-xdist 4 is released ignore:.*rsyncdir:DeprecationWarning:xdist + # TODO: remove once Griffe releases v1 + ignore:.*`get_logger`:DeprecationWarning:_griffe + ignore:.*`name`:DeprecationWarning:_griffe diff --git a/pyproject.toml b/pyproject.toml index 4e3629f4..1fc5bb58 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,7 +30,7 @@ classifiers = [ ] dependencies = [ "mkdocstrings>=0.25", - "griffe>=0.47", + "griffe>=0.48", ] [project.urls] diff --git a/src/mkdocstrings_handlers/python/handler.py b/src/mkdocstrings_handlers/python/handler.py index a490e392..d7c39699 100644 --- a/src/mkdocstrings_handlers/python/handler.py +++ b/src/mkdocstrings_handlers/python/handler.py @@ -12,12 +12,15 @@ from pathlib import Path from typing import TYPE_CHECKING, Any, BinaryIO, ClassVar, Iterator, Mapping, Sequence -from griffe.collections import LinesCollection, ModulesCollection -from griffe.docstrings.parsers import Parser -from griffe.exceptions import AliasResolutionError -from griffe.extensions import load_extensions -from griffe.loader import GriffeLoader -from griffe.logger import patch_loggers +from griffe import ( + AliasResolutionError, + GriffeLoader, + LinesCollection, + ModulesCollection, + Parser, + load_extensions, + patch_logger, +) from mkdocstrings.extension import PluginError from mkdocstrings.handlers.base import BaseHandler, CollectionError, CollectorItem from mkdocstrings.inventory import Inventory @@ -47,7 +50,7 @@ def chdir(path: str) -> Iterator[None]: # noqa: D103 logger = get_logger(__name__) -patch_loggers(get_logger) +patch_logger(get_logger) class PythonHandler(BaseHandler): diff --git a/src/mkdocstrings_handlers/python/rendering.py b/src/mkdocstrings_handlers/python/rendering.py index face49fe..b7fe3ad6 100644 --- a/src/mkdocstrings_handlers/python/rendering.py +++ b/src/mkdocstrings_handlers/python/rendering.py @@ -12,19 +12,20 @@ from pathlib import Path from typing import TYPE_CHECKING, Any, Callable, Match, Pattern, Sequence -from griffe.dataclasses import Alias, Object -from griffe.docstrings.dataclasses import ( +from griffe import ( + Alias, DocstringSectionAttributes, DocstringSectionClasses, DocstringSectionFunctions, DocstringSectionModules, + Object, ) from jinja2 import TemplateNotFound, pass_context, pass_environment from markupsafe import Markup from mkdocstrings.loggers import get_logger if TYPE_CHECKING: - from griffe.dataclasses import Attribute, Class, Function, Module + from griffe import Attribute, Class, Function, Module from jinja2 import Environment, Template from jinja2.runtime import Context from mkdocstrings.handlers.base import CollectorItem @@ -364,11 +365,9 @@ def _keep_object(name: str, filters: Sequence[tuple[Pattern, bool]]) -> bool: if regex.search(name): keep = not exclude if keep is None: - if rules == {False}: - # only included stuff, no match = reject - return False - # only excluded stuff, or included and excluded stuff, no match = keep - return True + # When we only include stuff, no match = reject. + # When we only exclude stuff, or include and exclude stuff, no match = keep. + return rules != {False} return keep diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/attribute.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/attribute.html.jinja index 11bc4e77..0716b171 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/attribute.html.jinja +++ b/src/mkdocstrings_handlers/python/templates/material/_base/attribute.html.jinja @@ -4,7 +4,7 @@ This template renders a Python attribute (or variable). This can be a module attribute or a class attribute. Context: - attribute (griffe.dataclasses.Attribute): The attribute to render. + attribute (griffe.Attribute): The attribute to render. root (bool): Whether this is the root object, injected with `:::` in a Markdown page. heading_level (int): The HTML heading level to use. config (dict): The configuration options. diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/children.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/children.html.jinja index 22bbc8af..c9c23156 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/children.html.jinja +++ b/src/mkdocstrings_handlers/python/templates/material/_base/children.html.jinja @@ -4,7 +4,7 @@ This template iterates on members of a given object and renders them. It can group members by category (attributes, classes, functions, modules) or render them in a flat list. Context: - obj (griffe.dataclasses.Object): The object to render. + obj (griffe.Object): The object to render. config (dict): The configuration options. root_members (bool): Whether the object is the root object. heading_level (int): The HTML heading level to use. diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/class.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/class.html.jinja index 67d00e34..27a91d13 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/class.html.jinja +++ b/src/mkdocstrings_handlers/python/templates/material/_base/class.html.jinja @@ -3,7 +3,7 @@ This template renders a Python class. Context: - class (griffe.dataclasses.Class): The class to render. + class (griffe.Class): The class to render. root (bool): Whether this is the root object, injected with `:::` in a Markdown page. heading_level (int): The HTML heading level to use. config (dict): The configuration options. diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/docstring.html.jinja index f5095eb4..bc561b14 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring.html.jinja +++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring.html.jinja @@ -5,7 +5,7 @@ Griffe parses docstrings into a list of sections, each with a `kind` and a `valu This template can then iterate on these sections and render them according to the configuration. Context: - docstring_sections (list[griffe.docstrings.dataclasses.DocstringSection]): The list of docstring sections. + docstring_sections (list[griffe.DocstringSection]): The list of docstring sections. config (dict): The configuration dictionary. heading_level (int): The heading level to use for Markdown conversion. html_id (str): The HTML ID to use for Markdown conversion. diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/admonition.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/admonition.html.jinja index e3400280..70f462db 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/admonition.html.jinja +++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/admonition.html.jinja @@ -3,7 +3,7 @@ This template renders admonitions using the `details` HTML element. Context: - section (griffe.docstrings.dataclasses.DocstringSectionAdmonition): The section to render. + section (griffe.DocstringSectionAdmonition): The section to render. -#} {% block logs scoped %} diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/attributes.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/attributes.html.jinja index e6c03dee..396e36dd 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/attributes.html.jinja +++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/attributes.html.jinja @@ -4,7 +4,7 @@ This template renders a list of documented attributes in the format specified with the [`docstring_section_style`][] configuration option. Context: - section (griffe.docstrings.dataclasses.DocstringSectionAttributes): The section to render. + section (griffe.DocstringSectionAttributes): The section to render. -#} {% block logs scoped %} diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/classes.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/classes.html.jinja index 1aee5fd2..d21db25e 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/classes.html.jinja +++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/classes.html.jinja @@ -4,7 +4,7 @@ This template renders a list of documented classes in the format specified with the [`docstring_section_style`][] configuration option. Context: - section (griffe.docstrings.dataclasses.DocstringSectionAttributes): The section to render. + section (griffe.DocstringSectionAttributes): The section to render. -#} {% block logs scoped %} diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/examples.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/examples.html.jinja index 48913f80..39a90fa0 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/examples.html.jinja +++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/examples.html.jinja @@ -4,7 +4,7 @@ This template renders a list of documented examples. It alternates between rendering text and code examples. Context: - section (griffe.docstrings.dataclasses.DocstringSectionAttributes): The section to render. + section (griffe.DocstringSectionAttributes): The section to render. -#} {% block logs scoped %} diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/functions.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/functions.html.jinja index 53bda233..89ce923f 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/functions.html.jinja +++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/functions.html.jinja @@ -4,7 +4,7 @@ This template renders a list of documented functions in the format specified with the [`docstring_section_style`][] configuration option. Context: - section (griffe.docstrings.dataclasses.DocstringSectionAttributes): The section to render. + section (griffe.DocstringSectionAttributes): The section to render. -#} {% block logs scoped %} diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/modules.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/modules.html.jinja index 239f7a55..49fc9d80 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/modules.html.jinja +++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/modules.html.jinja @@ -4,7 +4,7 @@ This template renders a list of documented modules in the format specified with the [`docstring_section_style`][] configuration option. Context: - section (griffe.docstrings.dataclasses.DocstringSectionAttributes): The section to render. + section (griffe.DocstringSectionAttributes): The section to render. -#} {% block logs scoped %} diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/other_parameters.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/other_parameters.html.jinja index 7daabeda..a8730966 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/other_parameters.html.jinja +++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/other_parameters.html.jinja @@ -4,7 +4,7 @@ This template renders a list of documented other parameters in the format specified with the [`docstring_section_style`][] configuration option. Context: - section (griffe.docstrings.dataclasses.DocstringSectionAttributes): The section to render. + section (griffe.DocstringSectionAttributes): The section to render. -#} {% block logs scoped %} diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/parameters.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/parameters.html.jinja index 3de6f4a9..a2db4900 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/parameters.html.jinja +++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/parameters.html.jinja @@ -4,7 +4,7 @@ This template renders a list of documented parameters in the format specified with the [`docstring_section_style`][] configuration option. Context: - section (griffe.docstrings.dataclasses.DocstringSectionAttributes): The section to render. + section (griffe.DocstringSectionAttributes): The section to render. -#} {% block logs scoped %} diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/raises.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/raises.html.jinja index 79024057..21490f4e 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/raises.html.jinja +++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/raises.html.jinja @@ -4,7 +4,7 @@ This template renders a list of documented exceptions in the format specified with the [`docstring_section_style`][] configuration option. Context: - section (griffe.docstrings.dataclasses.DocstringSectionAttributes): The section to render. + section (griffe.DocstringSectionAttributes): The section to render. -#} {% block logs scoped %} diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/receives.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/receives.html.jinja index 2fcce8ef..86420b39 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/receives.html.jinja +++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/receives.html.jinja @@ -4,7 +4,7 @@ This template renders a list of documented received values (generators) in the f specified with the [`docstring_section_style`][] configuration option. Context: - section (griffe.docstrings.dataclasses.DocstringSectionAttributes): The section to render. + section (griffe.DocstringSectionAttributes): The section to render. -#} {% block logs scoped %} diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/returns.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/returns.html.jinja index 8feeb054..d402369a 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/returns.html.jinja +++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/returns.html.jinja @@ -4,7 +4,7 @@ This template renders a list of documented returned values in the format specified with the [`docstring_section_style`][] configuration option. Context: - section (griffe.docstrings.dataclasses.DocstringSectionAttributes): The section to render. + section (griffe.DocstringSectionAttributes): The section to render. -#} {% block logs scoped %} diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/warns.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/warns.html.jinja index 6143257d..702b9351 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/warns.html.jinja +++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/warns.html.jinja @@ -4,7 +4,7 @@ This template renders a list of documented warnings in the format specified with the [`docstring_section_style`][] configuration option. Context: - section (griffe.docstrings.dataclasses.DocstringSectionAttributes): The section to render. + section (griffe.DocstringSectionAttributes): The section to render. -#} {% block logs scoped %} diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/yields.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/yields.html.jinja index d326c1fe..c83c478b 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/yields.html.jinja +++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/yields.html.jinja @@ -4,7 +4,7 @@ This template renders a list of documented yielded values (generators) in the fo specified with the [`docstring_section_style`][] configuration option. Context: - section (griffe.docstrings.dataclasses.DocstringSectionAttributes): The section to render. + section (griffe.DocstringSectionAttributes): The section to render. -#} {% block logs scoped %} diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/expression.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/expression.html.jinja index 5a216e3e..67f02bb3 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/expression.html.jinja +++ b/src/mkdocstrings_handlers/python/templates/material/_base/expression.html.jinja @@ -17,7 +17,7 @@ which is a tree-like structure representing a Python expression. This macro outputs a cross-reference to the given name. Parameters: - name (griffe.expressions.ExprName): The name to cross-reference. + name (griffe.ExprName): The name to cross-reference. annotation_path (str): Either "brief", "source", or "full". Returns: @@ -48,7 +48,7 @@ which is a tree-like structure representing a Python expression. {#- Render an expression. Parameters: - expression (griffe.expressions.Expr): The expression to render. + expression (griffe.Expr): The expression to render. annotations_path (str): Either "brief", "source", or "full". Returns: diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/function.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/function.html.jinja index 01f3e74a..3631b699 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/function.html.jinja +++ b/src/mkdocstrings_handlers/python/templates/material/_base/function.html.jinja @@ -3,7 +3,7 @@ This template renders a Python function or method. Context: - function (griffe.dataclasses.Function): The function to render. + function (griffe.Function): The function to render. root (bool): Whether this is the root object, injected with `:::` in a Markdown page. heading_level (int): The HTML heading level to use. config (dict): The configuration options. diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/module.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/module.html.jinja index 06870b98..ae7d88d9 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/module.html.jinja +++ b/src/mkdocstrings_handlers/python/templates/material/_base/module.html.jinja @@ -3,7 +3,7 @@ This template renders a Python module. Context: - module (griffe.dataclasses.Module): The module to render. + module (griffe.Module): The module to render. root (bool): Whether this is the root object, injected with `:::` in a Markdown page. heading_level (int): The HTML heading level to use. config (dict): The configuration options. diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/signature.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/signature.html.jinja index 2d87986c..1107458c 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/signature.html.jinja +++ b/src/mkdocstrings_handlers/python/templates/material/_base/signature.html.jinja @@ -5,7 +5,7 @@ It iterates over the parameters of the function to rebuild the signature. The signature is the list of parameters of a function or method, including their names, default values, and annotations. Context: - function (griffe.dataclasses.Function): The function or method to render. + function (griffe.Function): The function or method to render. config (dict): The configuration options. -#} diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/attributes.html.jinja b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/attributes.html.jinja index 8df20e1c..f02e0b9c 100644 --- a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/attributes.html.jinja +++ b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/attributes.html.jinja @@ -4,7 +4,7 @@ This template renders a list of documented attributes in the format specified with the [`docstring_section_style`][] configuration option. Context: - section (griffe.docstrings.dataclasses.DocstringSectionAttributes): The section to render. + section (griffe.DocstringSectionAttributes): The section to render. -#} {% block logs scoped %} diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/other_parameters.html.jinja b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/other_parameters.html.jinja index 4b416b65..34264133 100644 --- a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/other_parameters.html.jinja +++ b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/other_parameters.html.jinja @@ -4,7 +4,7 @@ This template renders a list of documented other parameters in the format specified with the [`docstring_section_style`][] configuration option. Context: - section (griffe.docstrings.dataclasses.DocstringSectionAttributes): The section to render. + section (griffe.DocstringSectionAttributes): The section to render. -#} {% block logs scoped %} diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/parameters.html.jinja b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/parameters.html.jinja index 10bbd7ba..369912e7 100644 --- a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/parameters.html.jinja +++ b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/parameters.html.jinja @@ -4,7 +4,7 @@ This template renders a list of documented parameters in the format specified with the [`docstring_section_style`][] configuration option. Context: - section (griffe.docstrings.dataclasses.DocstringSectionAttributes): The section to render. + section (griffe.DocstringSectionAttributes): The section to render. -#} {% block logs scoped %} diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/raises.html.jinja b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/raises.html.jinja index f350bc97..43d134f8 100644 --- a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/raises.html.jinja +++ b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/raises.html.jinja @@ -4,7 +4,7 @@ This template renders a list of documented exceptions in the format specified with the [`docstring_section_style`][] configuration option. Context: - section (griffe.docstrings.dataclasses.DocstringSectionAttributes): The section to render. + section (griffe.DocstringSectionAttributes): The section to render. -#} {% block logs scoped %} diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/receives.html.jinja b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/receives.html.jinja index 804a04a0..636c17e4 100644 --- a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/receives.html.jinja +++ b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/receives.html.jinja @@ -4,7 +4,7 @@ This template renders a list of documented received values (generators) in the f specified with the [`docstring_section_style`][] configuration option. Context: - section (griffe.docstrings.dataclasses.DocstringSectionAttributes): The section to render. + section (griffe.DocstringSectionAttributes): The section to render. -#} {% block logs scoped %} diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/returns.html.jinja b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/returns.html.jinja index 0074327a..a00732d9 100644 --- a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/returns.html.jinja +++ b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/returns.html.jinja @@ -4,7 +4,7 @@ This template renders a list of documented returned values in the format specified with the [`docstring_section_style`][] configuration option. Context: - section (griffe.docstrings.dataclasses.DocstringSectionAttributes): The section to render. + section (griffe.DocstringSectionAttributes): The section to render. -#} {% block logs scoped %} diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/warns.html.jinja b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/warns.html.jinja index 88308b68..b445639c 100644 --- a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/warns.html.jinja +++ b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/warns.html.jinja @@ -4,7 +4,7 @@ This template renders a list of documented warnings in the format specified with the [`docstring_section_style`][] configuration option. Context: - section (griffe.docstrings.dataclasses.DocstringSectionAttributes): The section to render. + section (griffe.DocstringSectionAttributes): The section to render. -#} {% block logs scoped %} diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/yields.html.jinja b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/yields.html.jinja index bd43955d..91097828 100644 --- a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/yields.html.jinja +++ b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/yields.html.jinja @@ -4,7 +4,7 @@ This template renders a list of documented yielded values (generators) in the fo specified with the [`docstring_section_style`][] configuration option. Context: - section (griffe.docstrings.dataclasses.DocstringSectionAttributes): The section to render. + section (griffe.DocstringSectionAttributes): The section to render. -#} {% block logs scoped %} diff --git a/tests/test_handler.py b/tests/test_handler.py index 4ec7ee28..0717dc48 100644 --- a/tests/test_handler.py +++ b/tests/test_handler.py @@ -8,8 +8,7 @@ from typing import TYPE_CHECKING import pytest -from griffe.docstrings.dataclasses import DocstringSectionExamples, DocstringSectionKind -from griffe.tests import temporary_visited_module +from griffe import DocstringSectionExamples, DocstringSectionKind, temporary_visited_module from mkdocstrings_handlers.python.handler import CollectionError, PythonHandler, get_handler diff --git a/tests/test_rendering.py b/tests/test_rendering.py index 38d81dbb..1bab29d7 100644 --- a/tests/test_rendering.py +++ b/tests/test_rendering.py @@ -7,8 +7,7 @@ from typing import TYPE_CHECKING, Any import pytest -from griffe.collections import ModulesCollection -from griffe.tests import temporary_visited_module +from griffe import ModulesCollection, temporary_visited_module from mkdocstrings_handlers.python import rendering