Sphinx记录类方法的问题

时间:2015-03-10 05:42:30

标签: python python-sphinx autodoc

我正在尝试使用Sphinx来记录我正在构建的Python包,并且一切正常,直到我添加了一些类。我只是提供全套警告,以免遗漏相关内容:

Running Sphinx v1.2.3
loading pickled environment... done
building [html]: targets for 1 source files that are out of date
updating environment: 0 added, 1 changed, 0 removed
reading sources... [100%] opt.core                                                                                                                                                                                                                              
/Users/marshallfarrier/Workspace/pynance/doc/source/opt.core.rst:44: WARNING: toctree references unknown document 'pynance.opt.core.Options.exps'
/Users/marshallfarrier/Workspace/pynance/doc/source/opt.core.rst:44: WARNING: toctree references unknown document 'pynance.opt.core.Options.info'
/Users/marshallfarrier/Workspace/pynance/doc/source/opt.core.rst:44: WARNING: toctree references unknown document 'pynance.opt.core.Options.quotetime'
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
writing output... [100%] opt.core                                                                                                                                                                                                                               
None:None: WARNING: toctree contains reference to nonexisting document 'pynance.opt.core.Options.exps'
None:None: WARNING: toctree contains reference to nonexisting document 'pynance.opt.core.Options.info'
None:None: WARNING: toctree contains reference to nonexisting document 'pynance.opt.core.Options.quotetime'
None:None: WARNING: toctree contains reference to nonexisting document 'pynance.opt.price.Price.exps'
None:None: WARNING: toctree contains reference to nonexisting document 'pynance.opt.price.Price.get'
None:None: WARNING: toctree contains reference to nonexisting document 'pynance.opt.price.Price.metrics'
None:None: WARNING: toctree contains reference to nonexisting document 'pynance.opt.price.Price.strikes'
None:None: WARNING: toctree contains reference to nonexisting document 'pynance.opt.spread.core.Spread.cal'
None:None: WARNING: toctree contains reference to nonexisting document 'pynance.opt.spread.multi.Multi.dblcal'
None:None: WARNING: toctree contains reference to nonexisting document 'pynance.opt.spread.multi.Multi.diagbtrfly'
None:None: WARNING: toctree contains reference to nonexisting document 'pynance.opt.spread.vert.Vertical.straddle'
None:None: WARNING: toctree contains reference to nonexisting document 'pynance.opt.core.Options.exps'
None:None: WARNING: toctree contains reference to nonexisting document 'pynance.opt.core.Options.info'
None:None: WARNING: toctree contains reference to nonexisting document 'pynance.opt.core.Options.quotetime'
None:None: WARNING: toctree contains reference to nonexisting document 'pynance.opt.price.Price.exps'
None:None: WARNING: toctree contains reference to nonexisting document 'pynance.opt.price.Price.get'
None:None: WARNING: toctree contains reference to nonexisting document 'pynance.opt.price.Price.metrics'
None:None: WARNING: toctree contains reference to nonexisting document 'pynance.opt.price.Price.strikes'
None:None: WARNING: toctree contains reference to nonexisting document 'pynance.opt.spread.core.Spread.cal'
None:None: WARNING: toctree contains reference to nonexisting document 'pynance.opt.spread.multi.Multi.dblcal'
None:None: WARNING: toctree contains reference to nonexisting document 'pynance.opt.spread.multi.Multi.diagbtrfly'
None:None: WARNING: toctree contains reference to nonexisting document 'pynance.opt.spread.vert.Vertical.straddle'
<autosummary>:None: WARNING: toctree contains reference to nonexisting document 'pynance.opt.core.Options.exps'
<autosummary>:None: WARNING: toctree contains reference to nonexisting document 'pynance.opt.core.Options.info'
<autosummary>:None: WARNING: toctree contains reference to nonexisting document 'pynance.opt.core.Options.quotetime'
writing additional files... (18 module code pages) _modules/index genindex py-modindex search
copying static files... done
copying extra files... done
dumping search index... done
dumping object inventory... done
build succeeded, 28 warnings.

Build finished. The HTML pages are in build/html.

问题是,所有这些类方法(例如pynance.opt.core.Options.exps)都显示在输出文档中,而在类别页面的“方法”下,它们是可点击的链接。输出的唯一问题是“下一主题”链接在不应该的地方消失。

使用.rst的示例,我的pynance.opt.core.Options.exps文件的组织方式如下。首先,index.rst有:

.. toctree::
   opt
   ...

然后我在同一目录opt.rst中有以下内容:

.. automodule:: pynance.opt

.. toctree::

   opt.core
   ...

然后我在文件opt.core.rst

.. automodule:: pynance.opt.core

.. autoclass:: Options
   :members:

我在这里做错了什么?我希望我的课程方法全部正确显示,并且“下一主题”链接链接到我的整个包。

0 个答案:

没有答案