Python sphinx.ext.autodoc.cut_lines() Examples

The following are 7 code examples of sphinx.ext.autodoc.cut_lines(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module sphinx.ext.autodoc , or try the search function .
Example #1
Source File: conf.py    From Pyro5 with MIT License 5 votes vote down vote up
def setup(app):
    # add custom css
    app.add_stylesheet("css/customize.css")
    from sphinx.ext.autodoc import cut_lines
    # skip the copyright line in every module docstring (last line of docstring)
    app.connect('autodoc-process-docstring', cut_lines(pre=0, post=1, what=['module'])) 
Example #2
Source File: conf.py    From attention-lvcsr with MIT License 5 votes vote down vote up
def setup(app):
    app.connect('autodoc-process-docstring', cut_lines(2, what=['module'])) 
Example #3
Source File: conf.py    From attention-lvcsr with MIT License 5 votes vote down vote up
def setup(app):
    app.connect('autodoc-process-docstring', cut_lines(2, what=['module']))
    app.connect('autodoc-skip-member', skip_abc) 
Example #4
Source File: conf.py    From pychemqt with GNU General Public License v3.0 5 votes vote down vote up
def setup(app):
    # Avoid print the copyright intro in each module documentation
    from sphinx.ext.autodoc import cut_lines
    app.connect('autodoc-process-docstring', cut_lines(15, what=['module']))

    # Generate the meos documentation files
    app.connect('builder-inited', Autogenerate_MEoS) 
Example #5
Source File: sage_autodoc.py    From pyoptools with GNU General Public License v3.0 5 votes vote down vote up
def cut_lines(pre, post=0, what=None):
    """
    Return a listener that removes the first *pre* and last *post*
    lines of every docstring.  If *what* is a sequence of strings,
    only docstrings of a type in *what* will be processed.

    Use like this (e.g. in the ``setup()`` function of :file:`conf.py`)::

       from sphinx.ext.autodoc import cut_lines
       app.connect('autodoc-process-docstring', cut_lines(4, what=['module']))

    This can (and should) be used in place of :confval:`automodule_skip_lines`.
    """
    def process(app, what_, name, obj, options, lines):
        if what and what_ not in what:
            return
        del lines[:pre]
        if post:
            # remove one trailing blank line.
            if lines and not lines[-1]:
                lines.pop(-1)
            del lines[-post:]
        # make sure there is a blank line at the end
        if lines and lines[-1]:
            lines.append('')
    return process 
Example #6
Source File: conf.py    From fuel with MIT License 5 votes vote down vote up
def setup(app):
    app.connect('autodoc-process-docstring', cut_lines(2, what=['module']))
    app.connect('autodoc-skip-member', skip_abc) 
Example #7
Source File: werkzeugext.py    From Werkzeug-docs-cn with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def setup(app):
    app.connect('autodoc-process-docstring', cut_lines(3, 3, what=['module']))