From ab84356cbd4190f1b46f27b557ae87d1b1f75fb2 Mon Sep 17 00:00:00 2001 From: Joris Van den Bossche Date: Tue, 11 Jun 2019 16:30:53 +0200 Subject: [PATCH 1/3] DOC: clean-up numpydoc patches now numpydoc 0.9 is released --- doc/source/conf.py | 58 +++------------------------------------------- 1 file changed, 3 insertions(+), 55 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index 971aa04ba866a..f16a2518e10f7 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -110,6 +110,9 @@ else None))) autosummary_generate = True if pattern is None else ['index'] +# numpydoc +numpydoc_attributes_as_param_list = False + # matplotlib plot directive plot_include_source = True plot_formats = [("png", 90)] @@ -422,61 +425,6 @@ ] -def sphinxdocstring_str(self, indent=0, func_role="obj"): - # Pandas displays Attributes section in style like Methods section - - # Function is copy of `SphinxDocString.__str__` - 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(), - # Replaced `self._str_param_list('Attributes', fake_autosummary=True)` - # with `self._str_member_list('Attributes')` - 'attributes': self._str_member_list('Attributes'), - 'methods': self._str_member_list('Methods'), - } - ns = {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)) - - -SphinxDocString.__str__ = sphinxdocstring_str - - -# Fix "WARNING: Inline strong start-string without end-string." -# PR #155 "Escape the * in *args and **kwargs" from numpydoc -# Can be removed after PR merges in v0.9.0 -def decorate_process_param(func): - def _escape_args_and_kwargs(name): - if name[:2] == '**': - return r'\*\*' + name[2:] - elif name[:1] == '*': - return r'\*' + name[1:] - else: - return name - - def func_wrapper(self, param, desc, fake_autosummary): - param = _escape_args_and_kwargs(param.strip()) - return func(self, param, desc, fake_autosummary) - - return func_wrapper - - -func = SphinxDocString._process_param -SphinxDocString._process_param = decorate_process_param(func) # Add custom Documenter to handle attributes/methods of an AccessorProperty # eg pandas.Series.str and pandas.Series.dt (see GH9322) From 79727f09f7e393d4ab2baa075a8ec818eb019a6c Mon Sep 17 00:00:00 2001 From: Joris Van den Bossche Date: Tue, 11 Jun 2019 17:19:31 +0200 Subject: [PATCH 2/3] lint --- doc/source/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index f16a2518e10f7..3b85207c17f18 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -18,7 +18,7 @@ import jinja2 from sphinx.ext.autosummary import _import_by_name from numpydoc.docscrape import NumpyDocString -from numpydoc.docscrape_sphinx import SphinxDocString + logger = logging.getLogger(__name__) From 96deed41f71820d08c6989f5bf40ff0a02949d2b Mon Sep 17 00:00:00 2001 From: Joris Van den Bossche Date: Tue, 11 Jun 2019 20:42:55 +0200 Subject: [PATCH 3/3] lint --- doc/source/conf.py | 1 - 1 file changed, 1 deletion(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index 3b85207c17f18..2484a9d592e09 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -425,7 +425,6 @@ ] - # Add custom Documenter to handle attributes/methods of an AccessorProperty # eg pandas.Series.str and pandas.Series.dt (see GH9322)