Как установить настройки по умолчанию для многих автомодулей?

Предположим, у вас есть несколько классов и сгенерируйте документацию, используя 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

0 ответов

Другие вопросы по тегам