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

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