Skip to content

Commit 64d45cb

Browse files
authored
Merge pull request #28826 from timhoffm/doc-remove-dedent_interpd
MNT: Replace _docstring.dedent_interpd by its alias _docstring.interpd
2 parents 390e146 + 7c074e6 commit 64d45cb

File tree

15 files changed

+97
-97
lines changed

15 files changed

+97
-97
lines changed

lib/matplotlib/_docstring.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,4 +122,4 @@ def do_copy(target):
122122

123123
# Create a decorator that will house the various docstring snippets reused
124124
# throughout Matplotlib.
125-
dedent_interpd = interpd = _ArtistPropertiesSubstitution()
125+
interpd = _ArtistPropertiesSubstitution()

lib/matplotlib/axes/_axes.py

+42-42
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ def get_legend_handles_labels(self, legend_handler_map=None):
220220
[self], legend_handler_map)
221221
return handles, labels
222222

223-
@_docstring.dedent_interpd
223+
@_docstring.interpd
224224
def legend(self, *args, **kwargs):
225225
"""
226226
Place a legend on the Axes.
@@ -418,7 +418,7 @@ def inset_axes(self, bounds, *, transform=None, zorder=5, **kwargs):
418418

419419
return inset_ax
420420

421-
@_docstring.dedent_interpd
421+
@_docstring.interpd
422422
def indicate_inset(self, bounds, inset_ax=None, *, transform=None,
423423
facecolor='none', edgecolor='0.5', alpha=0.5,
424424
zorder=4.99, **kwargs):
@@ -572,7 +572,7 @@ def indicate_inset_zoom(self, inset_ax, **kwargs):
572572
rect = (xlim[0], ylim[0], xlim[1] - xlim[0], ylim[1] - ylim[0])
573573
return self.indicate_inset(rect, inset_ax, **kwargs)
574574

575-
@_docstring.dedent_interpd
575+
@_docstring.interpd
576576
def secondary_xaxis(self, location, functions=None, *, transform=None, **kwargs):
577577
"""
578578
Add a second x-axis to this `~.axes.Axes`.
@@ -626,7 +626,7 @@ def invert(x):
626626
self.add_child_axes(secondary_ax)
627627
return secondary_ax
628628

629-
@_docstring.dedent_interpd
629+
@_docstring.interpd
630630
def secondary_yaxis(self, location, functions=None, *, transform=None, **kwargs):
631631
"""
632632
Add a second y-axis to this `~.axes.Axes`.
@@ -670,7 +670,7 @@ def secondary_yaxis(self, location, functions=None, *, transform=None, **kwargs)
670670
self.add_child_axes(secondary_ax)
671671
return secondary_ax
672672

673-
@_docstring.dedent_interpd
673+
@_docstring.interpd
674674
def text(self, x, y, s, fontdict=None, **kwargs):
675675
"""
676676
Add text to the Axes.
@@ -749,7 +749,7 @@ def text(self, x, y, s, fontdict=None, **kwargs):
749749
self._add_text(t)
750750
return t
751751

