cfdm.core.DocstringRewriteMeta


class cfdm.core.DocstringRewriteMeta[source]

Bases: type

Modify docstrings at time of import.

Methodology

To do this, we intercede before the class is created and modify the docstrings of the attributes defined on the class.

Inherited methods are also modified. We cannot simply modify the docstrings of inherited methods, because then the parent classes’ methods will have the wrong docstring. Instead, we must actually copy the functions, and then modify the docstring.

Special treatment is given to methods decorated with @property, @staticmethod and @classmethod, as well as user-defined decorations.

New in version (cfdm): 1.8.7.0

Combines docstring substitutions across the inheritance tree.

That is, combines docstring substitutions from all classes in the inheritance tree.

The value for a key that occurs in multiple classes will be taken from the class closest to the child class.

Inspection

Methods

mro

Return a type’s method resolution order.

_docstring_special_substitutions

Return the special docstring substitutions.

_docstring_substitutions

Returns the substitutions that apply to methods of the class.

_docstring_package_depth

Returns the class {{package}} substitutions package depth.

_docstring_method_exclusions

Returns method names excluded in the class substitutions.