I have a module that goes something like this:
#!/usr/bin/env python
#: Documentation here.
#: blah blah blah
foobar = r'Some really long regex here.'
def myfunc(val=foobar):
'''Blah blah blah'''
pass
...and I have a .rst
file that goes something like this:
:mod:`my_module` Module
-----------------------
..automodule:: my_module
:members:
:private-members:
:show-inheritance:
When I build the documentation, I get an html file with a snippet that goes like this:
mymodule.foobar.foobar = 'Some absurdly long and ugly regex here'
Extra documentation here
mymodule.myfunc(val='Some absurdly long and ugly regex here')
blah blah blah
Based on this stackoverflow post, I thought I could change it by altering my module to:
#!/usr/bin/env python
#: .. data:: my_module.foobar
#: Extra documentation here
foobar = 'Some really long regex here.'
def myfunc(val=foobar):
'''.. function:: my_module.myfunc(val=foobar)
Blah blah blah'''
pass
...but that didn't do the trick, and just appended the signature I wanted under the ugly one as part of the body. Does anybody know how I can properly override this?
(I'm using Sphinx v1.1.3, btw.)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…