From 026c9be691bc5abb3997325ae483adccd7158f2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Draz=CC=8Cen=20Luc=CC=8Canin?= Date: Sun, 26 Jan 2014 17:39:26 +0100 Subject: [PATCH] listcomp -> for-loop (listcopms create a new scope in py3), bypass AttributeError on Pandas.str --- doc/sphinxext/numpydoc/docscrape.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/doc/sphinxext/numpydoc/docscrape.py b/doc/sphinxext/numpydoc/docscrape.py index 4ee0f2e400d0e..2c49ed84ad224 100755 --- a/doc/sphinxext/numpydoc/docscrape.py +++ b/doc/sphinxext/numpydoc/docscrape.py @@ -499,10 +499,14 @@ def splitlines_x(s): for field, items in [('Methods', self.methods), ('Attributes', self.properties)]: if not self[field]: - self[field] = [ - (name, '', - splitlines_x(pydoc.getdoc(getattr(self._cls, name)))) - for name in sorted(items)] + doc_list = [] + for name in sorted(items): + try: + doc_item = pydoc.getdoc(getattr(self._cls, name)) + doc_list.append((name, '', splitlines_x(doc_item))) + except AttributeError: + pass # method doesn't exist + self[field] = doc_list @property def methods(self):