752-
@_docstring.dedent_interpd
752+
@_docstring.interpd
753753
def annotate(self, text, xy, xytext=None, xycoords='data', textcoords=None,
754754
arrowprops=None, annotation_clip=None, **kwargs):
755755
# Signature must match Annotation. This is verified in
@@ -765,7 +765,7 @@ def annotate(self, text, xy, xytext=None, xycoords='data', textcoords=None,
765765
annotate.__doc__ = mtext.Annotation.__init__.__doc__
766766
#### Lines and spans
767767

768-
@_docstring.dedent_interpd
768+
@_docstring.interpd
769769
def axhline(self, y=0, xmin=0, xmax=1, **kwargs):
770770
"""
771771
Add a horizontal line spanning the whole or fraction of the Axes.
@@ -839,7 +839,7 @@ def axhline(self, y=0, xmin=0, xmax=1, **kwargs):
839839
self._request_autoscale_view("y")
840840
return l
841841

842-
@_docstring.dedent_interpd
842+
@_docstring.interpd
843843
def axvline(self, x=0, ymin=0, ymax=1, **kwargs):
844844
"""
845845
Add a vertical line spanning the whole or fraction of the Axes.
@@ -921,7 +921,7 @@ def _check_no_units(vals, names):
921921
raise ValueError(f"{name} must be a single scalar value, "
922922
f"but got {val}")
923923

924-
@_docstring.dedent_interpd
924+
@_docstring.interpd
925925
def axline(self, xy1, xy2=None, *, slope=None, **kwargs):
926926
"""
927927
Add an infinitely long straight line.
@@ -995,7 +995,7 @@ def axline(self, xy1, xy2=None, *, slope=None, **kwargs):
995995
self._request_autoscale_view()
996996
return line
997997

998-
@_docstring.dedent_interpd
998+
@_docstring.interpd
999999
def axhspan(self, ymin, ymax, xmin=0, xmax=1, **kwargs):
10001000
"""
10011001
Add a horizontal span (rectangle) across the Axes.
@@ -1050,7 +1050,7 @@ def axhspan(self, ymin, ymax, xmin=0, xmax=1, **kwargs):
10501050
self._request_autoscale_view("y")
10511051
return p
10521052

1053-
@_docstring.dedent_interpd
1053+
@_docstring.interpd
10541054
def axvspan(self, xmin, xmax, ymin=0, ymax=1, **kwargs):
10551055
"""
10561056
Add a vertical span (rectangle) across the Axes.
@@ -1301,7 +1301,7 @@ def vlines(self, x, ymin, ymax, colors=None, linestyles='solid',
13011301
@_preprocess_data(replace_names=["positions", "lineoffsets",
13021302
"linelengths", "linewidths",
13031303
"colors", "linestyles"])
1304-
@_docstring.dedent_interpd
1304+
@_docstring.interpd
13051305
def eventplot(self, positions, orientation='horizontal', lineoffsets=1,
13061306
linelengths=1, linewidths=None, colors=None, alpha=None,
13071307
linestyles='solid', **kwargs):
@@ -1547,7 +1547,7 @@ def eventplot(self, positions, orientation='horizontal', lineoffsets=1,
15471547

15481548
# Uses a custom implementation of data-kwarg handling in
15491549
# _process_plot_var_args.
1550-
@_docstring.dedent_interpd
1550+
@_docstring.interpd
15511551
def plot(self, *args, scalex=True, scaley=True, data=None, **kwargs):
15521552
"""
15531553
Plot y versus x as lines and/or markers.
@@ -1803,7 +1803,7 @@ def plot(self, *args, scalex=True, scaley=True, data=None, **kwargs):
18031803

18041804
@_api.deprecated("3.9", alternative="plot")
18051805
@_preprocess_data(replace_names=["x", "y"], label_namer="y")
1806-
@_docstring.dedent_interpd
1806+
@_docstring.interpd
18071807
def plot_date(self, x, y, fmt='o', tz=None, xdate=True, ydate=False,
18081808
**kwargs):
18091809
"""
@@ -1883,7 +1883,7 @@ def plot_date(self, x, y, fmt='o', tz=None, xdate=True, ydate=False,
18831883
return self.plot(x, y, fmt, **kwargs)
18841884

18851885
# @_preprocess_data() # let 'plot' do the unpacking..
1886-
@_docstring.dedent_interpd
1886+
@_docstring.interpd
18871887
def loglog(self, *args, **kwargs):
18881888
"""
18891889
Make a plot with log scaling on both the x- and y-axis.
@@ -1937,7 +1937,7 @@ def loglog(self, *args, **kwargs):
19371937
*args, **{k: v for k, v in kwargs.items() if k not in {*dx, *dy}})
19381938

19391939
# @_preprocess_data() # let 'plot' do the unpacking..
1940-
@_docstring.dedent_interpd
1940+
@_docstring.interpd
19411941
def semilogx(self, *args, **kwargs):
19421942
"""
19431943
Make a plot with log scaling on the x-axis.
@@ -1984,7 +1984,7 @@ def semilogx(self, *args, **kwargs):
19841984
*args, **{k: v for k, v in kwargs.items() if k not in d})
19851985

19861986
# @_preprocess_data() # let 'plot' do the unpacking..
1987-
@_docstring.dedent_interpd
1987+
@_docstring.interpd
19881988
def semilogy(self, *args, **kwargs):
19891989
"""
19901990
Make a plot with log scaling on the y-axis.
@@ -2340,7 +2340,7 @@ def _convert_dx(dx, x0, xconv, convert):
23402340
return dx
23412341

