假设您有多个类,并使用Sphinx生成文档。不用写:
ReverseRecallCommandLines
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. autoclass:: ReverseRecallCommandLines
:members:
:special-members:
:exclude-members: __dict__,__weakref__
ScratchPadCommandLines
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. autoclass:: ScratchPadCommandLines
:members:
:special-members:
:exclude-members: __dict__,__weakref__
SerialRecallCommandLines
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. autoclass:: SerialRecallCommandLines
:members:
:special-members:
:exclude-members: __dict__,__weakref__
您可以定义:
autodoc_default_options = {
'members': None, # Include all members (methods).
'special-members': None,
'exclude-members': '__dict__,__weakref__' # Exclude "standard" methods.
}
在conf.py中。
这将使上面的代码简化为:
ReverseRecallCommandLines
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. autoclass:: ReverseRecallCommandLines
ScratchPadCommandLines
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. autoclass:: ScratchPadCommandLines
SerialRecallCommandLines
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. autoclass:: SerialRecallCommandLines
问题:是否可以通过类似的方式将“默认值”注入自动模块,从而启用以下功能:
Stacked Attention Networks
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. automodule:: miprometheus.models.vqa_baselines.stacked_attention_networks
MAC
~~~~~~~~~~~~~~~~
.. automodule:: miprometheus.models.mac