How to use the autodocsumm.__init__.AutoSummModuleDocumenter function in autodocsumm

To help you get started, we’ve selected a few autodocsumm examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Chilipp / autodocsumm / autodocsumm / __init__.py View on Github external
def setup(app):
    """setup function for using this module as a sphinx extension"""
    app.setup_extension('sphinx.ext.autosummary')
    app.setup_extension('sphinx.ext.autodoc')

    # make sure to allow inheritance when registering new documenters
    if sphinx_version < [1, 7]:
        registry = AutodocRegistry._registry
    else:
        registry = get_documenters(app)
    for cls in [AutoSummClassDocumenter, AutoSummModuleDocumenter,
                CallableAttributeDocumenter, NoDataDataDocumenter,
                NoDataAttributeDocumenter]:
        if not issubclass(registry.get(cls.objtype), cls):
            if sphinx_version >= [2, 2]:
                app.add_autodocumenter(cls, override=True)
            elif sphinx_version >= [0, 6]:
                app.add_autodocumenter(cls)
            else:
                app.add_documenter(cls)

    # directives
    if sphinx_version >= [1, 8]:
        app.add_directive('automodule', AutoSummDirective, override=True)
        app.add_directive('autoclass', AutoSummDirective, override=True)
    else:
        app.add_directive('automodule', AutoSummDirective)
github Chilipp / autodocsumm / autodocsumm / __init__.py View on Github external
except AttributeError:
                lineno = None
            doc_class = get_documenters(self.env.app)[objtype]
            args = (self.state, ) if sphinx_version >= [2, 1] else ()
            params = DocumenterBridge(
                env, reporter,
                process_documenter_options(doc_class, env.config,
                                           self.options),
                lineno, *args)
        documenter = doc_class(params, self.arguments[0])
        if hasattr(documenter, 'get_grouped_documenters'):
            self._autosummary_documenter = documenter
            return documenter
        # in case the has been changed in the registry, we decide manually
        if objtype == 'module':
            documenter = AutoSummModuleDocumenter(params, self.arguments[0])
        elif objtype == 'class':
            documenter = AutoSummClassDocumenter(params, self.arguments[0])
        else:
            raise ValueError(
                "Could not find a valid documenter for the object type %s" % (
                    objtype))
        self._autosummary_documenter = documenter
        return documenter