8000 Merge pull request #14029 from dstansby/numpydoc-point9 · matplotlib/matplotlib@de957a9 · GitHub
[go: up one dir, main page]

Skip to content

Commit de957a9

Browse files
authored
Merge pull request #14029 from dstansby/numpydoc-point9
Fix doc building with numpydoc 0.9
2 parents 73c0ed6 + ad61f80 commit de957a9

File tree

4 files changed

+17
-41
lines changed

4 files changed

+17
-41
lines changed

lib/matplotlib/__init__.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1448,6 +1448,12 @@ def _label_from_arg(y, default_name):
14481448
return None
14491449

14501450

1451+
_DATA_DOC_TITLE = """
1452+
1453+
Notes
1454+
-----
1455+
"""
1456+
14511457
_DATA_DOC_APPENDIX = """
14521458
14531459
.. note::
@@ -1485,7 +1491,10 @@ def _add_data_doc(docstring, replace_names):
14851491
if len(replace_names) == 0 else
14861492
"* All arguments with the following names: {}.".format(
14871493
", ".join(map(repr, sorted(replace_names)))))
1488-
return docstring + _DATA_DOC_APPENDIX.format(replaced=repl)
1494+
addendum = _DATA_DOC_APPENDIX.format(replaced=repl)
1495+
if _DATA_DOC_TITLE not in docstring:
1496+
addendum = _DATA_DOC_TITLE + addendum
1497+
return docstring + addendum
14891498

14901499

14911500
def _preprocess_data(func=None, *, replace_names=None, label_namer=None):

lib/matplotlib/axes/_axes.py

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2622,11 +2622,6 @@ def broken_barh(self, xranges, yrange, **kwargs):
26222622
Returns
26232623
-------
26242624
collection : A :class:`~.collections.BrokenBarHCollection`
2625-
2626-
Notes
2627-
-----
2628-
.. [Notes section required for data comment. See #10189.]
2629-
26302625
"""
26312626
# process the unit information
26322627
if len(xranges):
@@ -3192,10 +3187,6 @@ def errorbar(self, x, y, yerr=None, xerr=None,
31923187
31933188
%(_Line2D_docstr)s
31943189
3195-
Notes
3196-
-----
3197-
.. [Notes section required for data comment. See #10189.]
3198-
31993190
"""
32003191
kwargs = cbook.normalize_kwargs(kwargs, mlines.Line2D)
32013192
# anything that comes in as 'None', drop so the default thing
@@ -3659,10 +3650,6 @@ def boxplot(self, x, notch=None, sym=None, vert=None, whis=None,
36593650
36603651
- ``means``: points or lines representing the means.
36613652
3662-
Notes
3663-
-----
3664-
.. [Notes section required for data comment. See #10189.]
3665-
36663653
"""
36673654

36683655
# Missing arguments default to rcParams.
@@ -6605,10 +6592,6 @@ def hist(self, x, bins=None, range=None, density=None, weights=None,
66056592
--------
66066593
hist2d : 2D histograms
66076594
6608-
Notes
6609-
-----
6610-
.. [Notes section required for data comment. See #10189.]
6611-
66126595
"""
66136596
# Avoid shadowing the builtin.
66146597
bin_range = range
@@ -7325,10 +7308,6 @@ def magnitude_spectrum(self, x, Fs=None, Fc=None, window=None,
73257308
:func:`specgram` can plot the magnitude spectrum of segments within
73267309
the signal in a colormap.
73277310
7328-
Notes
7329-
-----
7330-
.. [Notes section required for data comment. See #10189.]
7331-
73327311
"""
73337312
if Fc is None:
73347313
Fc = 0
@@ -7414,10 +7393,6 @@ def angle_spectrum(self, x, Fs=None, Fc=None, window=None,
74147393
:func:`specgram` can plot the angle spectrum of segments within the
74157394
signal in a colormap.
74167395
7417-
Notes
7418-
-----
7419-
.. [Notes section required for data comment. See #10189.]
7420-
74217396
"""
74227397
if Fc is None:
74237398
Fc = 0
@@ -7490,10 +7465,6 @@ def phase_spectrum(self, x, Fs=None, Fc=None, window=None,
74907465
:func:`specgram` can plot the phase spectrum of segments within the
74917466
signal in a colormap.
74927467
7493-
Notes
7494-
-----
7495-
.. [Notes section required for data comment. See #10189.]
7496-
74977468
"""
74987469
if Fc is None:
74997470
Fc = 0
@@ -7992,10 +7963,6 @@ def violinplot(self, dataset, positions=None, vert=True, widths=0.5,
79927963
- ``cmedians``: A `~.collections.LineCollection` instance that
79937964
marks the median values of each of the violin's distribution.
79947965
7995-
Notes
7996-
-----
7997-
.. [Notes section required for data comment. See #10189.]
7998-
79997966
"""
80007967

80017968
def _kde_method(X, coords):

lib/matplotlib/cbook/deprecation.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -248,12 +248,12 @@ def wrapper(*args, **kwargs):
248248

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

251-
message = message.strip()
252-
new_doc = ('[*Deprecated*] {old_doc}\n'
253-
'\n'
254-
'.. deprecated:: {since}\n'
255-
' {message}'
256-
.format(since=since, message=message, old_doc=old_doc))
251+
notes_header = '\nNotes\n-----'
252+
new_doc = (f"[*Deprecated*] {old_doc}\n"
253+
f"{notes_header if notes_header not in old_doc else ''}\n"
254+
f".. deprecated:: {since}\n"
255+
f" {message.strip()}")
256+
257257
if not old_doc:
258258
# This is to prevent a spurious 'unexpected unindent' warning from
259259
# docutils when the original docstring was blank.

requirements/doc/doc-requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ sphinx>=1.8.1,<2.0.0
1111
colorspacious
1212
ipython
1313
ipywidgets
14-
numpydoc>=0.8,<0.9
14+
numpydoc>=0.8
1515
pillow>=3.4,!=5.4.0
1616
sphinx-gallery>=0.2
1717
sphinx-copybutton

0 commit comments

Comments
 (0)
0