Sphinx使用带有include指令的成员排除成员

时间:2018-12-24 14:41:33

标签: python-sphinx docstring

这是我的项目结构:

 base/devices.py
 users/devices.py
 company/devices.py

这是我的index.rst

.. My documentation master file.

Welcome to documentation!
=========================

.. toctree::
    :maxdepth: 3
    :caption: Contents:

    users.rst
    company.rst

Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

base/devices.txt

.. automodule:: base.devices
   :noindex:  # base docs may be included in several .rst files
   :members:

users.rstcompany.rst相似:

USERS
*****

Devices
=======

.. include:: base/devices.txt

.. automodule:: users.devices  # in company.rst "company.devices"
   :members:

base/devices.py中,我有一个函数check_devices()
users/devices.py中,我具有函数check_devices(),但具有另一个文档字符串和另一个行为

当我在用户页面上生成文档时,我可以看到两个功能:base.devices.check_devicesusers.devices.check_devices

如何从用户页面中排除base.devices.check_devices个文档字符串,而又不失去在多个rst文件中包含base/devices.txt的可能性以及没有复制粘贴样式的可能性?

0 个答案:

没有答案