Skip to content

Commit b8ad9da

Browse files
DOC: clean-up numpydoc patches now numpydoc 0.9 is released (#26785)
1 parent deffee6 commit b8ad9da

File tree

1 file changed

+4
-57
lines changed

1 file changed

+4
-57
lines changed

doc/source/conf.py

+4-57
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import jinja2
1919
from sphinx.ext.autosummary import _import_by_name
2020
from numpydoc.docscrape import NumpyDocString
21-
from numpydoc.docscrape_sphinx import SphinxDocString
21+
2222

2323
logger = logging.getLogger(__name__)
2424

@@ -110,6 +110,9 @@
110110
else None)))
111111
autosummary_generate = True if pattern is None else ['index']
112112

113+
# numpydoc
114+
numpydoc_attributes_as_param_list = False
115+
113116
# matplotlib plot directive
114117
plot_include_source = True
115118
plot_formats = [("png", 90)]
@@ -422,62 +425,6 @@
422425
]
423426

424427

425-
def sphinxdocstring_str(self, indent=0, func_role="obj"):
426-
# Pandas displays Attributes section in style like Methods section
427-
428-
# Function is copy of `SphinxDocString.__str__`
429-
ns = {
430-
'signature': self._str_signature(),
431-
'index': self._str_index(),
432-
'summary': self._str_summary(),
433-
'extended_summary': self._str_extended_summary(),
434-
'parameters': self._str_param_list('Parameters'),
435-
'returns': self._str_returns('Returns'),
436-
'yields': self._str_returns('Yields'),
437-
'other_parameters': self._str_param_list('Other Parameters'),
438-
'raises': self._str_param_list('Raises'),
439-
'warns': self._str_param_list('Warns'),
440-
'warnings': self._str_warnings(),
441-
'see_also': self._str_see_also(func_role),
442-
'notes': self._str_section('Notes'),
443-
'references': self._str_references(),
444-
'examples': self._str_examples(),
445-
# Replaced `self._str_param_list('Attributes', fake_autosummary=True)`
446-
# with `self._str_member_list('Attributes')`
447-
'attributes': self._str_member_list('Attributes'),
448-
'methods': self._str_member_list('Methods'),
449-
}
450-
ns = {k: '\n'.join(v) for k, v in ns.items()}
451-
452-
rendered = self.template.render(**ns)
453-
return '\n'.join(self._str_indent(rendered.split('\n'), indent))
454-
455-
456-
SphinxDocString.__str__ = sphinxdocstring_str
457-
458-
459-
# Fix "WARNING: Inline strong start-string without end-string."
460-
# PR #155 "Escape the * in *args and **kwargs" from numpydoc
461-
# Can be removed after PR merges in v0.9.0
462-
def decorate_process_param(func):
463-
def _escape_args_and_kwargs(name):
464-
if name[:2] == '**':
465-
return r'\*\*' + name[2:]
466-
elif name[:1] == '*':
467-
return r'\*' + name[1:]
468-
else:
469-
return name
470-
471-
def func_wrapper(self, param, desc, fake_autosummary):
472-
param = _escape_args_and_kwargs(param.strip())
473-
return func(self, param, desc, fake_autosummary)
474-
475-
return func_wrapper
476-
477-
478-
func = SphinxDocString._process_param
479-
SphinxDocString._process_param = decorate_process_param(func)
480-
481428
# Add custom Documenter to handle attributes/methods of an AccessorProperty
482429
# eg pandas.Series.str and pandas.Series.dt (see GH9322)
483430

0 commit comments

Comments
 (0)