Skip to content
2 changes: 1 addition & 1 deletion doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
'sphinx.ext.doctest',
'sphinx.ext.extlinks',
'sphinx.ext.todo',
'numpydoc',
'numpydoc_pandas', # use member listing for attributes
'IPython.sphinxext.ipython_directive',
'IPython.sphinxext.ipython_console_highlighting',
'matplotlib.sphinxext.plot_directive',
Expand Down
8 changes: 8 additions & 0 deletions doc/sphinxext/numpydoc_pandas/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from __future__ import division, absolute_import, print_function

__version__ = '0.8.0'


def setup(app, *args, **kwargs):
from .numpydoc import setup
return setup(app, *args, **kwargs)
36 changes: 36 additions & 0 deletions doc/sphinxext/numpydoc_pandas/numpydoc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# PANDAS HACK: Replace attributes param_list by member_list
def alternative_str(self, indent=0, func_role="obj"):
ns = {
'signature': self._str_signature(),
'index': self._str_index(),
'summary': self._str_summary(),
'extended_summary': self._str_extended_summary(),
'parameters': self._str_param_list('Parameters'),
'returns': self._str_returns('Returns'),
'yields': self._str_returns('Yields'),
'other_parameters': self._str_param_list('Other Parameters'),
'raises': self._str_param_list('Raises'),
'warns': self._str_param_list('Warns'),
'warnings': self._str_warnings(),
'see_also': self._str_see_also(func_role),
'notes': self._str_section('Notes'),
'references': self._str_references(),
'examples': self._str_examples(),
'attributes': self._str_member_list('Attributes'),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously a condition existed:

            'attributes':
                self._str_param_list('Attributes', fake_autosummary=True)
                if self.attributes_as_param_list
                else self._str_member_list('Attributes'),

I assumed that self.attributes_as_param_list was always set as False

'methods': self._str_member_list('Methods'),
}
ns = dict((k, '\n'.join(v)) for k, v in ns.items())

rendered = self.template.render(**ns)
return '\n'.join(self._str_indent(rendered.split('\n'), indent))


from numpydoc.docscrape_sphinx import SphinxDocString
SphinxDocString.__str__ = alternative_str


def setup(app, *args, **kwargs):
from numpydoc import setup
app.add_config_value('numpydoc_attributes_as_param_list', True, True)
return setup(app, *args, **kwargs)