8000 Backport PR #14029: Fix doc building with numpydoc 0.9 · matplotlib/matplotlib@7d8aaa1 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7d8aaa1

Browse files
anntzerMeeseeksDev[bot]
authored andcommitted
Backport PR #14029: Fix doc building with numpydoc 0.9
1 parent b9d3c83 commit 7d8aaa1

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
@@ -1461,6 +1461,12 @@ def _label_from_arg(y, default_name):
14611461
return None
14621462

14631463

1464+
_DATA_DOC_TITLE = """
1465+
1466+
Notes
1467+
-----
1468+
"""
1469+
14641470
_DATA_DOC_APPENDIX = """
14651471
14661472
.. note::
@@ -1498,7 +1504,10 @@ def _add_data_doc(docstring, replace_names):
14981504
if len(replace_names) == 0 else
14991505
"* All arguments with the following names: {}.".format(
15001506
", ".join(map(repr, sorted(replace_names)))))
1501-
return docstring + _DATA_DOC_APPENDIX.format(replaced=repl)
1507+
addendum = _DATA_DOC_APPENDIX.format(replaced=repl)
1508+
if _DATA_DOC_TITLE not in docstring:
1509+
addendum = _DATA_DOC_TITLE + addendum
1510+
return docstring + addendum
15021511

15031512

15041513
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
@@ -2623,11 +2623,6 @@ def broken_barh(self, xranges, yrange, **kwargs):
26232623
Returns
26242624
-------
26252625
collection : A :class:`~.collections.BrokenBarHCollection`
2626-
2627-
Notes
2628-
-----
2629-
.. [Notes section required for data comment. See #10189.]
2630-
26312626
"""
26322627
# process the unit information
26332628
if len(xranges):
@@ -3191,10 +3186,6 @@ def errorbar(self, x, y, yerr=None, xerr=None,
31913186
31923187
%(_Line2D_docstr)s
31933188
3194-
Notes
3195-
-----
3196-
.. [Notes section required for data comment. See #10189.]
3197-
31983189
"""
31993190
kwargs = cbook.normalize_kwargs(kwargs, mlines.Line2D._alias_map)
32003191
# anything that comes in as 'None', drop so the default thing
@@ -3649,10 +3640,6 @@ def boxplot(self, x, notch=None, sym=None, vert=None, whis=None,
36493640
36503641
- ``means``: points or lines representing the means.
36513642
3652-
Notes
3653-
-----
3654-
.. [Notes section required for data comment. See #10189.]
3655-
36563643
"""
36573644

36583645
# Missing arguments default to rcParams.
@@ -6628,10 +6615,6 @@ def hist(self, x, bins=None, range=None, density=None, weights=None,
66286615
--------
66296616
hist2d : 2D histograms
66306617
6631-
Notes
6632-
-----
6633-
.. [Notes section required for data comment. See #10189.]
6634-
66356618
"""
66366619
# Avoid shadowing the builtin.
66376620
bin_range = range
@@ -7353,10 +7336,6 @@ def magnitude_spectrum(self, x, Fs=None, Fc=None, window=None,
73537336
:func:`specgram` can plot the magnitude spectrum of segments within
73547337
the signal in a colormap.
73557338
7356-
Notes
7357-
-----
7358-
.. [Notes section required for data comment. See #10189.]
7359-
73607339
"""
73617340
if Fc is None:
73627341
Fc = 0
@@ -7442,10 +7421,6 @@ def angle_spectrum(self, x, Fs=None, Fc=None, window=None,
74427421
:func:`specgram` can plot the angle spectrum of segments within the
74437422
signal in a colormap.
74447423
7445-
Notes
7446-
-----
7447-
.. [Notes section required for data comment. See #10189.]
7448-
74497424
"""
74507425
if Fc is None:
74517426
Fc = 0
@@ -7518,10 +7493,6 @@ def phase_spectrum(self, x, Fs=None, Fc=None, window=None,
75187493
:func:`specgram` can plot the phase spectrum of segments within the
75197494
signal in a colormap.
75207495
7521-
Notes
7522-
-----
7523-
.. [Notes section required for data comment. See #10189.]
7524-
75257496
"""
75267497
if Fc is None:
75277498
Fc = 0
@@ -8031,10 +8002,6 @@ def violinplot(self, dataset, positions=None, vert=True, widths=0.5,
80318002
created to identify the median values of each of the
80328003
violin's distribution.
80338004
8034-
Notes
8035-
-----
8036-
.. [Notes section required for data comment. See #10189.]
8037-
80388005
"""
80398006

80408007
def _kde_method(X, coords):

lib/matplotlib/cbook/deprecation.py

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

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

253-
message = message.strip()
254-
new_doc = ('[*Deprecated*] {old_doc}\n'
255-
'\n'
256-
'.. deprecated:: {since}\n'
257-
' {message}'
258-
.format(since=since, message=message, old_doc=old_doc))
253+
notes_header = '\nNotes\n-----'
254+
new_doc = (f"[*Deprecated*] {old_doc}\n"
255+
f"{notes_header if notes_header not in old_doc else ''}\n"
256+
f".. deprecated:: {since}\n"
257+
f" {message.strip()}")
258+
259259
if not old_doc:
260260
# This is to prevent a spurious 'unexpected unindent' warning from
261261
# 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.3,!=1.5.0,!=1.6.4,!=1.7.3,!=1.8.0<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