{ } Raw JSON

bundles / scipy 1.17.1 / scipy / _lib / doccer / docformat

function

scipy._lib.doccer:docformat

source: /scipy/_lib/doccer.py :29

Signature

def   docformat ( docstring : str docdict : Mapping[str, str] | None = None )  →  str

Summary

Fill a function docstring from variables in dictionary.

Extended Summary

Adapt the indent of the inserted docs

Parameters

docstring : str

A docstring from a function, possibly with dict formatting strings.

docdict : dict[str, str], optional

A dictionary with keys that match the dict formatting strings and values that are docstring fragments to be inserted. The indentation of the inserted docstrings is set to match the minimum indentation of the docstring by adding this indentation to all lines of the inserted string, except the first.

Returns

docstring : str

string with requested docdict strings inserted.

Examples

docformat(' Test string with %(value)s', {'value':'inserted value'})
docstring = 'First line\n    Second line\n    %(value)s'
inserted_string = "indented\nstring"
docdict = {'value': inserted_string}
docformat(docstring, docdict)

Aliases

  • scipy.signal._filter_design.doccer.docformat