Skip to content

Fix doc building with numpydoc 0.9 #14029

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion lib/matplotlib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1450,6 +1450,12 @@ def _label_from_arg(y, default_name):
return None


_DATA_DOC_TITLE = """

Notes
-----
"""

_DATA_DOC_APPENDIX = """

.. note::
Expand Down Expand Up @@ -1487,7 +1493,10 @@ def _add_data_doc(docstring, replace_names):
if len(replace_names) == 0 else
"* All arguments with the following names: {}.".format(
", ".join(map(repr, sorted(replace_names)))))
return docstring + _DATA_DOC_APPENDIX.format(replaced=repl)
addendum = _DATA_DOC_APPENDIX.format(replaced=repl)
if _DATA_DOC_TITLE not in docstring:
addendum = _DATA_DOC_TITLE + addendum
return docstring + addendum


def _preprocess_data(func=None, *, replace_names=None, label_namer=None):
Expand Down
33 changes: 0 additions & 33 deletions lib/matplotlib/axes/_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2615,11 +2615,6 @@ def broken_barh(self, xranges, yrange, **kwargs):
Returns
-------
collection : A :class:`~.collections.BrokenBarHCollection`

Notes
-----
.. [Notes section required for data comment. See #10189.]

"""
# process the unit information
if len(xranges):
Expand Down Expand Up @@ -3183,10 +3178,6 @@ def errorbar(self, x, y, yerr=None, xerr=None,

%(_Line2D_docstr)s

Notes
-----
.. [Notes section required for data comment. See #10189.]

"""
kwargs = cbook.normalize_kwargs(kwargs, mlines.Line2D)
# anything that comes in as 'None', drop so the default thing
Expand Down Expand Up @@ -3641,10 +3632,6 @@ def boxplot(self, x, notch=None, sym=None, vert=None, whis=None,

- ``means``: points or lines representing the means.

Notes
-----
.. [Notes section required for data comment. See #10189.]

"""

# Missing arguments default to rcParams.
Expand Down Expand Up @@ -6579,10 +6566,6 @@ def hist(self, x, bins=None, range=None, density=None, weights=None,
--------
hist2d : 2D histograms

Notes
-----
.. [Notes section required for data comment. See #10189.]

"""
# Avoid shadowing the builtin.
bin_range = range
Expand Down Expand Up @@ -7299,10 +7282,6 @@ def magnitude_spectrum(self, x, Fs=None, Fc=None, window=None,
:func:`specgram` can plot the magnitude spectrum of segments within
the signal in a colormap.

Notes
-----
.. [Notes section required for data comment. See #10189.]

"""
if Fc is None:
Fc = 0
Expand Down Expand Up @@ -7388,10 +7367,6 @@ def angle_spectrum(self, x, Fs=None, Fc=None, window=None,
:func:`specgram` can plot the angle spectrum of segments within the
signal in a colormap.

Notes
-----
.. [Notes section required for data comment. See #10189.]

"""
if Fc is None:
Fc = 0
Expand Down Expand Up @@ -7464,10 +7439,6 @@ def phase_spectrum(self, x, Fs=None, Fc=None, window=None,
:func:`specgram` can plot the phase spectrum of segments within the
signal in a colormap.

Notes
-----
.. [Notes section required for data comment. See #10189.]

"""
if Fc is None:
Fc = 0
Expand Down Expand Up @@ -7966,10 +7937,6 @@ def violinplot(self, dataset, positions=None, vert=True, widths=0.5,
- ``cmedians``: A `~.collections.LineCollection` instance that
marks the median values of each of the violin's distribution.

Notes
-----
.. [Notes section required for data comment. See #10189.]

"""

def _kde_method(X, coords):
Expand Down
12 changes: 6 additions & 6 deletions lib/matplotlib/cbook/deprecation.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,12 +248,12 @@ def wrapper(*args, **kwargs):

old_doc = inspect.cleandoc(old_doc or '').strip('\n')

message = message.strip()
new_doc = ('[*Deprecated*] {old_doc}\n'
'\n'
'.. deprecated:: {since}\n'
' {message}'
.format(since=since, message=message, old_doc=old_doc))
notes_header = '\nNotes\n-----'
new_doc = (f"[*Deprecated*] {old_doc}\n"
f"{notes_header if notes_header not in old_doc else ''}\n"
f".. deprecated:: {since}\n"
f" {message.strip()}")

if not old_doc:
# This is to prevent a spurious 'unexpected unindent' warning from
# docutils when the original docstring was blank.
Expand Down
2 changes: 1 addition & 1 deletion requirements/doc/doc-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ sphinx>=1.8.1,<2.0.0
colorspacious
ipython
ipywidgets
numpydoc>=0.8,<0.9
numpydoc>=0.8
pillow>=3.4,!=5.4.0
sphinx-gallery>=0.2
sphinx-copybutton