more_autodoc.overloads

Documenters for functions and methods which display overloads differently.

New in version 1.4.0.

Enable sphinx_toolbox.more_autodoc.overloads by adding the following to the extensions variable in your conf.py:

extensions = [
    ...
    'sphinx_toolbox.more_autodoc.overloads',
    ]

For more information see https://www.sphinx-doc.org/en/master/usage/extensions#third-party-extensions .

Configuration

overloads_location
Type: str
Default: 'signature'

The location to display overloads at:

  • 'signature' – Display overloads above the function signature.

  • 'top' – Display overloads at the top of the docstring, immediately below the signature.

  • 'bottom' – Display overloads at the bottom of the docstring, or immediately below the return type.

API Reference

Classes:

FunctionDocumenter(directive, name[, indent])

Custom sphinx.ext.autodoc.FunctionDocumenter which renders overloads differently.

MethodDocumenter(directive, name[, indent])

Custom sphinx.ext.autodoc.MethodDocumenter which renders overloads differently.

OverloadMixin()

Mixin class for function and class documenters that changes the appearance of overloaded functions.

Functions:

setup(app)

Setup sphinx_toolbox.more_autodoc.overloads.

class OverloadMixin[source]

Bases: object

Mixin class for function and class documenters that changes the appearance of overloaded functions.

New in version 1.4.0.

Methods:

create_body_overloads()

Create the overloaded implementations for insertion into to the body of the documenter’s output.

process_overload_signature(overload)

Processes the signature of the given overloaded implementation.

add_content(more_content[, no_docstring])

Add content from docstrings, attribute documentation and the user.

create_body_overloads()[source]

Create the overloaded implementations for insertion into to the body of the documenter’s output.

Return type

StringList

process_overload_signature(overload)[source]

Processes the signature of the given overloaded implementation.

Parameters

overload (Signature)

Return type

Signature

add_content(more_content, no_docstring=False)[source]

Add content from docstrings, attribute documentation and the user.

Parameters
class FunctionDocumenter(directive, name, indent='')[source]

Bases: OverloadMixin, FunctionDocumenter

Custom sphinx.ext.autodoc.FunctionDocumenter which renders overloads differently.

New in version 1.4.0.

Methods:

format_signature(**kwargs)

Format the function’s signature, including those for any overloaded implementations.

add_directive_header(sig)

Add the directive’s header.

process_overload_signature(overload)

Processes the signature of the given overloaded implementation.

format_signature(**kwargs)[source]

Format the function’s signature, including those for any overloaded implementations.

Return type

str

Returns

The signature(s), as a multi-line string.

add_directive_header(sig)[source]

Add the directive’s header.

Parameters

sig (str)

process_overload_signature(overload)[source]

Processes the signature of the given overloaded implementation.

Parameters

overload (Signature)

Return type

Signature

class MethodDocumenter(directive, name, indent='')[source]

Bases: OverloadMixin, MethodDocumenter

Custom sphinx.ext.autodoc.MethodDocumenter which renders overloads differently.

New in version 1.4.0.

Methods:

format_signature(**kwargs)

Format the method’s signature, including those for any overloaded implementations.

add_directive_header(sig)

Add the directive’s header.

process_overload_signature(overload)

Processes the signature of the given overloaded implementation.

format_signature(**kwargs)[source]

Format the method’s signature, including those for any overloaded implementations.

Parameters

kwargs (Any)

Return type

str

Returns

The signature(s), as a multi-line string.

add_directive_header(sig)[source]

Add the directive’s header.

Parameters

sig (str)

process_overload_signature(overload)[source]

Processes the signature of the given overloaded implementation.

Parameters

overload (Signature)

Return type

Signature

setup(app)[source]

Setup sphinx_toolbox.more_autodoc.overloads.

New in version 1.4.0.

Parameters

app (Sphinx) – The Sphinx application.

Return type

SphinxExtMetadata