pytools.sphinx.AutodocProcessDocstring#

class pytools.sphinx.AutodocProcessDocstring(*args, **kwargs)[source]#

An autodoc processor for docstrings.

Bases

SphinxCallback

Metaclasses

ABCMeta

Method summary

connect

Register this callback to be called when event is emitted.

disconnect

Disconnect this callback from its Sphinx application.

process

Process an event.

Attribute summary

app

The Sphinx application this callback is connected to.

event

"autodoc-process-docstring"

listener_id

The listener ID of this callback.

Definitions

__call__(app, what, name, obj, options, lines)[source]#

Call self as a function.

Return type

None

connect(app, priority=None)#

Register this callback to be called when event is emitted.

Registered callbacks will be invoked on event in the order of priority and registration. The priority is ascending order.

Parameters
  • app (Any) – the Sphinx application to register this processor with

  • priority (Optional[int]) – the priority of this processor

Return type

int

Returns

a listener ID that can be used as an argument to disconnect().

disconnect()#

Disconnect this callback from its Sphinx application.

Return type

None

abstract process(app, what, name, obj, options, lines)[source]#

Process an event.

Parameters
  • app (Any) – the Sphinx application object

  • what (str) – the type of the object which the docstring belongs to (one of “module”, “class”, “exception”, “function”, “method”, “attribute”)

  • name (str) – the fully qualified name of the object

  • obj (object) – the object itself

  • options (object) – the options given to the directive: an object with attributes inherited_members, undoc_members, show_inheritance and noindex that are True if the flag option of same name was given to the auto directive

  • lines (list[str]) – the lines of the docstring

Return type

None

property app: Optional[Any]#

The Sphinx application this callback is connected to.

Return type

Optional[Any]

Returns

the Sphinx application, or None if not connected.

property event: str#

"autodoc-process-docstring"

Return type

str

property listener_id: int | None#

The listener ID of this callback.

Return type

Optional[int]

Returns

the listener ID, or None if not connected.