Sphinx Python - Docstrings for overloaded functions with .. autofunction

Viewed 88

I have an issue with using the Sphinx's .. autofunction:: directive on a function that has multiple @overload decorators.

While prototypes of the functions are included, the docstrings I want are not.

What it generates: Generated

What I want is something like this: (Notice the docstring below the prototype): Expected

My Sphinx code:

.. autofunction:: framework.add_object

Snippet of function code (Shortened):

@overload
async def add_object(obj: Union[guild.USER, guild.GUILD]) -> None: 
    """
    docstring 1
    """
    ...
@overload
async def add_object(obj: Union[message.DirectMESSAGE, message.TextMESSAGE, message.VoiceMESSAGE], snowflake: Union[int, guild.GUILD, guild.USER, dc.Guild, dc.User]) -> None:
    """
    docstring 2
    """
    ...
async def add_object(obj, snowflake=None):
    # Implementation
    # ...

Would really appreciate some help here.

0 Answers
Related