smpl.doc

Simplified python code documentation.

append_doc(original)

Append doc string of original to target object.

append_plot(*args[, xmin, xmax])

Append a plot to a function.

append_str(txt)

array_table(arr[, top, bottom, init, tabs, ...])

Produces a reST table from a numpy array or normal 2d array.

dict_to_table(dic)

insert_doc(original)

Inserts the docstring from passed function original in the target function docstring.

insert_eq()

Inserts the function and its parameters and an equal sign.

insert_latex()

Inserts latexed code of a oneline function.

insert_latex_eq()

Inserts latexed code of a oneline function with parameters.

insert_str(txt)

table(dic[, top, bottom, init, tabs])

Add dict= {'key': [values...]} to a simple reST table.

Functions

smpl.doc.append_doc(original)[source]

Append doc string of original to target object.

Parameters

originalclass or function

orignal.__doc__ is appended to the __doc__ of the target

Examples

>>> def ho():
...     '''Ho'''
...     print(ho.__doc__)
>>> @append_doc(ho)
... def hi():
...     '''Hi'''
...     print(hi.__doc__)
>>> hi()
HiHo
smpl.doc.append_plot(*args, xmin=-5, xmax=5)[source]

Append a plot to a function.

smpl.doc.array_table(arr, top=True, bottom=True, init=True, tabs=1, header=True)[source]

Produces a reST table from a numpy array or normal 2d array.

Parameters

arrnumpy.ndarray, list or dict

2d array or dict

topbool

If True a top line is added.

bottombool

If True a bottom line is added.

initbool

If True a tab is added at the beginning of each line.

tabsint

Number of tabs at the beginning of each line.

headerbool

If True the first row is used as header.

Examples

>>> print(trim_eol_spaces(array_table([["a","b"],["hihi", "hoho"]],tabs=0)))
====== ======
a      b
====== ======
hihi   hoho
====== ======
smpl.doc.insert_doc(original)[source]

Inserts the docstring from passed function original in the target function docstring.

Parameters

originalclass or function

orignal.__doc__ is inserted to the __doc__ of the target

Examples

>>> def ho():
...     '''Ho'''
...     print(ho.__doc__)
>>> @insert_doc(ho)
... def hi():
...     '''Hi'''
...     print(hi.__doc__)
>>> hi()
HoHi
smpl.doc.insert_eq()[source]

Inserts the function and its parameters and an equal sign.

smpl.doc.insert_latex()[source]

Inserts latexed code of a oneline function.

smpl.doc.insert_latex_eq()[source]

Inserts latexed code of a oneline function with parameters.

smpl.doc.table(dic, top=True, bottom=True, init=True, tabs=1)[source]

Add dict= {‘key’: [values…]} to a simple reST table.

..deprecated:: 0.0.0