有没有办法隐藏异常的自动文档和保存方法?

Is there a way to hide autodoc of exceptions and save methods?

我正在记录一个巨大的 Django 项目,并希望有一个选项来隐藏自动生成的 Django 内容,如下所示。是我必须做的事情 "deal with" 还是我还没有找到设置?

我记录了:

.. automodule:: module.models
    :members:

并获得如下所示的内容,如果我覆盖了这些内容会很好,但它们不是:

exception DoesNotExist

exception MultipleObjectsReturned

save(*args, **kwargs):...

请参阅 automodule directive 及其选项的文档,包括 exclude-members:

The directives supporting member documentation also have a exclude-members option that can be used to exclude single member names from documentation, if all members are to be documented.

Sphinx 更新 >= 1.8

在评论中向@nerdoc 致敬。

autodoc_default_flags is deprecated in Sphinx 1.8.

它已作为选项移入新设置 autodoc_default_options

autodoc_default_options = {
    "exclude-members": "__weakref__",
}