[Docs] Fix formatting of exported docstrings

This commit is contained in:
Calum Lind 2018-11-16 09:57:05 +00:00
parent 043344b986
commit 27b4e2d891
4 changed files with 17 additions and 6 deletions

View File

@ -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)

View File

@ -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

View File

@ -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']