inheritDoc

lsst.utils.inheritDoc(klass: type) Callable

Extend existing documentation for a method that exists in another class and extend it with any additional documentation defined.

This decorator takes a class from which to draw documentation from as an argument. This is so that any class may be used as a source of documentation and not just the immediate parent of a class. This is useful when there may be a long inheritance chain, or in the case of mixins.

Parameters:
klassobject

The class to inherit documentation from.

Returns:
decoratorcallable

Intermediate decorator used in the documentation process.

Notes

This method naively appends the doc string from the decorated method to the doc string of the equivalent method from the given class. No attempt is made to ensure that duplicated sections are merged together or overwritten.

This decorator is not necessary to ensure that a parent doc string appears in a subclass. Tools like pydoc and Sphinx handle that automatically. This can, though, be used to ensure that a specific docstring from a parent class appears if there is ambiguity from multiple inheritance.