Example #1
0
def setup(app):
	app.connect("autodoc-process-docstring", cut_lines(
		pre=1,
		post=11,
		what=["module"]
	))
	app.connect("autodoc-process-docstring", cut_lines(
		pre=1,
		what=["module","class","method","function","attribute","data","exception"]
	))
Example #2
0
def setup(app):
    from sphinx.ext.autodoc import cut_lines
    app.connect('autodoc-process-docstring', cut_lines(4, what=['module']))
    app.add_object_type('directive', 'dir', 'pair: %s; directive', parse_directive)
    app.add_object_type('role', 'role', 'pair: %s; role', parse_role)
    app.add_object_type('confval', 'confval', 'pair: %s; configuration value')
    app.add_object_type('event', 'event', 'pair: %s; event', parse_event)
Example #3
0
def setup(app):
    # add custom css
    app.add_css_file("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 #4
0
def setup(app):
    from sphinx.ext.autodoc import cut_lines
    from sphinx.util.docfields import GroupedField
    app.connect('autodoc-process-docstring', cut_lines(4, what=['module']))
    app.connect('source-read', linkify_issues_in_changelog)
    app.add_object_type('confval', 'confval',
                        objname='configuration value',
                        indextemplate='pair: %s; configuration value')
    app.add_object_type('setuptools-confval', 'setuptools-confval',
                        objname='setuptools configuration value',
                        indextemplate='pair: %s; setuptools configuration value')
    fdesc = GroupedField('parameter', label='Parameters',
                         names=['param'], can_collapse=True)
    app.add_object_type('event', 'event', 'pair: %s; event', parse_event,
                        doc_field_types=[fdesc])

    # Load jQuery and patches to make readthedocs-doc-embed.js available (refs: #10574)
    app.add_js_file('https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js',
                    priority=100)
    app.add_js_file('https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.13.1/underscore-min.js',  # NoQA
                    priority=100)
    app.add_js_file('_sphinx_javascript_frameworks_compat.js', priority=105)

    # workaround for RTD
    from sphinx.util import logging
    logger = logging.getLogger(__name__)
    app.info = lambda *args, **kwargs: logger.info(*args, **kwargs)
    app.warn = lambda *args, **kwargs: logger.warning(*args, **kwargs)
    app.debug = lambda *args, **kwargs: logger.debug(*args, **kwargs)
Example #5
0
def setup(app):
    from sphinx.ext.autodoc import cut_lines
    app.connect(b'autodoc-process-docstring', cut_lines(4, what=['module']))
    app.add_object_type(
        b'confval', 'confval',
        objname='configuration value',
        indextemplate='pair: %s; configuration value')
Example #6
0
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 #7
0
def setup(app):
    from sphinx.ext.autodoc import cut_lines
    app.connect('autodoc-process-docstring', cut_lines(4, what=['module']))
    app.add_description_unit('directive', 'dir', 'pair: %s; directive', parse_directive)
    app.add_description_unit('role', 'role', 'pair: %s; role', parse_role)
    app.add_description_unit('confval', 'confval', 'pair: %s; configuration value')
    app.add_description_unit('event', 'event', 'pair: %s; event', parse_event)
Example #8
0
def setup(app):
    # add custom stylesheet
    app.add_stylesheet("css/customize.css")
    from sphinx.ext.autodoc import cut_lines
    # skip the copyright lines in every module docstring (last two lines of docstring)
    app.connect('autodoc-process-docstring',
                cut_lines(pre=0, post=2, what=['module']))
Example #9
0
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 #10
0
def setup(app):
    from sphinx.ext.autodoc import cut_lines
    from sphinx.util.docfields import GroupedField
    app.connect('autodoc-process-docstring', cut_lines(4, what=['module']))
    app.add_object_type('confval',
                        'confval',
                        objname='configuration value',
                        indextemplate='pair: %s; configuration value')
    app.add_object_type(
        'setuptools-confval',
        'setuptools-confval',
        objname='setuptools configuration value',
        indextemplate='pair: %s; setuptools configuration value')
    fdesc = GroupedField('parameter',
                         label='Parameters',
                         names=['param'],
                         can_collapse=True)
    app.add_object_type('event',
                        'event',
                        'pair: %s; event',
                        parse_event,
                        doc_field_types=[fdesc])

    # workaround for RTD
    from sphinx.util import logging
    logger = logging.getLogger(__name__)
    app.info = lambda *args, **kwargs: logger.info(*args, **kwargs)
    app.warn = lambda *args, **kwargs: logger.warning(*args, **kwargs)
    app.debug = lambda *args, **kwargs: logger.debug(*args, **kwargs)
Example #11
0
def setup(app):
    from sphinx.ext.autodoc import cut_lines
    app.connect('autodoc-process-docstring', cut_lines(4, what=['module']))
    app.add_description_unit('confval', 'confval',
                             objname='configuration value',
                             indextemplate='pair: %s; configuration value')
    app.add_description_unit('event', 'event', 'pair: %s; event', parse_event)
Example #12
0
def setup(app):
    from sphinx.ext.autodoc import cut_lines
    app.connect(b'autodoc-process-docstring', cut_lines(4, what=['module']))
    app.add_object_type(b'confval',
                        'confval',
                        objname='configuration value',
                        indextemplate='pair: %s; configuration value')
Example #13
0
def test_cut_lines(app):
    app.connect('autodoc-process-docstring', cut_lines(2, 2, ['function']))

    actual = do_autodoc(app, 'function', 'target.process_docstring.func')
    assert list(actual) == [
        '', '.. py:function:: func()', '   :module: target.process_docstring',
        '', '   second line', '   '
    ]
Example #14
0
def setup(app):
    from sphinx.ext.autodoc import between, cut_lines
    global autodoc_lang
    if 'autodoc_lang' in app.config.overrides:
        autodoc_lang = app.config.overrides['autodoc_lang']
    app.connect('autodoc-process-docstring',
                between('\.\.\s\[(/|)' + autodoc_lang + '\].*', ['function']))
    app.connect('autodoc-process-docstring', cut_lines(1, what=['function']))
Example #15
0
File: conf.py Project: Adman/nxtIDE
def setup(app):
    from sphinx.ext.autodoc import between, cut_lines

    global autodoc_lang
    if "autodoc_lang" in app.config.overrides:
        autodoc_lang = app.config.overrides["autodoc_lang"]
    app.connect("autodoc-process-docstring", between("\.\.\s\[(/|)" + autodoc_lang + "\].*", ["function"]))
    app.connect("autodoc-process-docstring", cut_lines(1, what=["function"]))
Example #16
0
def setup(app):
    from sphinx.ext.autodoc import cut_lines

    app.connect("autodoc-process-docstring", cut_lines(4, what=["module"]))
    app.add_description_unit("directive", "dir", "pair: %s; directive", parse_directive)
    app.add_description_unit("role", "role", "pair: %s; role", parse_role)
    app.add_description_unit("confval", "confval", "pair: %s; configuration value")
    app.add_description_unit("event", "event", "pair: %s; event", parse_event)
Example #17
0
def setup(app, **options):
    """
    Overriding Public method

    :param app: The Sphinx App instance
    :param options: Extra options
    """
    app.connect('autodoc-process-docstring', fix_docstring)
    app.connect('autodoc-process-docstring', cut_lines(25, what=['module']))
Example #18
0
def test_docstring_processing():
    def process(objtype, name, obj):
        inst = AutoDirective._registry[objtype](directive, name)
        inst.object = obj
        inst.fullname = name
        return list(inst.process_doc(inst.get_doc()))

    class E:
        def __init__(self):
            """Init docstring"""

    # docstring processing by event handler
    assert process('class', 'bar', E) == ['Init docstring', '', '42', '']

    lid = app.connect('autodoc-process-docstring',
                      cut_lines(1, 1, ['function']))

    def f():
        """
        first line
        second line
        third line
        """

    assert process('function', 'f', f) == ['second line', '']
    app.disconnect(lid)

    lid = app.connect('autodoc-process-docstring',
                      between('---', ['function']))

    def g():
        """
        first line
        ---
        second line
        ---
        third line
        """

    assert process('function', 'g', g) == ['second line', '']
    app.disconnect(lid)

    lid = app.connect('autodoc-process-docstring',
                      between('---', ['function'], exclude=True))

    def h():
        """
        first line
        ---
        second line
        ---
        third line
        """

    assert process('function', 'h', h) == ['first line', 'third line', '']
    app.disconnect(lid)
Example #19
0
def setup(app):
    from sphinx.ext.autodoc import cut_lines

    app.connect("autodoc-process-docstring", cut_lines(4, what=["module"]))
    app.add_object_type(
        "confval",
        "confval",
        objname="configuration value",
        indextemplate="pair: %s; configuration value",
    )
Example #20
0
def setup(app):
    from sphinx.ext.autodoc import cut_lines
    from sphinx.util.docfields import GroupedField

    app.connect("autodoc-process-docstring", cut_lines(4, what=["module"]))
    app.add_object_type(
        "confval", "confval", objname="configuration value", indextemplate="pair: %s; configuration value"
    )
    fdesc = GroupedField("parameter", label="Parameters", names=["param"], can_collapse=True)
    app.add_object_type("event", "event", "pair: %s; event", parse_event, doc_field_types=[fdesc])
Example #21
0
def setup(app):
    from sphinx.ext.autodoc import cut_lines
    from sphinx.util.docfields import GroupedField
    app.connect('autodoc-process-docstring', cut_lines(4, what=['module']))
    app.add_object_type('confval', 'confval',
                        objname='configuration value',
                        indextemplate='pair: %s; configuration value')
    fdesc = GroupedField('parameter', label='Parameters',
                         names=['param'], can_collapse=True)
    app.add_object_type('event', 'event', 'pair: %s; event', parse_event,
                        doc_field_types=[fdesc])
Example #22
0
def setup(app):
    from sphinx.ext.autodoc import cut_lines
    from sphinx.util.docfields import GroupedField
    app.connect('autodoc-process-docstring', cut_lines(4, what=['module']))
    app.add_object_type('confval', 'confval',
                        objname='configuration value',
                        indextemplate='pair: %s; configuration value')
    fdesc = GroupedField('parameter', label='Parameters',
                         names=['param'], can_collapse=True)
    app.add_object_type('event', 'event', 'pair: %s; event', parse_event,
                        doc_field_types=[fdesc])
Example #23
0
def test_docstring_processing():
    def process(objtype, name, obj):
        inst = AutoDirective._registry[objtype](directive, name)
        inst.object = obj
        inst.fullname = name
        return list(inst.process_doc(inst.get_doc()))

    class E:
        def __init__(self):
            """Init docstring"""

    # docstring processing by event handler
    assert process("class", "bar", E) == ["Init docstring", "", "42", ""]

    lid = app.connect("autodoc-process-docstring", cut_lines(1, 1, ["function"]))

    def f():
        """
        first line
        second line
        third line
        """

    assert process("function", "f", f) == ["second line", ""]
    app.disconnect(lid)

    lid = app.connect("autodoc-process-docstring", between("---", ["function"]))

    def g():
        """
        first line
        ---
        second line
        ---
        third line
        """

    assert process("function", "g", g) == ["second line", ""]
    app.disconnect(lid)

    lid = app.connect("autodoc-process-docstring", between("---", ["function"], exclude=True))

    def h():
        """
        first line
        ---
        second line
        ---
        third line
        """

    assert process("function", "h", h) == ["first line", "third line", ""]
    app.disconnect(lid)
Example #24
0
def test_docstring_processing():
    def process(objtype, name, obj):
        inst = AutoDirective._registry[objtype](directive, name)
        inst.object = obj
        inst.fullname = name
        return list(inst.process_doc(inst.get_doc()))

    class E:
        def __init__(self):
            """Init docstring"""

    # docstring processing by event handler
    assert process('class', 'bar', E) == ['Init docstring', '', '42', '']

    lid = app.connect('autodoc-process-docstring',
                      cut_lines(1, 1, ['function']))

    def f():
        """
        first line
        second line
        third line
        """
    assert process('function', 'f', f) == ['second line', '']
    app.disconnect(lid)

    lid = app.connect('autodoc-process-docstring', between('---', ['function']))

    def g():
        """
        first line
        ---
        second line
        ---
        third line
        """
    assert process('function', 'g', g) == ['second line', '']
    app.disconnect(lid)

    lid = app.connect('autodoc-process-docstring',
                      between('---', ['function'], exclude=True))

    def h():
        """
        first line
        ---
        second line
        ---
        third line
        """
    assert process('function', 'h', h) == ['first line', 'third line', '']
    app.disconnect(lid)
Example #25
0
def setup(app):
    from sphinx.ext.autodoc import cut_lines
    from sphinx.util.docfields import GroupedField
    app.connect('autodoc-process-docstring', cut_lines(4, what=['module']))
    app.add_object_type('confval', 'confval',
                        objname='configuration value',
                        indextemplate='pair: %s; configuration value')
    fdesc = GroupedField('parameter', label='Parameters',
                         names=['param'], can_collapse=True)
    app.add_object_type('event', 'event', 'pair: %s; event', parse_event,
                        doc_field_types=[fdesc])

    # workaround for RTD
    from sphinx.util import logging
    logger = logging.getLogger(__name__)
    app.info = lambda *args, **kwargs: logger.info(*args, **kwargs)
    app.warn = lambda *args, **kwargs: logger.warning(*args, **kwargs)
    app.debug = lambda *args, **kwargs: logger.debug(*args, **kwargs)
Example #26
0
def setup(app):
    from sphinx.ext.autodoc import cut_lines

    app.srcdir = basedir
    app.confdir = app.srcdir
    app.connect("autodoc-process-docstring", cut_lines(4, what=["module"]))
    app.add_object_type(
        "confval",
        "confval",
        objname="configuration value",
        indextemplate="pair: %s; configuration value",
    )

    # workaround for RTD
    from sphinx.util import logging

    logger = logging.getLogger(__name__)
    app.info = lambda *args, **kwargs: logger.info(*args, **kwargs)
    app.warn = lambda *args, **kwargs: logger.warning(*args, **kwargs)
    app.debug = lambda *args, **kwargs: logger.debug(*args, **kwargs)
Example #27
0
File: conf.py Project: tknv/ablog
def setup(app):
    from sphinx.ext.autodoc import cut_lines
    from sphinx.util.docfields import GroupedField

    app.connect("autodoc-process-docstring", cut_lines(4, what=["module"]))
    app.add_object_type(
        "confval",
        "confval",
        objname="configuration value",
        indextemplate="pair: %s; configuration value",
    )
    fdesc = GroupedField("parameter",
                         label="Parameters",
                         names=["param"],
                         can_collapse=True)
    app.add_object_type("event",
                        "event",
                        "pair: %s; event",
                        parse_event,
                        doc_field_types=[fdesc])
Example #28
0
def test_docstring_processing_functions():
    lid = app.connect('autodoc-process-docstring', cut_lines(1, 1, ['function']))
    def f():
        """
        first line
        second line
        third line
        """
    assert list(gen.get_doc('function', 'f', f)) == ['second line', '']
    app.disconnect(lid)

    lid = app.connect('autodoc-process-docstring', between('---', ['function']))
    def f():
        """
        first line
        ---
        second line
        ---
        third line
        """
    assert list(gen.get_doc('function', 'f', f)) == ['second line', '']
    app.disconnect(lid)
Example #29
0
def setup(app):
    from sphinx.ext.autodoc import cut_lines

    app.connect("autodoc-process-docstring", cut_lines(4, 2, what=["module"]))
Example #30
0
def setup(app):
    from sphinx.ext.autodoc import cut_lines
    app.connect("autodoc-skip-member", autodoc_skip_member)
    app.connect('autodoc-process-docstring', cut_lines(2, what=['module']))
    app.add_stylesheet("custom.css")
Example #31
0
File: conf.py Project: gijs/inasafe
def setup(app):
  #remove first line of module docstrings - it's module title
  from sphinx.ext.autodoc import cut_lines
  app.connect('autodoc-process-docstring', cut_lines(1, what=['module']))
Example #32
0
def setup(app):
    app.add_css_file('theme_overrides.css')

    # remove first line description docstrings in documentation
    app.connect('autodoc-process-docstring', cut_lines(1))
Example #33
0
def setup(app):
    from sphinx.ext.autodoc import cut_lines

    app.connect("autodoc-skip-member", autodoc_skip_member)
    app.connect("autodoc-process-docstring", cut_lines(2, what=["module"]))
Example #34
0
def setup(app):
    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 #35
0
def setup(app):
    from sphinx.ext.autodoc import cut_lines
    app.connect("autodoc-skip-member", autodoc_skip_member)
    app.connect('autodoc-process-docstring', cut_lines(2, what=['module']))
    app.add_stylesheet("custom.css")
Example #36
0
def setup(app):
    from sphinx.ext.autodoc import cut_lines
    app.connect("doctree-resolved", list_toctree)
    app.connect('autodoc-process-docstring', cut_lines(2, what=['module']))
Example #37
0
def setup(app):
    app.connect('autodoc-process-docstring', cut_lines(2, what=['module']))
Example #38
0
def setup(app):
    from sphinx.ext.autodoc import cut_lines
    # This cuts off the standard disclaimer from all module doc strings.
    app.connect('autodoc-process-docstring',
                cut_lines(0, post=4, what=['module']))
Example #39
0
def setup(app):
    from sphinx.ext.autodoc import cut_lines
    app.connect('autodoc-process-docstring', cut_lines(2, what=['module']))
Example #40
0
def setup(app):
    from sphinx.ext.autodoc import cut_lines

    app.connect("autodoc-process-docstring", cut_lines(2, what=["module"]))
    app.add_directive("udevversion", UDevVersion)
Example #41
0
def setup(app):
    from sphinx.ext.autodoc import cut_lines
    # skip the copyright lines in every module docstring (last two lines of docstring)
    app.connect('autodoc-process-docstring', cut_lines(pre=0, post=2, what=['module']))
Example #42
0
def setup(app):
    app.connect('autodoc-process-docstring', cut_lines(2, what=['module']))
    app.connect('autodoc-skip-member', skip_abc)
Example #43
0
def setup(app):
    app.connect("autodoc-process-docstring", cut_lines(2, what=["module"]))
Example #44
0
def setup(app):
    from sphinx.ext.autodoc import cut_lines
    app.connect('autodoc-process-docstring', cut_lines(3, 3, what=['module']))
    app.add_description_unit('confval', 'confval',
                             'pair: %s; configuration value')
Example #45
0
def setup(app):
    from sphinx.ext.autodoc import cut_lines
    # This cuts off the standard disclaimer from all module doc strings.
    app.connect('autodoc-process-docstring',
                cut_lines(0, post=4, what=['module']))
Example #46
0
File: conf.py Project: irmen/Tale
def setup(app):
    # add custom stylesheet
    app.add_stylesheet("css/customize.css")
    from sphinx.ext.autodoc import cut_lines
    # skip the copyright lines in every module docstring (last two lines of docstring)
    app.connect('autodoc-process-docstring', cut_lines(pre=0, post=2, what=['module']))
Example #47
0
def setup(app):
    app.connect('missing-reference', missing_reference)
    app.connect('autodoc-process-docstring', cut_lines(2, what=['module']))
Example #48
0
def setup(app):
    from sphinx.ext.autodoc import cut_lines
    app.connect(b'autodoc-process-docstring', cut_lines(2, what=['module']))
    app.add_directive('udevversion', UDevVersion)
Example #49
0
def setup(app):
    #remove first line of module docstrings - it's module title
    from sphinx.ext.autodoc import cut_lines
    app.connect('autodoc-process-docstring', cut_lines(1, what=['module']))
Example #50
0
def setup(app):
    from sphinx.ext.autodoc import cut_lines
    app.connect('autodoc-process-docstring', cut_lines(1, what=['function']))
Example #51
0
def setup(app):
    from sphinx.ext.autodoc import cut_lines
    app.connect(b'autodoc-process-docstring', cut_lines(2, what=['module']))
    app.add_directive('udevversion', UDevVersion)
Example #52
0
def setup(app):
    from sphinx.ext.autodoc import cut_lines
    # skip the copyright lines in every module docstring (last two lines of docstring)
    app.connect('autodoc-process-docstring',
                cut_lines(pre=0, post=2, what=['module']))
Example #53
0
def setup(app):
    from sphinx.ext.autodoc import cut_lines
    app.connect('autodoc-process-docstring', cut_lines(17, what=['module']))
Example #54
0
def setup(app):
    from sphinx.ext.autodoc import cut_lines

    # skip the copyright lines in every module docstring
    app.connect("autodoc-process-docstring", cut_lines(pre=17,
                                                       what=["module"]))
Example #55
0
def setup(app):
    app.connect('autodoc-process-docstring', cut_lines(30, 30,
                                                       what=['module']))
Example #56
0
def setup(app):
    app.connect('missing-reference', missing_reference)
    app.connect('autodoc-process-docstring', cut_lines(2, what=['module']))