diff options
author | Pauli Virtanen <pav@iki.fi> | 2012-12-09 19:38:53 +0200 |
---|---|---|
committer | Pauli Virtanen <pav@iki.fi> | 2013-02-16 17:28:28 +0200 |
commit | a4cd4ffd52b4b60df4e8752ea202862e2c386589 (patch) | |
tree | dd09d7f81045e055a4b32f82e780895f8a09c242 /doc/sphinxext/docscrape.py | |
parent | c5cb18f9486c5e6291e476890a3b6bef1424062c (diff) | |
download | numpy-a4cd4ffd52b4b60df4e8752ea202862e2c386589.tar.gz |
ENH: numpydoc: deal with duplicated signatures
Diffstat (limited to 'doc/sphinxext/docscrape.py')
-rw-r--r-- | doc/sphinxext/docscrape.py | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/doc/sphinxext/docscrape.py b/doc/sphinxext/docscrape.py index bbd3fcacc..b492b1ab8 100644 --- a/doc/sphinxext/docscrape.py +++ b/doc/sphinxext/docscrape.py @@ -265,13 +265,17 @@ class NumpyDocString(object): if self._is_at_section(): return - summary = self._doc.read_to_next_empty_line() - summary_str = " ".join([s.strip() for s in summary]).strip() - if re.compile('^([\w., ]+=)?\s*[\w\.]+\(.*\)$').match(summary_str): - self['Signature'] = summary_str - if not self._is_at_section(): - self['Summary'] = self._doc.read_to_next_empty_line() - else: + # If several signatures present, take the last one + while True: + summary = self._doc.read_to_next_empty_line() + summary_str = " ".join([s.strip() for s in summary]).strip() + if re.compile('^([\w., ]+=)?\s*[\w\.]+\(.*\)$').match(summary_str): + self['Signature'] = summary_str + if not self._is_at_section(): + continue + break + + if summary is not None: self['Summary'] = summary if not self._is_at_section(): |