简体   繁体   English

sphinx中的组方法docstrings

[英]Group method docstrings in sphinx

Is it possible to group several method docstrings with sphinx using it's autodoc capabilities, so that they are listed together? 是否可以使用它的autodoc功能将几个方法文档字符串与sphinx组合在一起,以便将它们列在一起?

class Test(object):
    def a(self):
        """A method of group foo."""

    def b(self):
        """A method of group bar."""

    def c(self):
        """A method of group bar."""

    def d(self):
        """A method of group foo."""

In the generated documentation a and d should be listed together, aswell as b and c. 在生成的文档中,a和d应该一起列出,以及b和c。

Group the methods in the source module and configure Sphinx to output them in that order, using autodoc_member_order = 'bysource' . 将源模块中的方法分组,并使用autodoc_member_order = 'bysource'配置Sphinx以此顺序输出它们。

I am not aware of any other way to group members. 我不知道任何其他组成员的方式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM