在Sphinx生成的文档中,是否可以为方法组添加docstrings?
例如,我想要这样的文档:
class MyClass():
"""Doc of the class"""
def __init__(self):
pass
"""----- The following part is about imports -----"""
def import_from_source_1(self):
"""Doc of import_from_source_1"""
pass
def import_from_source_2(self):
"""Doc of import_from_source_2"""
pass
"""----- The following part is about exports-----"""
def export_to_dest_1(self):
"""Doc of export_to_dest_1"""
pass
def export_to_dest_2(self):
"""Doc of export_to_dest_2"""
pass
预期输出结果为:
MyClass
Doc of the class
----- The following part is about imports -----
import_from_source_1
Doc of import_from_source_1
import_from_source_2
Doc of import_from_source_2
----- The following part is about exports-----
export_to_dest_1
Doc of export_to_dest_1
export_to_dest_2
Doc of export_to_dest_2
请注意,我的目标不仅仅是对方法进行分组(如在Sphinx中分组方法文档字符串所述),而是为分组添加文档字符串。