我们从Python开源项目中,提取了以下24个代码示例,用于说明如何使用sphinx.__display_version__()。
def setup(app): app.add_node( gallery, html=(visit_gallery_node, depart_gallery_node), latex=(visit_gallery_node, depart_gallery_node), text=(visit_gallery_node, depart_gallery_node), man=(visit_gallery_node, depart_gallery_node), texinfo=(visit_gallery_node, depart_gallery_node)) app.add_directive('gallery', Gallery) app.add_directive('include_examples', IncludeExamples) app.connect('builder-inited', setup_env) app.connect('builder-inited', notebooks_to_rst) app.connect('doctree-read', extract_gallery_entries) app.connect('doctree-resolved', add_entries_to_gallery) return {'version': sphinx.__display_version__, 'parallel_read_safe': True}
def setup(app): # I need autodoc app.setup_extension('sphinx.ext.autodoc') app.add_node(autosummary_toc, html=(autosummary_toc_visit_html, autosummary_noop), latex=(autosummary_noop, autosummary_noop), text=(autosummary_noop, autosummary_noop), man=(autosummary_noop, autosummary_noop), texinfo=(autosummary_noop, autosummary_noop)) app.add_node(autosummary_table, html=(autosummary_table_visit_html, autosummary_noop), latex=(autosummary_noop, autosummary_noop), text=(autosummary_noop, autosummary_noop), man=(autosummary_noop, autosummary_noop), texinfo=(autosummary_noop, autosummary_noop)) app.add_directive('autosummary', Autosummary) app.add_role('autolink', autolink_role) app.connect('doctree-read', process_autosummary_toc) app.connect('builder-inited', process_generate_options) app.add_config_value('autosummary_generate', [], True) return {'version': sphinx.__display_version__, 'parallel_read_safe': True}
def setup(app): app.add_config_value('todo_include_todos', False, 'html') app.add_node(todolist) app.add_node(todo_node, html=(visit_todo_node, depart_todo_node), latex=(visit_todo_node, depart_todo_node), text=(visit_todo_node, depart_todo_node), man=(visit_todo_node, depart_todo_node), texinfo=(visit_todo_node, depart_todo_node)) app.add_directive('todo', Todo) app.add_directive('todolist', TodoList) app.connect('doctree-read', process_todos) app.connect('doctree-resolved', process_todo_nodes) app.connect('env-purge-doc', purge_todos) app.connect('env-merge-info', merge_info) return {'version': sphinx.__display_version__, 'parallel_read_safe': True}
def setup(app): app.add_autodocumenter(ModuleDocumenter) app.add_autodocumenter(ClassDocumenter) app.add_autodocumenter(ExceptionDocumenter) app.add_autodocumenter(DataDocumenter) app.add_autodocumenter(FunctionDocumenter) app.add_autodocumenter(MethodDocumenter) app.add_autodocumenter(AttributeDocumenter) app.add_autodocumenter(InstanceAttributeDocumenter) app.add_config_value('autoclass_content', 'class', True) app.add_config_value('autodoc_member_order', 'alphabetic', True) app.add_config_value('autodoc_default_flags', [], True) app.add_config_value('autodoc_docstring_signature', True, True) app.add_config_value('autodoc_mock_imports', [], True) app.add_event('autodoc-process-docstring') app.add_event('autodoc-process-signature') app.add_event('autodoc-skip-member') return {'version': sphinx.__display_version__, 'parallel_read_safe': True}
def setup(app): # I need autodoc app.setup_extension('sphinx.ext.autodoc') app.add_node(autosummary_toc, html=(autosummary_toc_visit_html, autosummary_noop), latex=(autosummary_noop, autosummary_noop), text=(autosummary_noop, autosummary_noop), man=(autosummary_noop, autosummary_noop), texinfo=(autosummary_noop, autosummary_noop)) app.add_node(autosummary_table, html=(autosummary_table_visit_html, autosummary_noop), latex=(autosummary_noop, autosummary_noop), text=(autosummary_noop, autosummary_noop), man=(autosummary_noop, autosummary_noop), texinfo=(autosummary_noop, autosummary_noop)) app.add_directive('autosummary', Autosummary) app.add_role('autolink', autolink_role) app.connect('doctree-read', process_autosummary_toc) app.connect('builder-inited', process_generate_options) app.add_config_value('autosummary_generate', [], True, [bool]) return {'version': sphinx.__display_version__, 'parallel_read_safe': True}
def setup(app): app.connect('autodoc-process-docstring', link_aliases) app.connect('autodocsumm-grouper', group_fmt_attributes) return {'version': sphinx.__display_version__, 'parallel_read_safe': True}
def setup(app): """Sphinx extension setup function. When the extension is loaded, Sphinx imports this module and executes the ``setup()`` function, which in turn notifies Sphinx of everything the extension offers. Parameters ---------- app : sphinx.application.Sphinx Application object representing the Sphinx process See Also -------- The Sphinx documentation on `Extensions`_, the `Extension Tutorial`_, and the `Extension API`_. .. _Extensions: http://sphinx-doc.org/extensions.html .. _Extension Tutorial: http://sphinx-doc.org/ext/tutorial.html .. _Extension API: http://sphinx-doc.org/ext/appapi.html """ from sphinx.application import Sphinx if not isinstance(app, Sphinx): return # probably called by tests app.connect('autodoc-process-docstring', _process_docstring) app.connect('autodoc-skip-member', _skip_member) for name, (default, rebuild) in iteritems(Config._config_values): app.add_config_value(name, default, rebuild) return {'version': sphinx.__display_version__, 'parallel_read_safe': True}
def setup(app): app.add_config_value('intersphinx_mapping', {}, True) app.add_config_value('intersphinx_cache_limit', 5, False) app.connect('missing-reference', missing_reference) app.connect('builder-inited', load_mappings) return {'version': sphinx.__display_version__, 'parallel_read_safe': True}
def setup(app): app.connect('doctree-read', doctree_read) app.add_config_value('linkcode_resolve', None, '') return {'version': sphinx.__display_version__, 'parallel_read_safe': True}
def setup(app): mathbase_setup(app, (html_visit_math, None), (html_visit_displaymath, None)) # more information for mathjax secure url is here: # http://docs.mathjax.org/en/latest/start.html#secure-access-to-the-cdn app.add_config_value('mathjax_path', 'https://cdn.mathjax.org/mathjax/latest/MathJax.js?' 'config=TeX-AMS-MML_HTMLorMML', False) app.add_config_value('mathjax_inline', [r'\(', r'\)'], 'html') app.add_config_value('mathjax_display', [r'\[', r'\]'], 'html') app.connect('builder-inited', builder_inited) return {'version': sphinx.__display_version__, 'parallel_read_safe': True}
def setup(app): app.add_node(ifconfig) app.add_directive('ifconfig', IfConfig) app.connect('doctree-resolved', process_ifconfig_nodes) return {'version': sphinx.__display_version__, 'parallel_read_safe': True}
def setup(app): app.add_builder(CoverageBuilder) app.add_config_value('coverage_ignore_modules', [], False) app.add_config_value('coverage_ignore_functions', [], False) app.add_config_value('coverage_ignore_classes', [], False) app.add_config_value('coverage_c_path', [], False) app.add_config_value('coverage_c_regexes', {}, False) app.add_config_value('coverage_ignore_c_items', {}, False) app.add_config_value('coverage_write_headline', True, False) app.add_config_value('coverage_skip_undoc_in_source', False, False) return {'version': sphinx.__display_version__, 'parallel_read_safe': True}
def setup(app): mathbase_setup(app, (html_visit_math, None), (html_visit_displaymath, None)) app.add_config_value('jsmath_path', '', False) app.connect('builder-inited', builder_inited) return {'version': sphinx.__display_version__, 'parallel_read_safe': True}
def setup(app): app.setup_extension('sphinx.ext.graphviz') app.add_node( inheritance_diagram, latex=(latex_visit_inheritance_diagram, None), html=(html_visit_inheritance_diagram, None), text=(skip, None), man=(skip, None), texinfo=(texinfo_visit_inheritance_diagram, None)) app.add_directive('inheritance-diagram', InheritanceDiagram) app.add_config_value('inheritance_graph_attrs', {}, False), app.add_config_value('inheritance_node_attrs', {}, False), app.add_config_value('inheritance_edge_attrs', {}, False), return {'version': sphinx.__display_version__, 'parallel_read_safe': True}
def setup(app): app.add_node(graphviz, html=(html_visit_graphviz, None), latex=(latex_visit_graphviz, None), texinfo=(texinfo_visit_graphviz, None), text=(text_visit_graphviz, None), man=(man_visit_graphviz, None)) app.add_directive('graphviz', Graphviz) app.add_directive('graph', GraphvizSimple) app.add_directive('digraph', GraphvizSimple) app.add_config_value('graphviz_dot', 'dot', 'html') app.add_config_value('graphviz_dot_args', [], 'html') app.add_config_value('graphviz_output_format', 'png', 'html') return {'version': sphinx.__display_version__, 'parallel_read_safe': True}
def setup(app): app.add_config_value('extlinks', {}, 'env') app.connect('builder-inited', setup_link_roles) return {'version': sphinx.__display_version__, 'parallel_read_safe': True}
def setup(app): app.add_directive('testsetup', TestsetupDirective) app.add_directive('testcleanup', TestcleanupDirective) app.add_directive('doctest', DoctestDirective) app.add_directive('testcode', TestcodeDirective) app.add_directive('testoutput', TestoutputDirective) app.add_builder(DocTestBuilder) # this config value adds to sys.path app.add_config_value('doctest_path', [], False) app.add_config_value('doctest_test_doctest_blocks', 'default', False) app.add_config_value('doctest_global_setup', '', False) app.add_config_value('doctest_global_cleanup', '', False) return {'version': sphinx.__display_version__, 'parallel_read_safe': True}
def require_sphinx(self, version): # check the Sphinx version if requested if version > sphinx.__display_version__[:3]: raise VersionRequirementError(version)
def build_help(self): print(bold("Sphinx v%s" % sphinx.__display_version__)) print("Please use `make %s' where %s is one of" % ((blue('target'),)*2)) for osname, bname, description in BUILDERS: if not osname or os.name == osname: print(' %s %s' % (blue(bname.ljust(10)), description))
def setup(app): # wrap napoleon's skip-member app.connect('autodoc-skip-member', skip_member) return {'version': sphinx.__display_version__}
def setup(app): """add custom directive into Sphinx so that it is found during document parsing""" app.add_directive('embed-test', EmbedTestDirective) app.add_node(skipped_or_failed_node, html=(visit_skipped_or_failed_node, depart_skipped_or_failed_node)) app.add_node(in_or_out_node, html=(visit_in_or_out_node, depart_in_or_out_node)) return {'version': sphinx.__display_version__, 'parallel_read_safe': True}
def setup(app): """add custom directive into Sphinx so that it is found during document parsing""" app.add_directive('content-container', ContentContainerDirective) app.add_directive('embed-compare', EmbedCompareDirective) return {'version': sphinx.__display_version__, 'parallel_read_safe': True}
def setup(app): """add custom directive into Sphinx so that it is found during document parsing""" app.add_directive('embed-options', EmbedOptionsDirective) return {'version': sphinx.__display_version__, 'parallel_read_safe': True}
def main(argv=sys.argv): # type: (List[str]) -> int """Parse and check the command line arguments.""" parser = optparse.OptionParser( usage="""\ usage: %prog [options] -o <output_path> <module_path> [exclude_pattern, ...] Look recursively in <module_path> for Python modules and packages and create one reST file with automodule directives per package in the <output_path>. The <exclude_pattern>s can be file and/or directory patterns that will be excluded from generation. Note: By default this script will not overwrite already created files.""") parser.add_option('-o', '--output-dir', action='store', dest='destdir', help='Directory to place all output', default='api') parser.add_option('-s', '--source-dir', action='store', dest='srcdir', help='Documentation source directory', default=BASEDIR) parser.add_option('-n', '--docname', action='store', dest='docname', help='Index document name', default='api') parser.add_option('-l', '--follow-links', action='store_true', dest='followlinks', default=False, help='Follow symbolic links. Powerful when combined ' 'with collective.recipe.omelette.') parser.add_option('-P', '--private', action='store_true', dest='includeprivate', help='Include "_private" modules') parser.add_option('--implicit-namespaces', action='store_true', dest='implicit_namespaces', help='Interpret module paths according to PEP-0420 ' 'implicit namespaces specification') parser.add_option('--version', action='store_true', dest='show_version', help='Show version information and exit') parser.add_option('--clean', action='store_true', dest='cleanup', help='Clean up generated files and exit') group = parser.add_option_group('Extension options') for ext in EXTENSIONS: group.add_option('--ext-' + ext, action='store_true', dest='ext_' + ext, default=False, help='enable %s extension' % ext) (opts, args) = parser.parse_args(argv[1:]) # Make this more explicitly the current directory. if not opts.srcdir: opts.srcdir = '.' if opts.show_version: print('Sphinx (sphinx-apidoc) %s' % __display_version__) return 0 if opts.cleanup: print("Removing generated API docs from '{}'...".format(opts.srcdir)) return cleanup_api_docs(opts) if not args: parser.error('A package path is required.') opts.rootpath, opts.excludes = args[0], args[1:] return generate_api_docs(opts)