23422342
@_preprocess_data()
2343-
@_docstring.dedent_interpd
2343+
@_docstring.interpd
23442344
def bar(self, x, height, width=0.8, bottom=None, *, align="center",
23452345
**kwargs):
23462346
r"""
@@ -2652,7 +2652,7 @@ def bar(self, x, height, width=0.8, bottom=None, *, align="center",
26522652
return bar_container
26532653

26542654
# @_preprocess_data() # let 'bar' do the unpacking..
2655-
@_docstring.dedent_interpd
2655+
@_docstring.interpd
26562656
def barh(self, y, width, height=0.8, left=None, *, align="center",
26572657
data=None, **kwargs):
26582658
r"""
@@ -2946,7 +2946,7 @@ def sign(x):
29462946
return annotations
29472947

29482948
@_preprocess_data()
2949-
@_docstring.dedent_interpd
2949+
@_docstring.interpd
29502950
def broken_barh(self, xranges, yrange, **kwargs):
29512951
"""
29522952
Plot a horizontal sequence of rectangles.
@@ -3455,7 +3455,7 @@ def _errorevery_to_mask(x, errorevery):
34553455
@_api.make_keyword_only("3.9", "ecolor")
34563456
@_preprocess_data(replace_names=["x", "y", "xerr", "yerr"],
34573457
label_namer="y")
3458-
@_docstring.dedent_interpd
3458+
@_docstring.interpd
34593459
def errorbar(self, x, y, yerr=None, xerr=None,
34603460
fmt='', ecolor=None, elinewidth=None, capsize=None,
34613461
barsabove=False, lolims=False, uplims=False,
@@ -4985,7 +4985,7 @@ def scatter(self, x, y, s=None, c=None, marker=None, cmap=None, norm=None,
49854985

49864986
@_api.make_keyword_only("3.9", "gridsize")
49874987
@_preprocess_data(replace_names=["x", "y", "C"], label_namer="y")
4988-
@_docstring.dedent_interpd
4988+
@_docstring.interpd
49894989
def hexbin(self, x, y, C=None, gridsize=100, bins=None,
49904990
xscale='linear', yscale='linear', extent=None,
49914991
cmap=None, norm=None, vmin=None, vmax=None,
@@ -5380,7 +5380,7 @@ def on_changed(collection):
53805380

53815381
return collection
53825382

5383-
@_docstring.dedent_interpd
5383+
@_docstring.interpd
53845384
def arrow(self, x, y, dx, dy, **kwargs):
53855385
"""
53865386
Add an arrow to the Axes.
@@ -5435,7 +5435,7 @@ def _quiver_units(self, args, kwargs):
54355435

54365436
# args can be a combination of X, Y, U, V, C and all should be replaced
54375437
@_preprocess_data()
5438-
@_docstring.dedent_interpd
5438+
@_docstring.interpd
54395439
def quiver(self, *args, **kwargs):
54405440
"""%(quiver_doc)s"""
54415441
# Make sure units are handled for x and y values
@@ -5447,7 +5447,7 @@ def quiver(self, *args, **kwargs):
54475447

54485448
# args can be some combination of X, Y, U, V, C and all should be replaced
54495449
@_preprocess_data()
5450-
@_docstring.dedent_interpd
5450+
@_docstring.interpd
54515451
def barbs(self, *args, **kwargs):
54525452
"""%(barbs_doc)s"""
54535453
# Make sure units are handled for x and y values
@@ -5718,7 +5718,7 @@ def fill_between(self, x, y1, y2=0, where=None, interpolate=False,
57185718
dir="horizontal", ind="x", dep="y"
57195719
)
57205720
fill_between = _preprocess_data(
5721-
_docstring.dedent_interpd(fill_between),
5721+
_docstring.interpd(fill_between),
57225722
replace_names=["x", "y1", "y2", "where"])
57235723

57245724
def fill_betweenx(self, y, x1, x2=0, where=None,
@@ -5732,7 +5732,7 @@ def fill_betweenx(self, y, x1, x2=0, where=None,
57325732
dir="vertical", ind="y", dep="x"
57335733
)
57345734
fill_betweenx = _preprocess_data(
5735-
_docstring.dedent_interpd(fill_betweenx),
5735+
_docstring.interpd(fill_betweenx),
57365736
replace_names=["y", "x1", "x2", "where"])
57375737

57385738
#### plotting z(x, y): imshow, pcolor and relatives, contour
@@ -6093,7 +6093,7 @@ def _interp_grid(X):
60936093
return X, Y, C, shading
60946094

60956095
@_preprocess_data()
6096-
@_docstring.dedent_interpd
6096+
@_docstring.interpd
60976097
def pcolor(self, *args, shading=None, alpha=None, norm=None, cmap=None,
60986098
vmin=None, vmax=None, **kwargs):
60996099
r"""
@@ -6310,7 +6310,7 @@ def pcolor(self, *args, shading=None, alpha=None, norm=None, cmap=None,
63106310
return collection
63116311

63126312
@_preprocess_data()
6313-
@_docstring.dedent_interpd
6313+
@_docstring.interpd
63146314
def pcolormesh(self, *args, alpha=None, norm=None, cmap=None, vmin=None,
63156315
vmax=None, shading=None, antialiased=False, **kwargs):
63166316
"""
@@ -6537,7 +6537,7 @@ def pcolormesh(self, *args, alpha=None, norm=None, cmap=None, vmin=None,
65376537
return collection
65386538

65396539
@_preprocess_data()
6540-
@_docstring.dedent_interpd
6540+
@_docstring.interpd
65416541
def pcolorfast(self, *args, alpha=None, norm=None, cmap=None, vmin=None,
65426542
vmax=None, **kwargs):
65436543
"""
@@ -6724,7 +6724,7 @@ def pcolorfast(self, *args, alpha=None, norm=None, cmap=None, vmin=None,
67246724
return ret
67256725

67266726
@_preprocess_data()
6727-
@_docstring.dedent_interpd
6727+
@_docstring.interpd
67286728
def contour(self, *args, **kwargs):
67296729
"""
67306730
Plot contour lines.
@@ -6742,7 +6742,7 @@ def contour(self, *args, **kwargs):
67426742
return contours
67436743

67446744
@_preprocess_data()
6745-
@_docstring.dedent_interpd
6745+
@_docstring.interpd
67466746
def contourf(self, *args, **kwargs):
67476747
"""
67486748
Plot filled contours.
@@ -7374,7 +7374,7 @@ def stairs(self, values, edges=None, *,
73747374

73757375
@_api.make_keyword_only("3.9", "range")
73767376
@_preprocess_data(replace_names=["x", "y", "weights"])
7377-
@_docstring.dedent_interpd
7377+
@_docstring.interpd
73787378
def hist2d(self, x, y, bins=10, range=None, density=False, weights=None,
73797379
cmin=None, cmax=None, **kwargs):
73807380
"""
@@ -7481,7 +7481,7 @@ def hist2d(self, x, y, bins=10, range=None, density=False, weights=None,
74817481
return h, xedges, yedges, pc
74827482

74837483
@_preprocess_data(replace_names=["x", "weights"], label_namer="x")
7484-
@_docstring.dedent_interpd
7484+
@_docstring.interpd
74857485
def ecdf(self, x, weights=None, *, complementary=False,
74867486
orientation="vertical", compress=False, **kwargs):
74877487
"""
@@ -7584,7 +7584,7 @@ def ecdf(self, x, weights=None, *, complementary=False,
75847584

75857585
@_api.make_keyword_only("3.9", "NFFT")
75867586
@_preprocess_data(replace_names=["x"])
7587-
@_docstring.dedent_interpd
7587+
@_docstring.interpd
75887588
def psd(self, x, NFFT=None, Fs=None, Fc=None, detrend=None,
75897589
window=None, noverlap=None, pad_to=None,
75907590
sides=None, scale_by_freq=None, return_line=None, **kwargs):
@@ -7696,7 +7696,7 @@ def psd(self, x, NFFT=None, Fs=None, Fc=None, detrend=None,
76967696

76977697
@_api.make_keyword_only("3.9", "NFFT")
76987698
@_preprocess_data(replace_names=["x", "y"], label_namer="y")
7699-
@_docstring.dedent_interpd
7699+
@_docstring.interpd
77007700
def csd(self, x, y, NFFT=None, Fs=None, Fc=None, detrend=None,
77017701
window=None, noverlap=None, pad_to=None,
77027702
sides=None, scale_by_freq=None, return_line=None, **kwargs):
@@ -7799,7 +7799,7 @@ def csd(self, x, y, NFFT=None, Fs=None, Fc=None, detrend=None,
77997799

78007800
@_api.make_keyword_only("3.9", "Fs")
78017801
@_preprocess_data(replace_names=["x"])
7802-
@_docstring.dedent_interpd
7802+
@_docstring.interpd
78037803
def magnitude_spectrum(self, x, Fs=None, Fc=None, window=None,
78047804
pad_to=None, sides=None, scale=None,
78057805
**kwargs):
@@ -7886,7 +7886,7 @@ def magnitude_spectrum(self, x, Fs=None, Fc=None, window=None,
78867886

78877887
@_api.make_keyword_only("3.9", "Fs")
78887888
@_preprocess_data(replace_names=["x"])
7889-
@_docstring.dedent_interpd
7889+
@_docstring.interpd
78907890
def angle_spectrum(self, x, Fs=None, Fc=None, window=None,
78917891
pad_to=None, sides=None, **kwargs):
78927892
"""
@@ -7956,7 +7956,7 @@ def angle_spectrum(self, x, Fs=None, Fc=None, window=None,
79567956

79577957
@_api.make_keyword_only("3.9", "Fs")
79587958
@_preprocess_data(replace_names=["x"])
7959-
@_docstring.dedent_interpd
7959+
@_docstring.interpd
79607960
def phase_spectrum(self, x, Fs=None, Fc=None, window=None,
79617961
pad_to=None, sides=None, **kwargs):
79627962
"""
@@ -8026,7 +8026,7 @@ def phase_spectrum(self, x, Fs=None, Fc=None, window=None,
80268026

80278027
@_api.make_keyword_only("3.9", "NFFT")
80288028
@_preprocess_data(replace_names=["x", "y"])
8029-
@_docstring.dedent_interpd
8029+
@_docstring.interpd
80308030
def cohere(self, x, y, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none,
80318031
window=mlab.window_hanning, noverlap=0, pad_to=None,
80328032
sides='default', scale_by_freq=None, **kwargs):
@@ -8091,7 +8091,7 @@ def cohere(self, x, y, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none,
80918091

80928092
@_api.make_keyword_only("3.9", "NFFT")
80938093
@_preprocess_data(replace_names=["x"])
8094-
@_docstring.dedent_interpd
8094+
@_docstring.interpd
80958095
def specgram(self, x, NFFT=None, Fs=None, Fc=None, detrend=None,
80968096
window=None, noverlap=None,
80978097
cmap=None, xextent=None, pad_to=None, sides=None,
@@ -8252,7 +8252,7 @@ def specgram(self, x, NFFT=None, Fs=None, Fc=None, detrend=None,
82528252
return spec, freqs, t, im
82538253

82548254
@_api.make_keyword_only("3.9", "precision")
8255-
@_docstring.dedent_interpd
8255+
@_docstring.interpd
82568256
def spy(self, Z, precision=0, marker=None, markersize=None,
82578257
aspect='equal', origin="upper", **kwargs):
82588258
"""

lib/matplotlib/axes/_base.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3242,7 +3242,7 @@ def set_axisbelow(self, b):
32423242
axis.set_zorder(zorder)
32433243
self.stale = True
32443244

3245-
@_docstring.dedent_interpd
3245+
@_docstring.interpd
32463246
def grid(self, visible=None, which='major', axis='both', **kwargs):
32473247
"""
32483248
Configure the grid lines.

0 commit comments

Comments
 (0)