Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
for e in memberdocumenters:
section = self.member_sections.get(
e[0].member_order, 'Miscellaneous')
if self.env.app:
e[0].parse_name()
e[0].import_object()
user_section = self.env.app.emit_firstresult(
'autodocsumm-grouper', self.objtype, e[0].object_name,
e[0].object, section, self.object)
section = user_section or section
documenters.setdefault(section, []).append(e)
self.options.update(options_save)
return documenters
class AutoSummModuleDocumenter(ModuleDocumenter, AutosummaryDocumenter):
"""Module documentor suitable for the :class:`AutoSummDirective`
This class has the same functionality as the base
:class:`sphinx.ext.autodoc.ModuleDocumenter` class but with an additional
`autosummary` and the :meth:`get_grouped_documenters` method.
It's priority is slightly higher than the one of the ModuleDocumenter."""
#: slightly higher priority than
#: :class:`sphinx.ext.autodoc.ModuleDocumenter`
priority = ModuleDocumenter.priority + 0.1
#: original option_spec from :class:`sphinx.ext.autodoc.ModuleDocumenter`
#: but with additional autosummary boolean option
option_spec = ModuleDocumenter.option_spec.copy()
option_spec['autosummary'] = bool_option
option_spec['autosummary-no-nesting'] = bool_option
del _option
member_sections = OrderedDict([
(ad.ClassDocumenter.member_order, 'Classes'),
(ad.ExceptionDocumenter.member_order, 'Exceptions'),
(ad.FunctionDocumenter.member_order, 'Functions'),
(ad.DataDocumenter.member_order, 'Data'),
])
""":class:`~collections.OrderedDict` that includes the autosummary sections
This dictionary defines the sections for the autosummmary option. The
values correspond to the :attr:`sphinx.ext.autodoc.Documenter.member_order`
attribute that shall be used for each section."""
class AutoSummClassDocumenter(ClassDocumenter, AutosummaryDocumenter):
"""Class documentor suitable for the :class:`AutoSummDirective`
This class has the same functionality as the base
:class:`sphinx.ext.autodoc.ClassDocumenter` class but with an additional
`autosummary` option to provide the ability to provide a summary of all
methods and attributes at the beginning.
It's priority is slightly higher than the one of the ClassDocumenter"""
#: slightly higher priority than
#: :class:`sphinx.ext.autodoc.ClassDocumenter`
priority = ClassDocumenter.priority + 0.1
#: original option_spec from :class:`sphinx.ext.autodoc.ClassDocumenter`
#: but with additional autosummary boolean option
option_spec = ClassDocumenter.option_spec.copy()
option_spec['autosummary'] = bool_option