mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Don't disregard return annotations for functions without any parameters.
This commit is contained in:
parent
094c7305b7
commit
528a06ff4e
2
CHANGES
2
CHANGES
@ -140,6 +140,8 @@ Bugs fixed
|
|||||||
* Fix a problem with index generation in LaTeX output, caused by
|
* Fix a problem with index generation in LaTeX output, caused by
|
||||||
hyperref not being included last.
|
hyperref not being included last.
|
||||||
|
|
||||||
|
* Don't disregard return annotations for functions without any parameters.
|
||||||
|
|
||||||
|
|
||||||
Release 0.4.3 (Oct 8, 2008)
|
Release 0.4.3 (Oct 8, 2008)
|
||||||
===========================
|
===========================
|
||||||
|
@ -199,6 +199,9 @@ def parse_py_signature(signode, sig, desctype, module, env):
|
|||||||
raise ValueError
|
raise ValueError
|
||||||
classname, name, arglist, retann = m.groups()
|
classname, name, arglist, retann = m.groups()
|
||||||
|
|
||||||
|
if retann:
|
||||||
|
retann = u' \N{RIGHTWARDS ARROW} ' + retann.strip()[2:]
|
||||||
|
|
||||||
if env.currclass:
|
if env.currclass:
|
||||||
add_module = False
|
add_module = False
|
||||||
if classname and classname.startswith(env.currclass):
|
if classname and classname.startswith(env.currclass):
|
||||||
@ -233,6 +236,8 @@ def parse_py_signature(signode, sig, desctype, module, env):
|
|||||||
if desctype in ('function', 'method', 'staticmethod'):
|
if desctype in ('function', 'method', 'staticmethod'):
|
||||||
# for callables, add an empty parameter list
|
# for callables, add an empty parameter list
|
||||||
signode += addnodes.desc_parameterlist()
|
signode += addnodes.desc_parameterlist()
|
||||||
|
if retann:
|
||||||
|
signode += addnodes.desc_type(retann, retann)
|
||||||
return fullname, classname
|
return fullname, classname
|
||||||
signode += addnodes.desc_parameterlist()
|
signode += addnodes.desc_parameterlist()
|
||||||
|
|
||||||
@ -255,7 +260,6 @@ def parse_py_signature(signode, sig, desctype, module, env):
|
|||||||
if len(stack) != 1:
|
if len(stack) != 1:
|
||||||
raise ValueError
|
raise ValueError
|
||||||
if retann:
|
if retann:
|
||||||
retann = u' \N{RIGHTWARDS ARROW} ' + retann.strip()[2:]
|
|
||||||
signode += addnodes.desc_type(retann, retann)
|
signode += addnodes.desc_type(retann, retann)
|
||||||
return fullname, classname
|
return fullname, classname
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user