本文整理汇总了Python中sphinx.ext.autodoc.cut_lines方法的典型用法代码示例。如果您正苦于以下问题:Python autodoc.cut_lines方法的具体用法?Python autodoc.cut_lines怎么用?Python autodoc.cut_lines使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sphinx.ext.autodoc
的用法示例。
在下文中一共展示了autodoc.cut_lines方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setup
# 需要导入模块: from sphinx.ext import autodoc [as 别名]
# 或者: from sphinx.ext.autodoc import cut_lines [as 别名]
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']))
示例2: setup
# 需要导入模块: from sphinx.ext import autodoc [as 别名]
# 或者: from sphinx.ext.autodoc import cut_lines [as 别名]
def setup(app):
app.connect('autodoc-process-docstring', cut_lines(2, what=['module']))
示例3: setup
# 需要导入模块: from sphinx.ext import autodoc [as 别名]
# 或者: from sphinx.ext.autodoc import cut_lines [as 别名]
def setup(app):
app.connect('autodoc-process-docstring', cut_lines(2, what=['module']))
app.connect('autodoc-skip-member', skip_abc)
示例4: setup
# 需要导入模块: from sphinx.ext import autodoc [as 别名]
# 或者: from sphinx.ext.autodoc import cut_lines [as 别名]
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)
示例5: cut_lines
# 需要导入模块: from sphinx.ext import autodoc [as 别名]
# 或者: from sphinx.ext.autodoc import cut_lines [as 别名]
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
示例6: setup
# 需要导入模块: from sphinx.ext import autodoc [as 别名]
# 或者: from sphinx.ext.autodoc import cut_lines [as 别名]
def setup(app):
app.connect('autodoc-process-docstring', cut_lines(3, 3, what=['module']))