This module provides some utility functions to manipulate docstrings at runtime. It’s useful for adjusting the docs built by Sphinx without making the code ugly.
Appends the docstring with given lines:
function.__doc__ = append_docstring(
function.__doc__,
'.. note::'
'',
' Appended docstring!'
)
Parameters: |
|
---|---|
Returns: | new docstring which is appended |
Return type: | basestring |
Manually appends class’ docstring with its attribute docstrings. For example:
class Entity(object):
# ...
__doc__ = append_docstring_attributes(
__doc__,
dict((k, v) for k, v in locals()
if isinstance(v, MyDescriptor))
)
Parameters: |
|
---|---|
Returns: | appended docstring |
Return type: | basestring |
Gets the minimum indent string from the docstring:
>>> get_minimum_indent('Hello')
''
>>> get_minimum_indent('Hello\n world::\n yeah')
' '
Parameters: |
|
---|---|
Returns: | the minimum indent string which consists of only whitespaces (tabs and/or spaces) |
Return type: | basestring |