sqlalchemy_imageattach.util
— Utilities¶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.
sqlalchemy_imageattach.util.
append_docstring
(docstring, *lines)¶Appends the docstring
with given lines
:
function.__doc__ = append_docstring(
function.__doc__,
'.. note::'
'',
' Appended docstring!'
)
Parameters: |
|
---|---|
Returns: | new docstring which is appended |
Return type: |
|
sqlalchemy_imageattach.util.
append_docstring_attributes
(docstring, locals)¶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: |
|
sqlalchemy_imageattach.util.
get_minimum_indent
(docstring, ignore_before=1)¶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: |
|