Hi,

The autodoc extension scans the target module and generates
documentation. No way to imitate it. As a workaround, you can insert
your content manually:

.. autoclass:: yourmodule.MyClass

    .. py:method:: __call__

      Prints the input.
      This text is added to the document.

      Note: You should not use `:member:` option to the `autoclass` or
`automodule` directives.
      Then they'll create a document for MyClass.forward() automatically.


Thanks,
Takeshi KOMIYA

2020年6月4日(木) 17:02 'CaptFugu' via sphinx-users <[email protected]>:
>
> Suppose I have the following setup:
>
> class ExternalPackageClass:
>     def __call__(self, *args, **kwargs):
>         return self.forward(*args, **kwargs)
>
>     def forward(self, *args, **kwargs):
>         raise NotImplementedError
>
>
> class MyClass(ExternalPackageClass):
>     def forward(self, input):
>         r"""Prints the input"""
>         print(input)
>
> Can I configure autodoc somehow to document the forward() method as 
> __call__()? Otherwise I always need to include the information somewhere that 
> forward() is invoked if MyClass is called.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "sphinx-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sphinx-users/9df0564f-f823-499c-a7e5-6d0efee594e9%40googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups 
"sphinx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sphinx-users/CAFmkQAO7fVtzBe2FV5X3ttymJeqge%3DKY4%3DUiT%3DDzNo10D435sQ%40mail.gmail.com.

Reply via email to