示例#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"]
	))
示例#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)
示例#3
0
文件: conf.py 项目: eudoxos/Pyro5
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']))
示例#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)
示例#5
0
文件: conf.py 项目: vorodev/mopidy
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')
示例#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)
示例#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)
示例#8
0
文件: conf.py 项目: zaghaghi/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']))
示例#9
0
文件: conf.py 项目: jjgomera/pychemqt
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)
示例#10
0
文件: conf.py 项目: nedbat/sphinx
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)
示例#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)
示例#12
0
文件: conf.py 项目: eisnerd/mopidy
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')
示例#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', '   '
    ]
示例#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']))
示例#15
0
文件: conf.py 项目: 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"]))
示例#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)
示例#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']))
示例#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)
示例#19
0
文件: conf.py 项目: tmaone/mopidy
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",
    )
示例#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])
示例#21
0
文件: conf.py 项目: certik/sphinx
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])
示例#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])
示例#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)
示例#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)
示例#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)
示例#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)
示例#27
0
文件: conf.py 项目: 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])
示例#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)
示例#29
0
def setup(app):
    from sphinx.ext.autodoc import cut_lines

    app.connect("autodoc-process-docstring", cut_lines(4, 2, what=["module"]))
示例#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")
示例#31
0
文件: conf.py 项目: 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']))
示例#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))
示例#33
0
文件: conf.py 项目: saeidy/tamkin
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"]))
示例#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"]))
示例#35
0
文件: conf.py 项目: FarnazH/hortonqa
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")
示例#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']))
示例#37
0
文件: conf.py 项目: bhaddow/blocks
def setup(app):
    app.connect('autodoc-process-docstring', cut_lines(2, what=['module']))
示例#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']))
示例#39
0
文件: conf.py 项目: Ascaf0/synaptiks
def setup(app):
    from sphinx.ext.autodoc import cut_lines
    app.connect('autodoc-process-docstring', cut_lines(2, what=['module']))
示例#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)
示例#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']))
示例#42
0
def setup(app):
    app.connect('autodoc-process-docstring', cut_lines(2, what=['module']))
    app.connect('autodoc-skip-member', skip_abc)
示例#43
0
def setup(app):
    app.connect("autodoc-process-docstring", cut_lines(2, what=["module"]))
示例#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')
示例#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']))
示例#46
0
文件: conf.py 项目: 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']))
示例#47
0
def setup(app):
    app.connect('missing-reference', missing_reference)
    app.connect('autodoc-process-docstring', cut_lines(2, what=['module']))
示例#48
0
文件: conf.py 项目: lanstat/pyudev
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)
示例#49
0
文件: conf.py 项目: zzpwelkin/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']))
示例#50
0
文件: conf.py 项目: GunioRobot/pymc
def setup(app):
    from sphinx.ext.autodoc import cut_lines
    app.connect('autodoc-process-docstring', cut_lines(1, what=['function']))
示例#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)
示例#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']))
示例#53
0
def setup(app):
    from sphinx.ext.autodoc import cut_lines
    app.connect('autodoc-process-docstring', cut_lines(17, what=['module']))
示例#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"]))
示例#55
0
def setup(app):
    app.connect('autodoc-process-docstring', cut_lines(30, 30,
                                                       what=['module']))
示例#56
0
def setup(app):
    app.connect('missing-reference', missing_reference)
    app.connect('autodoc-process-docstring', cut_lines(2, what=['module']))