Thats too bad, but thanks for the clarification. Would this be possible if I wrote a custom extension for it? It should do the following:
1. Detect if the docstring belongs to a class that inherits from ExternalPackageClass. If yes, proceed with step 2. Otherwise continue normally 2. Check if it is the docstring of the __call__ method. If yes, copy the docstring from forward and use it. Am Donnerstag, 4. Juni 2020 15:48:15 UTC+2 schrieb Komiya Takeshi: > > 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] > <javascript:>>: > > > > 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] <javascript:>. > > 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/64fe6193-a268-42ef-8c28-7f023eebf1ab%40googlegroups.com.
