11from __future__ import annotations
22
3- from typing import TYPE_CHECKING
4-
5- from sphinx .ext .autodoc ._directive_options import (
6- annotation_option ,
7- bool_option ,
8- class_doc_from_option ,
9- exclude_members_option ,
10- identity ,
11- inherited_members_option ,
12- member_order_option ,
13- members_option ,
14- )
15-
16- if TYPE_CHECKING :
17- from typing import ClassVar
18-
19- from sphinx .ext .autodoc ._property_types import (
20- _AssignStatementProperties ,
21- _ClassDefProperties ,
22- _FunctionDefProperties ,
23- _ItemProperties ,
24- _ModuleProperties ,
25- _TypeStatementProperties ,
26- )
27- from sphinx .util .typing import OptionSpec
28-
293
304class Documenter :
315 """A Documenter knows how to autodocument a single object type. When
@@ -41,144 +15,3 @@ class Documenter:
4115 in fact, it will be used to parse an auto directive's options that matches
4216 the Documenter.
4317 """
44-
45- props : _ItemProperties
46-
47- #: name by which the directive is called (auto...) and the default
48- #: generated directive name
49- objtype : ClassVar = 'object'
50- #: true if the generated content may contain titles
51- titles_allowed : ClassVar = True
52-
53- option_spec : ClassVar [OptionSpec ] = {
54- 'no-index' : bool_option ,
55- 'no-index-entry' : bool_option ,
56- 'noindex' : bool_option ,
57- }
58-
59-
60- class ModuleDocumenter (Documenter ):
61- """Specialized Documenter subclass for modules."""
62-
63- props : _ModuleProperties
64-
65- objtype = 'module'
66-
67- option_spec : ClassVar [OptionSpec ] = {
68- 'members' : members_option ,
69- 'undoc-members' : bool_option ,
70- 'no-index' : bool_option ,
71- 'no-index-entry' : bool_option ,
72- 'inherited-members' : inherited_members_option ,
73- 'show-inheritance' : bool_option ,
74- 'synopsis' : identity ,
75- 'platform' : identity ,
76- 'deprecated' : bool_option ,
77- 'member-order' : member_order_option ,
78- 'exclude-members' : exclude_members_option ,
79- 'private-members' : members_option ,
80- 'special-members' : members_option ,
81- 'imported-members' : bool_option ,
82- 'ignore-module-all' : bool_option ,
83- 'no-value' : bool_option ,
84- 'noindex' : bool_option ,
85- }
86-
87-
88- class FunctionDocumenter (Documenter ):
89- """Specialized Documenter subclass for functions."""
90-
91- props : _FunctionDefProperties
92-
93- objtype = 'function'
94-
95-
96- class DecoratorDocumenter (FunctionDocumenter ):
97- """Specialized Documenter subclass for decorator functions."""
98-
99- props : _FunctionDefProperties
100-
101- objtype = 'decorator'
102-
103-
104- class ClassDocumenter (Documenter ):
105- """Specialized Documenter subclass for classes."""
106-
107- props : _ClassDefProperties
108-
109- objtype = 'class'
110- option_spec : ClassVar [OptionSpec ] = {
111- 'members' : members_option ,
112- 'undoc-members' : bool_option ,
113- 'no-index' : bool_option ,
114- 'no-index-entry' : bool_option ,
115- 'inherited-members' : inherited_members_option ,
116- 'show-inheritance' : bool_option ,
117- 'member-order' : member_order_option ,
118- 'exclude-members' : exclude_members_option ,
119- 'private-members' : members_option ,
120- 'special-members' : members_option ,
121- 'class-doc-from' : class_doc_from_option ,
122- 'noindex' : bool_option ,
123- }
124-
125-
126- class ExceptionDocumenter (ClassDocumenter ):
127- """Specialized ClassDocumenter subclass for exceptions."""
128-
129- props : _ClassDefProperties
130-
131- objtype = 'exception'
132-
133-
134- class DataDocumenter (Documenter ):
135- """Specialized Documenter subclass for data items."""
136-
137- props : _AssignStatementProperties
138-
139- objtype = 'data'
140- option_spec : ClassVar [OptionSpec ] = dict (Documenter .option_spec )
141- option_spec ['annotation' ] = annotation_option
142- option_spec ['no-value' ] = bool_option
143-
144-
145- class MethodDocumenter (Documenter ):
146- """Specialized Documenter subclass for methods (normal, static and class)."""
147-
148- props : _FunctionDefProperties
149-
150- objtype = 'method'
151- directivetype = 'method'
152-
153-
154- class AttributeDocumenter (Documenter ):
155- """Specialized Documenter subclass for attributes."""
156-
157- props : _AssignStatementProperties
158-
159- objtype = 'attribute'
160- option_spec : ClassVar [OptionSpec ] = dict (Documenter .option_spec )
161- option_spec ['annotation' ] = annotation_option
162- option_spec ['no-value' ] = bool_option
163-
164-
165- class PropertyDocumenter (Documenter ):
166- """Specialized Documenter subclass for properties."""
167-
168- props : _FunctionDefProperties
169-
170- objtype = 'property'
171-
172-
173- class TypeAliasDocumenter (Documenter ):
174- """Specialized Documenter subclass for type aliases."""
175-
176- props : _TypeStatementProperties
177-
178- objtype = 'type'
179- option_spec : ClassVar [OptionSpec ] = {
180- 'no-index' : bool_option ,
181- 'no-index-entry' : bool_option ,
182- 'annotation' : annotation_option ,
183- 'no-value' : bool_option ,
184- }
0 commit comments