当前位置: 首页>>代码示例>>Python>>正文


Python autodoc.cut_lines函数代码示例

本文整理汇总了Python中sphinx.ext.autodoc.cut_lines函数的典型用法代码示例。如果您正苦于以下问题:Python cut_lines函数的具体用法?Python cut_lines怎么用?Python cut_lines使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了cut_lines函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setup

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"]
	))
开发者ID:marceloalcocer,项目名称:ultrafast,代码行数:10,代码来源:conf.py

示例2: setup

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)
开发者ID:axray,项目名称:dataware.dreamplug,代码行数:7,代码来源:conf.py

示例3: setup

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)
开发者ID:jjgomera,项目名称:pychemqt,代码行数:7,代码来源:conf.py

示例4: setup

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)
开发者ID:OpenBookProjects,项目名称:sphinx-doc-zh,代码行数:7,代码来源:conf.py

示例5: setup

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')
开发者ID:vorodev,项目名称:mopidy,代码行数:7,代码来源:conf.py

示例6: setup

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"]))
开发者ID:Adman,项目名称:nxtIDE,代码行数:8,代码来源:conf.py

示例7: setup

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])
开发者ID:karasusan,项目名称:sphinx-docs,代码行数:10,代码来源:conf.py

示例8: setup

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])
开发者ID:certik,项目名称:sphinx,代码行数:11,代码来源:conf.py

示例9: test_docstring_processing

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)
开发者ID:robgolding,项目名称:django-braces,代码行数:53,代码来源:test_autodoc.py

示例10: test_docstring_processing

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)
开发者ID:atodorov,项目名称:sphinx,代码行数:52,代码来源:test_autodoc.py

示例11: setup

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)
开发者ID:olivier-heurtier,项目名称:sphinx,代码行数:18,代码来源:conf.py

示例12: test_docstring_processing_functions

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)
开发者ID:BackupGGCode,项目名称:sphinx,代码行数:22,代码来源:test_autodoc.py

示例13: setup

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']))
开发者ID:gijs,项目名称:inasafe,代码行数:4,代码来源:conf.py

示例14: setup

def setup(app):
    from sphinx.ext.autodoc import cut_lines

    app.connect("autodoc-process-docstring", cut_lines(4, 2, what=["module"]))
开发者ID:fanchlegal,项目名称:framepy,代码行数:4,代码来源:conf.py

示例15: setup

def setup(app):
    from sphinx.ext.autodoc import cut_lines
    app.connect('autodoc-process-docstring', cut_lines(2, what=['module']))
开发者ID:Ascaf0,项目名称:synaptiks,代码行数:3,代码来源:conf.py


注:本文中的sphinx.ext.autodoc.cut_lines函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。