Include specific special-methods in sphinx

前端 未结 5 2101
南旧
南旧 2021-02-12 15:43

I have a bunch of classes which use \"special-methods\":

class Foo(object):
   \"Foo docstring\"

   attr1 = \"Attribute!\" #: first attribute
   attr2 = \"Anoth         


        
5条回答
  •  猫巷女王i
    2021-02-12 16:04

    What worked for me is adding the ".. automethod:: methodName"

    directive in the docstring of the class, instead of doing it in the .rst file.

    So, you can change "Foo docstring" to

    """
    Foo docstring
    
    .. automethod:: __contains__
    """
    

提交回复
热议问题