[Docs] Fix formatting of exported docstrings
This commit is contained in:
parent
043344b986
commit
27b4e2d891
|
@ -472,7 +472,6 @@ class Core(component.Component):
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
str: The torrent_id or None.
|
str: The torrent_id or None.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
filedump = b64decode(filedump)
|
filedump = b64decode(filedump)
|
||||||
|
|
|
@ -62,10 +62,19 @@ def export(auth_level=AUTH_LEVEL_DEFAULT):
|
||||||
def wrap(func, *args, **kwargs):
|
def wrap(func, *args, **kwargs):
|
||||||
func._rpcserver_export = True
|
func._rpcserver_export = True
|
||||||
func._rpcserver_auth_level = auth_level
|
func._rpcserver_auth_level = auth_level
|
||||||
doc = func.__doc__
|
|
||||||
func.__doc__ = '**RPC Exported Function** (*Auth Level: %s*)\n\n' % auth_level
|
rpc_text = '**RPC exported method** (*Auth level: %s*)' % auth_level
|
||||||
if doc:
|
|
||||||
func.__doc__ += doc
|
# Append the RPC text while ensuring correct docstring formatting.
|
||||||
|
if func.__doc__:
|
||||||
|
if func.__doc__.endswith(' '):
|
||||||
|
indent = func.__doc__.split('\n')[-1]
|
||||||
|
func.__doc__ += '\n{}'.format(indent)
|
||||||
|
else:
|
||||||
|
func.__doc__ += '\n\n'
|
||||||
|
func.__doc__ += rpc_text
|
||||||
|
else:
|
||||||
|
func.__doc__ = rpc_text
|
||||||
|
|
||||||
return func
|
return func
|
||||||
|
|
||||||
|
|
|
@ -125,6 +125,9 @@ extensions = [
|
||||||
'sphinx.ext.coverage',
|
'sphinx.ext.coverage',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
napoleon_include_init_with_doc = True
|
||||||
|
napoleon_use_rtype = False
|
||||||
|
|
||||||
# Add any paths that contain templates here, relative to this directory.
|
# Add any paths that contain templates here, relative to this directory.
|
||||||
templates_path = ['_templates']
|
templates_path = ['_templates']
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue