smpl.doc¶
Simplified python code documentation.
|
Append doc string of |
|
Append a plot to a function. |
|
|
|
Produces a reST table from a numpy array or normal 2d array. |
|
|
|
Inserts the docstring from passed function |
Inserts the function and its parameters and an equal sign. |
|
Inserts latexed code of a oneline function. |
|
Inserts latexed code of a oneline function with parameters. |
|
|
|
|
Add dict= {'key': [values...]} to a simple reST table. |
Functions
- smpl.doc.append_doc(original)[source]¶
Append doc string of
originaltotargetobject.Parameters¶
- original
classorfunction orignal.__doc__is appended to the__doc__of thetarget
Examples¶
>>> def ho(): ... '''Ho''' ... print(ho.__doc__) >>> @append_doc(ho) ... def hi(): ... '''Hi''' ... print(hi.__doc__) >>> hi() HiHo
- original
- 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¶
- arr
numpy.ndarray,listordict 2d array or dict
- top
bool If
Truea top line is added.- bottom
bool If
Truea bottom line is added.- init
bool If
Truea tab is added at the beginning of each line.- tabs
int Number of tabs at the beginning of each line.
- header
bool If
Truethe first row is used as header.
Examples¶
>>> print(trim_eol_spaces(array_table([["a","b"],["hihi", "hoho"]],tabs=0))) ====== ====== a b ====== ====== hihi hoho ====== ======
- arr
- smpl.doc.insert_doc(original)[source]¶
Inserts the docstring from passed function
originalin thetargetfunction docstring.Parameters¶
- original
classorfunction orignal.__doc__is inserted to the__doc__of thetarget
Examples¶
>>> def ho(): ... '''Ho''' ... print(ho.__doc__) >>> @insert_doc(ho) ... def hi(): ... '''Hi''' ... print(hi.__doc__) >>> hi() HoHi
- original