本文整理汇总了Python中apigen.ApiDocWriter.write_index方法的典型用法代码示例。如果您正苦于以下问题:Python ApiDocWriter.write_index方法的具体用法?Python ApiDocWriter.write_index怎么用?Python ApiDocWriter.write_index使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类apigen.ApiDocWriter
的用法示例。
在下文中一共展示了ApiDocWriter.write_index方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: writeapi
# 需要导入模块: from apigen import ApiDocWriter [as 别名]
# 或者: from apigen.ApiDocWriter import write_index [as 别名]
def writeapi(package, outdir, source_version, other_defines=True):
# Check that the package is available. If not, the API documentation is not
# (re)generated and existing API documentation sources will be used.
try:
__import__(package)
except ImportError:
abort("Can not import " + package)
module = sys.modules[package]
# Check that the source version is equal to the installed
# version. If the versions mismatch the API documentation sources
# are not (re)generated. This avoids automatic generation of documentation
# for older or newer versions if such versions are installed on the system.
installed_version = V(module.__version__)
if source_version != installed_version:
abort("Installed version does not match source version")
docwriter = ApiDocWriter(package, rst_extension='.rst',
other_defines=other_defines)
docwriter.package_skip_patterns += [r'\.%s$' % package,
r'.*test.*$',
r'.*duecredit.*$',
r'.*due.*$',
r'\.version.*$']
docwriter.write_api_docs(outdir)
docwriter.write_index(outdir, 'index', relative_to=outdir)
print('%d files written' % len(docwriter.written_modules))
示例2: ApiDocWriter
# 需要导入模块: from apigen import ApiDocWriter [as 别名]
# 或者: from apigen.ApiDocWriter import write_index [as 别名]
#!/usr/bin/env python
"""Script to auto-generate our API docs.
"""
# stdlib imports
import os
# local imports
from apigen import ApiDocWriter
#*****************************************************************************
if __name__ == '__main__':
package = 'pysvg'
outdir = os.path.join('api','generated')
docwriter = ApiDocWriter(package)
docwriter.package_skip_patterns += [r'\.fixes$',
r'\.externals$',
r'\.neurospin\.viz',
]
docwriter.write_api_docs(outdir)
docwriter.write_index(outdir, 'gen', relative_to='api')
print '%d files written' % len(docwriter.written_modules)
示例3: pjoin
# 需要导入模块: from apigen import ApiDocWriter [as 别名]
# 或者: from apigen.ApiDocWriter import write_index [as 别名]
docwriter.module_skip_patterns += [ r'\.core\.fakemodule',
r'\.testing\.iptest',
# Keeping these disabled is OK
r'\.parallel\.controller\.mongodb',
r'\.lib\.inputhookwx',
r'\.lib\.inputhookgtk',
r'\.cocoa',
r'\.ipdoctest',
r'\.Gnuplot',
r'\.frontend\.process\.winprocess',
r'\.frontend',
r'\.Shell',
]
# If we don't have pexpect, we can't load irunner, so skip any code that
# depends on it
try:
import pexpect
except ImportError:
docwriter.module_skip_patterns += [r'\.lib\.irunner',
r'\.testing\.mkdoctests']
# Now, generate the outputs
docwriter.write_api_docs(outdir)
# Write index with .txt extension - we can include it, but Sphinx won't try
# to compile it
docwriter.write_index(outdir, 'gen.txt',
relative_to = pjoin('source','api')
)
print ('%d files written' % len(docwriter.written_modules))
示例4: pjoin
# 需要导入模块: from apigen import ApiDocWriter [as 别名]
# 或者: from apigen.ApiDocWriter import write_index [as 别名]
info_file = pjoin('..', package, 'info.py')
info_lines = open(info_file).readlines()
source_version = '.'.join([v.split('=')[1].strip(" '\n.")
for v in info_lines if re.match(
'^_version_(major|minor|micro|extra)', v
)])
print('***', source_version)
if source_version != installed_version:
abort("Installed version does not match source version")
docwriter = ApiDocWriter(package, rst_extension='.rst',
other_defines=other_defines)
docwriter.package_skip_patterns += [r'\.fixes$',
r'\.externals$',
r'\.reconst.eit$',
r'\.tracking\.interfaces.*$',
r'\.tracking\.gui_tools.*$',
r'.*test.*$',
r'\.utils.*$',
r'\.viz.*$',
r'\.boots\.resampling.*$',
r'\.fixes.*$',
r'\.info.*$',
r'\.pkg_info.*$',
]
docwriter.write_api_docs(outdir)
docwriter.write_index(outdir, 'index', relative_to=outdir)
print('%d files written' % len(docwriter.written_modules))
示例5: print
# 需要导入模块: from apigen import ApiDocWriter [as 别名]
# 或者: from apigen.ApiDocWriter import write_index [as 别名]
r"\.nbformat\.convert",
r"\.nbformat\.validator",
r"\.nbformat\.notebooknode",
# Deprecated
r"\.nbformat\.current",
# Exposed by nbformat.vN
r"\.nbformat\.v[3-4]\.nbbase",
# These are exposed in display
r"\.core\.display",
r"\.lib\.display",
# This isn't actually a module
r"\.html\.tasks",
# This is private
r"\.html\.allow76",
]
# These modules import functions and classes from other places to expose
# them as part of the public API. They must have __all__ defined. The
# non-API modules they import from should be excluded by the skip patterns
# above.
docwriter.names_from__all__.update(
{"IPython.nbformat", "IPython.nbformat.v3", "IPython.nbformat.v4", "IPython.display"}
)
# Now, generate the outputs
docwriter.write_api_docs(outdir)
# Write index with .txt extension - we can include it, but Sphinx won't try
# to compile it
docwriter.write_index(outdir, "gen.txt", relative_to=pjoin("source", "api"))
print("%d files written" % len(docwriter.written_modules))
示例6: abort
# 需要导入模块: from apigen import ApiDocWriter [as 别名]
# 或者: from apigen.ApiDocWriter import write_index [as 别名]
except ImportError, e:
abort("Can not import scikits.image")
module = sys.modules[package]
# Check that the source version is equal to the installed
# version. If the versions mismatch the API documentation sources
# are not (re)generated. This avoids automatic generation of documentation
# for older or newer versions if such versions are installed on the system.
installed_version = V(module.version.version)
setup_lines = open('../setup.py').readlines()
version = 'vUndefined'
for l in setup_lines:
if l.startswith('VERSION'):
source_version = V(l.split("'")[1])
break
if source_version != installed_version:
abort("Installed version does not match source version")
outdir = 'source/api'
docwriter = ApiDocWriter(package)
docwriter.package_skip_patterns += [r'\.fixes$',
r'\.externals$',
]
docwriter.write_api_docs(outdir)
docwriter.write_index(outdir, 'api', relative_to='source/api')
print '%d files written' % len(docwriter.written_modules)
示例7: __import__
# 需要导入模块: from apigen import ApiDocWriter [as 别名]
# 或者: from apigen.ApiDocWriter import write_index [as 别名]
#!/usr/bin/env python
"""Script to generate API docs"""
import os, sys
from apigen import ApiDocWriter
if __name__ == "__main__":
package = "pygimli"
try:
__import__(package)
except ImportError as e:
print("Can not import pygimli")
exit()
buildpath = os.path.abspath(os.path.dirname(sys.modules[__name__].__file__))
outdir = os.path.abspath(buildpath + "/pygimliapi")
if not os.path.exists(outdir):
os.makedirs(outdir)
docwriter = ApiDocWriter(package)
docwriter.package_skip_patterns += [r"\.gui$"]
docwriter.rst_extension = ".rst"
docwriter.write_api_docs(outdir)
docwriter.write_index(outdir, "index", relative_to=outdir)
print("%d files written to %s" % (len(docwriter.written_modules), os.path.abspath(outdir)))
示例8: V
# 需要导入模块: from apigen import ApiDocWriter [as 别名]
# 或者: from apigen.ApiDocWriter import write_index [as 别名]
installed_version = V(module.__version__)
info_lines = open('../dipy/info.py').readlines()
source_version = '.'.join([v.split('=')[1].strip(" '\n.")
for v in info_lines if re.match(
'^_version_(major|minor|micro|extra)', v
)])
print '***', source_version
if source_version != installed_version:
abort("Installed version does not match source version")
outdir = 'reference'
docwriter = ApiDocWriter(package, rst_extension='.rst')
docwriter.package_skip_patterns += [r'\.fixes$',
r'\.externals$',
r'\.reconst.eit$',
r'\.tracking\.interfaces.*$',
r'\.tracking\.gui_tools.*$',
r'.*test.*$',
r'\.utils.*$',
r'\.viz.*$',
r'\.boots\.resampling.*$',
r'\.fixes.*$',
r'\.info.*$',
r'\.pkg_info.*$',
]
docwriter.write_api_docs(outdir)
docwriter.write_index(outdir, 'index', relative_to='reference')
print('%d files written' % len(docwriter.written_modules))
示例9: ApiDocWriter
# 需要导入模块: from apigen import ApiDocWriter [as 别名]
# 或者: from apigen.ApiDocWriter import write_index [as 别名]
#!/usr/bin/env python
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""Script to auto-generate our API docs.
This script should run in Python 2 and Python 3
"""
# stdlib imports
import os
# local imports
from apigen import ApiDocWriter
# *****************************************************************************
if __name__ == "__main__":
package = "nipy"
outdir = os.path.join("api", "generated")
docwriter = ApiDocWriter(package)
docwriter.package_skip_patterns += [
r"\.fixes$",
r"\.externals$",
# r'\.labs\.viz',
]
# XXX: Avoid nipy.modalities.fmri.aliased due to a bug in python2.6
docwriter.module_skip_patterns += [r"\.modalities\.fmri.aliased"]
docwriter.write_api_docs(outdir)
docwriter.write_index(outdir, "gen", relative_to="api")
print("%d files written" % len(docwriter.written_modules))
示例10: open
# 需要导入模块: from apigen import ApiDocWriter [as 别名]
# 或者: from apigen.ApiDocWriter import write_index [as 别名]
setup_lines = open("../setup.py").readlines()
for l in setup_lines:
if l.startswith("VERSION"):
source_version = V(l.split("'")[1])
break
if source_version != installed_version:
abort("Installed version does not match source version")
if __name__ == "__main__":
package = "mpltools"
# Check that the 'image' package is available. If not, the API
# documentation is not (re)generated and existing API documentation
# sources will be used.
try:
__import__(package)
except ImportError as e:
abort("Cannot import mpltools")
# assert_source_and_install_match(package)
outdir = "source/api"
docwriter = ApiDocWriter(package)
docwriter.package_skip_patterns += [r"\.fixes$", r"\.externals$"]
docwriter.write_api_docs(outdir)
docwriter.write_index(outdir, "api", relative_to="source/api")
print("%d files written" % len(docwriter.written_modules))