mkdocstrings-python 2.0.5__py3-none-any.whl → 2.0.6__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mkdocstrings_handlers/python/_internal/handler.py +38 -3
- mkdocstrings_handlers/python/_internal/rendering.py +14 -13
- {mkdocstrings_python-2.0.5.dist-info → mkdocstrings_python-2.0.6.dist-info}/METADATA +3 -5
- {mkdocstrings_python-2.0.5.dist-info → mkdocstrings_python-2.0.6.dist-info}/RECORD +7 -7
- {mkdocstrings_python-2.0.5.dist-info → mkdocstrings_python-2.0.6.dist-info}/WHEEL +0 -0
- {mkdocstrings_python-2.0.5.dist-info → mkdocstrings_python-2.0.6.dist-info}/entry_points.txt +0 -0
- {mkdocstrings_python-2.0.5.dist-info → mkdocstrings_python-2.0.6.dist-info}/licenses/LICENSE +0 -0
|
@@ -3,13 +3,14 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
import glob
|
|
6
|
+
import inspect
|
|
6
7
|
import os
|
|
7
8
|
import posixpath
|
|
8
9
|
import sys
|
|
9
10
|
from contextlib import suppress
|
|
10
11
|
from dataclasses import asdict
|
|
11
12
|
from pathlib import Path
|
|
12
|
-
from typing import TYPE_CHECKING, Any, BinaryIO, ClassVar
|
|
13
|
+
from typing import TYPE_CHECKING, Any, BinaryIO, Callable, ClassVar
|
|
13
14
|
|
|
14
15
|
from griffe import (
|
|
15
16
|
AliasResolutionError,
|
|
@@ -18,6 +19,10 @@ from griffe import (
|
|
|
18
19
|
ModulesCollection,
|
|
19
20
|
Parser,
|
|
20
21
|
load_extensions,
|
|
22
|
+
parse_auto,
|
|
23
|
+
parse_google,
|
|
24
|
+
parse_numpy,
|
|
25
|
+
parse_sphinx,
|
|
21
26
|
patch_loggers,
|
|
22
27
|
)
|
|
23
28
|
from mkdocs.exceptions import PluginError
|
|
@@ -54,6 +59,34 @@ _logger = get_logger(__name__)
|
|
|
54
59
|
|
|
55
60
|
patch_loggers(get_logger)
|
|
56
61
|
|
|
62
|
+
_PARSER_FUNCTIONS: dict[Parser, Callable] = {
|
|
63
|
+
Parser.auto: parse_auto,
|
|
64
|
+
Parser.google: parse_google,
|
|
65
|
+
Parser.numpy: parse_numpy,
|
|
66
|
+
Parser.sphinx: parse_sphinx,
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def _filter_parser_options(parser: Parser | None, options: dict[str, Any] | None) -> dict[str, Any] | None:
|
|
71
|
+
"""Filter options unsupported by the selected Griffe parser."""
|
|
72
|
+
if parser is None or options is None:
|
|
73
|
+
return options
|
|
74
|
+
|
|
75
|
+
accepted_options = set(inspect.signature(_PARSER_FUNCTIONS[parser]).parameters) - {"docstring"}
|
|
76
|
+
filtered_options = {}
|
|
77
|
+
for name, value in options.items():
|
|
78
|
+
if name in accepted_options:
|
|
79
|
+
if parser is Parser.auto and name == "per_style_options":
|
|
80
|
+
filtered_options[name] = {
|
|
81
|
+
style: _filter_parser_options(Parser(style), style_options)
|
|
82
|
+
for style, style_options in value.items()
|
|
83
|
+
}
|
|
84
|
+
else:
|
|
85
|
+
filtered_options[name] = value
|
|
86
|
+
else:
|
|
87
|
+
_logger.warning(f"Ignoring unsupported {parser.value} docstring parser option: {name}")
|
|
88
|
+
return filtered_options
|
|
89
|
+
|
|
57
90
|
|
|
58
91
|
class PythonHandler(BaseHandler):
|
|
59
92
|
"""The Python handler class."""
|
|
@@ -195,7 +228,9 @@ class PythonHandler(BaseHandler):
|
|
|
195
228
|
|
|
196
229
|
parser_name = options.docstring_style
|
|
197
230
|
parser = parser_name and Parser(parser_name)
|
|
198
|
-
parser_options
|
|
231
|
+
parser_options: dict[str, Any] | None = None
|
|
232
|
+
if options.docstring_options is not None:
|
|
233
|
+
parser_options = _filter_parser_options(parser, asdict(options.docstring_options))
|
|
199
234
|
|
|
200
235
|
if unknown_module:
|
|
201
236
|
extensions = self.normalize_extension_paths(options.extensions)
|
|
@@ -203,7 +238,7 @@ class PythonHandler(BaseHandler):
|
|
|
203
238
|
extensions=load_extensions(*extensions),
|
|
204
239
|
search_paths=self._paths,
|
|
205
240
|
docstring_parser=parser,
|
|
206
|
-
docstring_options=parser_options,
|
|
241
|
+
docstring_options=parser_options, # type: ignore[arg-type]
|
|
207
242
|
modules_collection=self._modules_collection,
|
|
208
243
|
lines_collection=self._lines_collection,
|
|
209
244
|
allow_inspection=options.allow_inspection,
|
|
@@ -107,7 +107,7 @@ class _StashCrossRefFilter:
|
|
|
107
107
|
|
|
108
108
|
@staticmethod
|
|
109
109
|
def _gen_key(length: int) -> str:
|
|
110
|
-
return "_" + "".join(random.choice(string.ascii_letters + string.digits) for _ in range(max(
|
|
110
|
+
return "_" + "".join(random.choice(string.ascii_letters + string.digits) for _ in range(max(2, length - 1))) # noqa: S311
|
|
111
111
|
|
|
112
112
|
def _gen_stash_key(self, length: int) -> str:
|
|
113
113
|
key = self._gen_key(length)
|
|
@@ -420,22 +420,20 @@ def _keep_object(name: str, filters: Sequence[tuple[Pattern, bool]]) -> bool:
|
|
|
420
420
|
|
|
421
421
|
|
|
422
422
|
def _parents(obj: Alias) -> set[str]:
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
parents.add(parent.final_target.path)
|
|
427
|
-
while parent.parent:
|
|
428
|
-
parent = parent.parent
|
|
423
|
+
parents = {obj.path}
|
|
424
|
+
parent = obj.parent
|
|
425
|
+
while parent is not None:
|
|
429
426
|
parents.add(parent.path)
|
|
430
|
-
if parent
|
|
427
|
+
if isinstance(parent, Alias):
|
|
431
428
|
parents.add(parent.final_target.path)
|
|
429
|
+
parent = parent.parent
|
|
432
430
|
return parents
|
|
433
431
|
|
|
434
432
|
|
|
435
433
|
def _remove_cycles(objects: list[Object | Alias]) -> Iterator[Object | Alias]:
|
|
436
434
|
suppress_errors = suppress(AliasResolutionError, CyclicAliasError)
|
|
437
435
|
for obj in objects:
|
|
438
|
-
if obj
|
|
436
|
+
if isinstance(obj, Alias):
|
|
439
437
|
with suppress_errors:
|
|
440
438
|
if obj.final_target.path in _parents(obj):
|
|
441
439
|
continue
|
|
@@ -784,6 +782,8 @@ class AutorefsHook(AutorefsHookInterface):
|
|
|
784
782
|
obj = self.current_object
|
|
785
783
|
while identifier and identifier[0] == ".":
|
|
786
784
|
identifier = identifier[1:]
|
|
785
|
+
if obj.parent is None:
|
|
786
|
+
break
|
|
787
787
|
obj = obj.parent
|
|
788
788
|
identifier = f"{obj.path}.{identifier}" if identifier else obj.path
|
|
789
789
|
|
|
@@ -814,12 +814,13 @@ class AutorefsHook(AutorefsHookInterface):
|
|
|
814
814
|
"module": "mod",
|
|
815
815
|
}.get(self.current_object.kind.value.lower(), "obj")
|
|
816
816
|
origin = self.current_object.path
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
lineno = self.current_object.docstring.lineno or 0
|
|
820
|
-
except AttributeError:
|
|
817
|
+
docstring = self.current_object.docstring
|
|
818
|
+
if docstring is None or docstring.parent is None:
|
|
821
819
|
filepath = self.current_object.filepath
|
|
822
820
|
lineno = 0
|
|
821
|
+
else:
|
|
822
|
+
filepath = docstring.parent.filepath
|
|
823
|
+
lineno = docstring.lineno or 0
|
|
823
824
|
|
|
824
825
|
return AutorefsHookInterface.Context(
|
|
825
826
|
domain="py",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mkdocstrings-python
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.6
|
|
4
4
|
Summary: A Python handler for mkdocstrings.
|
|
5
5
|
Author-Email: =?utf-8?q?Timoth=C3=A9e_Mazzucotelli?= <dev@pawamoy.fr>
|
|
6
6
|
License-Expression: ISC
|
|
@@ -145,7 +145,7 @@ dependencies = [
|
|
|
145
145
|
<a href="https://github.com/BenHammersley"><img alt="BenHammersley" src="https://avatars.githubusercontent.com/u/99436?u=4499a7b507541045222ee28ae122dbe3c8d08ab5&v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
146
146
|
<a href="https://github.com/trevorWieland"><img alt="trevorWieland" src="https://avatars.githubusercontent.com/u/28811461?u=74cc0e3756c1d4e3d66b5c396e1d131ea8a10472&v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
147
147
|
<a href="https://github.com/MarcoGorelli"><img alt="MarcoGorelli" src="https://avatars.githubusercontent.com/u/33491632?u=7de3a749cac76a60baca9777baf71d043a4f884d&v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
148
|
-
<a href="https://github.com/analog-cbarber"><img alt="analog-cbarber" src="https://avatars.githubusercontent.com/u/7408243?u=
|
|
148
|
+
<a href="https://github.com/analog-cbarber"><img alt="analog-cbarber" src="https://avatars.githubusercontent.com/u/7408243?u=fe0e7bf2882d1c9c901a341c2502e1518466527a&v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
149
149
|
<a href="https://github.com/OdinManiac"><img alt="OdinManiac" src="https://avatars.githubusercontent.com/u/22727172?u=36ab20970f7f52ae8e7eb67b7fcf491fee01ac22&v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
150
150
|
<a href="https://github.com/rstudio-sponsorship"><img alt="rstudio-sponsorship" src="https://avatars.githubusercontent.com/u/58949051?u=0c471515dd18111be30dfb7669ed5e778970959b&v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
151
151
|
<a href="https://github.com/schlich"><img alt="schlich" src="https://avatars.githubusercontent.com/u/21191435?u=6f1240adb68f21614d809ae52d66509f46b1e877&v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
@@ -157,17 +157,15 @@ dependencies = [
|
|
|
157
157
|
<a href="https://github.com/activeloopai"><img alt="activeloopai" src="https://avatars.githubusercontent.com/u/34816118?v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
158
158
|
<a href="https://github.com/roboflow"><img alt="roboflow" src="https://avatars.githubusercontent.com/u/53104118?v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
159
159
|
<a href="https://github.com/cmclaughlin"><img alt="cmclaughlin" src="https://avatars.githubusercontent.com/u/1061109?u=ddf6eec0edd2d11c980f8c3aa96e3d044d4e0468&v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
160
|
-
<a href="https://github.com/blaisep"><img alt="blaisep" src="https://avatars.githubusercontent.com/u/254456?u=97d584b7c0a6faf583aa59975df4f993f671d121&v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
161
160
|
<a href="https://github.com/RapidataAI"><img alt="RapidataAI" src="https://avatars.githubusercontent.com/u/104209891?v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
162
161
|
<a href="https://github.com/rodolphebarbanneau"><img alt="rodolphebarbanneau" src="https://avatars.githubusercontent.com/u/46493454?u=6c405452a40c231cdf0b68e97544e07ee956a733&v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
163
162
|
<a href="https://github.com/theSymbolSyndicate"><img alt="theSymbolSyndicate" src="https://avatars.githubusercontent.com/u/111542255?v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
164
163
|
<a href="https://github.com/blakeNaccarato"><img alt="blakeNaccarato" src="https://avatars.githubusercontent.com/u/20692450?u=bb919218be30cfa994514f4cf39bb2f7cf952df4&v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
165
164
|
<a href="https://github.com/ChargeStorm"><img alt="ChargeStorm" src="https://avatars.githubusercontent.com/u/26000165?v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
166
|
-
<a href="https://github.com/Alphadelta14"><img alt="Alphadelta14" src="https://avatars.githubusercontent.com/u/480845?v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
167
165
|
<a href="https://github.com/Cusp-AI"><img alt="Cusp-AI" src="https://avatars.githubusercontent.com/u/178170649?v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
168
166
|
</p></div>
|
|
169
167
|
|
|
170
168
|
|
|
171
|
-
*And
|
|
169
|
+
*And 4 more private sponsor(s).*
|
|
172
170
|
|
|
173
171
|
<!-- sponsors-end -->
|
|
@@ -2,8 +2,8 @@ mkdocstrings_handlers/python/__init__.py,sha256=Kxy1zA4JJy0aWxUa2_xl5PfYV2-mrBKJ
|
|
|
2
2
|
mkdocstrings_handlers/python/_internal/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
3
|
mkdocstrings_handlers/python/_internal/config.py,sha256=iSnsL-DXqWSm_0YKv-2giDxTdljxZWvDgTGkCo9GBPg,35261
|
|
4
4
|
mkdocstrings_handlers/python/_internal/debug.py,sha256=A6B3w6LWN22kYtvvbmz7vnh8Pr5hzvtrHhM3-Es8Isg,2882
|
|
5
|
-
mkdocstrings_handlers/python/_internal/handler.py,sha256=
|
|
6
|
-
mkdocstrings_handlers/python/_internal/rendering.py,sha256=
|
|
5
|
+
mkdocstrings_handlers/python/_internal/handler.py,sha256=Wn_0S4pw511tfC0m24sfbSNiUDlScDiJqEMFgrITdS8,16972
|
|
6
|
+
mkdocstrings_handlers/python/_internal/rendering.py,sha256=Nrkoi1FeRrsEGOUmiBuu13mm0LJXktQr3Zt2iTb3mQE,28564
|
|
7
7
|
mkdocstrings_handlers/python/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
8
|
mkdocstrings_handlers/python/templates/material/_base/attribute.html.jinja,sha256=ajtKaGxs9-VJzPNiXbQTYTO6ADq8Ck9M9x2BfXakG0g,4838
|
|
9
9
|
mkdocstrings_handlers/python/templates/material/_base/backlinks.html.jinja,sha256=k8eX0lyQmmooaEotjYngdXO8RJldjixvZW30S5jGXOA,2109
|
|
@@ -114,8 +114,8 @@ mkdocstrings_handlers/python/templates/readthedocs/languages/en.html.jinja,sha25
|
|
|
114
114
|
mkdocstrings_handlers/python/templates/readthedocs/languages/ja.html.jinja,sha256=e_DPZvMvaaJm0QyjTxW8SkBEbhMXBgBiMrLJ1osAwZc,46
|
|
115
115
|
mkdocstrings_handlers/python/templates/readthedocs/languages/zh.html.jinja,sha256=OuvrkorxuL0gKZNYneann1bwd1Z2i5bBY7SbC496HDw,46
|
|
116
116
|
mkdocstrings_handlers/python/templates/readthedocs/style.css,sha256=Ds8vF1rSxc2B0c4P10osx4cqXHWMntcSCxmRfX-nfzw,971
|
|
117
|
-
mkdocstrings_python-2.0.
|
|
118
|
-
mkdocstrings_python-2.0.
|
|
119
|
-
mkdocstrings_python-2.0.
|
|
120
|
-
mkdocstrings_python-2.0.
|
|
121
|
-
mkdocstrings_python-2.0.
|
|
117
|
+
mkdocstrings_python-2.0.6.dist-info/METADATA,sha256=JtU8hPL0qhB5_sEDYrWIiEZRGEABbc0NwWA3gGG65a8,12384
|
|
118
|
+
mkdocstrings_python-2.0.6.dist-info/WHEEL,sha256=VP-D4TPS230sME9Z3vb3INXvo1yt0924YRm5AOsk_dE,90
|
|
119
|
+
mkdocstrings_python-2.0.6.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
|
|
120
|
+
mkdocstrings_python-2.0.6.dist-info/licenses/LICENSE,sha256=JGb4pdPEM8TTjjhr-uNCO7oXkiVrwG5Pz0JamcjNF_s,754
|
|
121
|
+
mkdocstrings_python-2.0.6.dist-info/RECORD,,
|
|
File without changes
|
{mkdocstrings_python-2.0.5.dist-info → mkdocstrings_python-2.0.6.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
{mkdocstrings_python-2.0.5.dist-info → mkdocstrings_python-2.0.6.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|