Docstring module of the psyplot package

We use the docrep package for managing our docstrings

Classes:

PsyplotDocstringProcessor(*args, **kwargs)

A docrep.DocstringProcessor subclass with possible types section

Functions:

append_original_doc(parent[, num])

Return an iterator that append the docstring of the given parent function to the applied function

dedent(func)

Dedent the docstring of a function and substitute with params

indent(text[, num])

Indet the given string

Data:

docstrings

docrep.PsyplotDocstringProcessor instance that simplifies the reuse of docstrings from between different python objects.

class psyplot.docstring.PsyplotDocstringProcessor(*args, **kwargs)[source]

Bases: DocstringProcessor

A docrep.DocstringProcessor subclass with possible types section

Parameters:
  • *args – Positional parameters that shall be used for the substitution. Note that you can only provide either *args or **kwargs, furthermore most of the methods like get_sections require **kwargs to be provided (if any).

  • **kwargs – Initial parameters to use

Methods:

get_sections([s, base, sections])

Extract the specified sections out of the given string

Attributes:

param_like_sections

sections that behave the same as the Parameter section by defining a list

get_sections(s=None, base=None, sections=['Parameters', 'Other Parameters', 'Possible types'])[source]

Extract the specified sections out of the given string

The same as the docrep.DocstringProcessor.get_sections() method but uses the 'Possible types' section by default, too

Parameters:
  • s (str) – Docstring to split

  • base (str) – base to use in the sections attribute

  • sections (list of str) – sections to look for. Each section must be followed by a newline character (’n’) and a bar of ‘-’ (following the numpy (napoleon) docstring conventions).

Returns:

The replaced string

Return type:

str

param_like_sections = ['Parameters', 'Other Parameters', 'Returns', 'Raises', 'Possible types']

sections that behave the same as the Parameter section by defining a list

psyplot.docstring.append_original_doc(parent, num=0)[source]

Return an iterator that append the docstring of the given parent function to the applied function

psyplot.docstring.dedent(func)[source]

Dedent the docstring of a function and substitute with params

Parameters:

func (function) – function with the documentation to dedent

psyplot.docstring.docstrings(s) = <psyplot.docstring.PsyplotDocstringProcessor object>

docrep.PsyplotDocstringProcessor instance that simplifies the reuse of docstrings from between different python objects.

psyplot.docstring.indent(text, num=4)[source]

Indet the given string