Skip to content

Commit 28061de

Browse files
committed
feat: Support griffe 0.10
1 parent 4cdb292 commit 28061de

File tree

6 files changed

+16
-13
lines changed

6 files changed

+16
-13
lines changed

src/mkdocstrings/handlers/python/collector.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,17 +62,15 @@ def collect(self, identifier: str, config: dict) -> CollectorItem: # noqa: WPS2
6262
lines_collection=self._lines_collection,
6363
)
6464
try:
65-
module = loader.load_module(module_name)
66-
except ModuleNotFoundError as error:
67-
raise CollectionError from error
65+
loader.load_module(module_name)
66+
except ImportError as error:
67+
raise CollectionError(str(error)) from error
6868

69-
for _ in range(5):
70-
if loader.follow_aliases(module):
71-
break
72-
else:
73-
logger.warning("some aliases could not be resolved")
69+
unresolved, iterations = loader.resolve_aliases(only_exported=True, only_known_modules=True)
70+
if unresolved:
71+
logger.warning(f"{len(unresolved)} aliases were still unresolved after {iterations} iterations")
7472

7573
try:
7674
return self._modules_collection[identifier]
7775
except KeyError as error: # noqa: WPS440
78-
raise CollectionError from error
76+
raise CollectionError(f"{identifier} could not be found") from error

src/mkdocstrings/templates/python/material/_base/attribute.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{{ log.debug() }}
2-
{% if config.show_if_no_docstring or attribute %}
2+
{% if config.show_if_no_docstring or attribute.has_docstrings %}
33

44
<div class="doc doc-object doc-attribute">
55
{% with html_id = attribute.path %}

src/mkdocstrings/templates/python/material/_base/class.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{{ log.debug() }}
2-
{% if config.show_if_no_docstring or class %}
2+
{% if config.show_if_no_docstring or class.has_docstrings %}
33

44
<div class="doc doc-object doc-class">
55
{% with html_id = class.path %}

src/mkdocstrings/templates/python/material/_base/docstring.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@
2121
{% include "docstring/returns.html" with context %}
2222
{% elif section.kind.value == "examples" %}
2323
{% include "docstring/examples.html" with context %}
24+
{% elif section.kind.value == "admonition" %}
25+
<details class="{{ section.value.kind }}">
26+
{{ section.title|convert_markdown(heading_level, html_id) }}
27+
{{ section.value.contents|convert_markdown(heading_level, html_id) }}
28+
</details>
2429
{% endif %}
2530
{% endfor %}
2631
{% endif %}

src/mkdocstrings/templates/python/material/_base/function.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{{ log.debug() }}
2-
{% if config.show_if_no_docstring or function %}
2+
{% if config.show_if_no_docstring or function.has_docstrings %}
33

44
<div class="doc doc-object doc-function">
55
{% with html_id = function.path %}

src/mkdocstrings/templates/python/material/_base/module.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{{ log.debug() }}
2-
{% if config.show_if_no_docstring or module %}
2+
{% if config.show_if_no_docstring or module.has_docstrings %}
33

44
<div class="doc doc-object doc-module">
55
{% with html_id = module.path %}

0 commit comments

Comments
 (0)