|
20 | 20 | import sys
|
21 | 21 | from dataclasses import dataclass, fields
|
22 | 22 | from pathlib import Path
|
23 |
| -from textwrap import dedent |
24 |
| -from typing import Annotated, Any, ClassVar, Mapping, MutableMapping, Optional |
| 23 | +from typing import Any, ClassVar, Mapping, MutableMapping, Optional |
25 | 24 | from warnings import warn
|
26 | 25 |
|
27 | 26 | from mkdocs.config.defaults import MkDocsConfig
|
28 |
| -from mkdocstrings.handlers.base import CollectorItem |
29 |
| -from mkdocstrings.loggers import get_logger |
30 |
| -from mkdocstrings_handlers.python.config import PythonOptions, Field, PythonConfig |
31 |
| -from mkdocstrings_handlers.python.handler import PythonHandler |
| 27 | +from mkdocstrings import CollectorItem, get_logger |
| 28 | +from mkdocstrings_handlers.python import PythonHandler, PythonOptions, PythonConfig |
32 | 29 |
|
33 | 30 | from .crossref import substitute_relative_crossrefs
|
34 | 31 |
|
|
38 | 35 |
|
39 | 36 | logger = get_logger(__name__)
|
40 | 37 |
|
41 |
| - |
42 |
| -# TODO mkdocstrings 0.28 |
43 |
| -# - `name` and `domain` (py) must be specified as class attributes |
44 |
| -# - `handler` arg to superclass is deprecated |
45 |
| -# - add `mdx` arg to constructor to pass on to superclass |
46 |
| -# - `config_file_path` arg will no longer be passed |
47 |
| -# |
48 |
| - |
49 | 38 | # TODO python 3.9 - remove when 3.9 support is dropped
|
50 | 39 | _dataclass_options = {"frozen": True}
|
51 | 40 | if sys.version_info >= (3, 10):
|
52 | 41 | _dataclass_options["kw_only"] = True
|
53 | 42 |
|
54 | 43 | @dataclass(**_dataclass_options)
|
55 | 44 | class PythonRelXRefOptions(PythonOptions):
|
56 |
| - check_crossrefs: Annotated[ |
57 |
| - bool, |
58 |
| - Field( |
59 |
| - group="docstrings", |
60 |
| - parent="docstring_options", |
61 |
| - description=dedent( |
62 |
| - """ |
63 |
| - Enables early checking of all cross-references. |
64 |
| - |
65 |
| - Note that this option only takes affect if **relative_crossrefs** is |
66 |
| - also true. This option is true by default, so this option is used to |
67 |
| - disable checking. Checking can also be disabled on a per-case basis by |
68 |
| - prefixing the reference with '?', e.g. `[something][?dontcheckme]`. |
69 |
| - """ |
70 |
| - ), |
71 |
| - ), |
72 |
| - ] = True |
| 45 | + check_crossrefs: bool = True |
73 | 46 |
|
74 | 47 | class PythonRelXRefHandler(PythonHandler):
|
75 | 48 | """Extended version of mkdocstrings Python handler
|
|
0 commit comments