documenting multiple return output, and adding sublists to function arguments, with napoleon extenstion on google docstrings

1,691 views
Skip to first unread message

David

unread,
Apr 2, 2015, 5:22:39 PM4/2/15
to sphinx...@googlegroups.com
Hi, I posted a question on stackoverflow recently:

http://stackoverflow.com/questions/29221551/can-sphinx-napoleon-document-function-returning-multiple-arguments

I haven't been able to get napoleon to format multiple return arguments nicely. I can do something like

def getNumServers(arg1, arg2):
 
'''short desc
 
  Args:
    arg1 (int): blah
    arg2 (int): blah
   
  Returns:
    (tuple):
     
       * numservers (int): number of servers
       * descr (str): logging message
  '''

 
pass
 

To force the two return arguments to be in a bullet-ted list, but I don't get different fonts to offset numservers and descr from their descriptions. Also, I'd rather not waste space documenting the fact that this is a tuple. I was hoping the napoleon plugin, for google docstrings, would look for multiple return arguments, but I don't think it does.

A related question is trying to document more complicated arguments. A function like
def foo(dictArg):
 
'''short descr

  Args:
    dictArg (dict): a dictionary with the keys:
      '
numEvents': the number of events to use
      '
dset': the datasource to use
  '''

 
pass

I'm don't think napoleon looks for lists under a parameter, I'm not sure the best way to put my own restructured text in there.

Reply all
Reply to author
Forward
0 new messages