diff options
| author | Georg Brandl <georg@python.org> | 2008-12-25 22:06:10 +0100 |
|---|---|---|
| committer | Georg Brandl <georg@python.org> | 2008-12-25 22:06:10 +0100 |
| commit | f0cc764b6073a0e82264d155099023fd010e313a (patch) | |
| tree | b0df83f56b6f248430131ff682e1fc66552a0603 /sphinx/ext | |
| parent | fca6a2e59767a66110e1c66b67e29cc268f062ad (diff) | |
| download | sphinx-f0cc764b6073a0e82264d155099023fd010e313a.tar.gz | |
Change the way to handle return annotations a bit.
Diffstat (limited to 'sphinx/ext')
| -rw-r--r-- | sphinx/ext/autodoc.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sphinx/ext/autodoc.py b/sphinx/ext/autodoc.py index 45bad2a5..1a46ac8a 100644 --- a/sphinx/ext/autodoc.py +++ b/sphinx/ext/autodoc.py @@ -36,8 +36,9 @@ py_ext_sig_re = re.compile( r'''^ ([\w.]+::)? # explicit module name ([\w.]+\.)? # module and/or class name(s) (\w+) \s* # thing name - (?: \((.*)\) # optional arguments - (\s* -> \s* .*)? )? $ # optional return annotation + (?: \((.*)\) # optional: arguments + (?:\s* -> \s* (.*))? # return annotation + )? $ # and nothing more ''', re.VERBOSE) @@ -391,7 +392,7 @@ class RstGenerator(object): args, retann = result if args is not None: - return '%s%s' % (args, retann or '') + return '%s%s' % (args, retann and (' -> %s' % retann) or '') elif err: # re-raise the error for perusal of the handler in generate() raise RuntimeError(err) |
