gpt4 book ai didi

python - Sphinx Autodoc 从文档字符串中跳过成员

转载 作者:太空狗 更新时间:2023-10-29 17:59:24 24 4
gpt4 key购买 nike

我正在用 Sphinx 记录一个类,只是想跳过其中一个类成员:

class StatusUpdateAdapter(logging.LoggerAdapter):
"""
"""
def __init__(self, status_update_func, logger, extra={}):
"""
"""
pass

def log(self, *args, **kwargs):
pass

如何使 sphinx 不记录日志成员?如果可能,我想在 StatusUpdateAdapter 或日志文档字符串中执行此操作。

最佳答案

现在(从 0.6 版开始)您可以使用 :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.

New in version 0.6.

来源:http://www.sphinx-doc.org/en/stable/ext/autodoc.html

在您的特定情况下,您可以将 :exclude-members: log 添加到您的 .rst 文件中。

关于python - Sphinx Autodoc 从文档字符串中跳过成员,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28224554/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com