diff options
author | Dražen Lučanin <kermit666@gmail.com> | 2014-01-30 12:52:08 +0100 |
---|---|---|
committer | Dražen Lučanin <kermit666@gmail.com> | 2014-01-30 12:52:08 +0100 |
commit | b58dd600e8c504e173120a58b4700a1f9dc1e8cc (patch) | |
tree | 06ac5886ac6ef08d0c439449528a13c8fc9cf022 | |
parent | adcc5da3c27960f981cd1cb897b170f004d40cf3 (diff) | |
download | numpydoc-b58dd600e8c504e173120a58b4700a1f9dc1e8cc.tar.gz |
listcomp -> for-loop (listcopms create a new scope in py3), bypass AttributeError on Pandas.str
-rw-r--r-- | numpydoc/docscrape.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/numpydoc/docscrape.py b/numpydoc/docscrape.py index 4ee0f2e..2c49ed8 100644 --- a/numpydoc/docscrape.py +++ b/numpydoc/docscrape.py @@ -499,10 +499,14 @@ class ClassDoc(NumpyDocString): 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): |