Thanks to visit codestin.com
Credit goes to github.com

Skip to content

MNT: Replace _docstring.dedent_interpd by its alias _docstring.interpd #28826

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 1 commit into from
Sep 17, 2024
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
2 changes: 1 addition & 1 deletion lib/matplotlib/_docstring.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,4 @@ def do_copy(target):

# Create a decorator that will house the various docstring snippets reused
# throughout Matplotlib.
dedent_interpd = interpd = _ArtistPropertiesSubstitution()
interpd = _ArtistPropertiesSubstitution()
84 changes: 42 additions & 42 deletions lib/matplotlib/axes/_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ def get_legend_handles_labels(self, legend_handler_map=None):
[self], legend_handler_map)
return handles, labels

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

return inset_ax

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

@_docstring.dedent_interpd
@_docstring.interpd
def secondary_xaxis(self, location, functions=None, *, transform=None, **kwargs):
"""
Add a second x-axis to this `~.axes.Axes`.
Expand Down Expand Up @@ -626,7 +626,7 @@ def invert(x):
self.add_child_axes(secondary_ax)
return secondary_ax

@_docstring.dedent_interpd
@_docstring.interpd
def secondary_yaxis(self, location, functions=None, *, transform=None, **kwargs):
"""
Add a second y-axis to this `~.axes.Axes`.
Expand Down Expand Up @@ -670,7 +670,7 @@ def secondary_yaxis(self, location, functions=None, *, transform=None, **kwargs)
self.add_child_axes(secondary_ax)
return secondary_ax

@_docstring.dedent_interpd
@_docstring.interpd
def text(self, x, y, s, fontdict=None, **kwargs):
"""
Add text to the Axes.
Expand Down Expand Up @@ -749,7 +749,7 @@ def text(self, x, y, s, fontdict=None, **kwargs):
self._add_text(t)
return t

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

@_docstring.dedent_interpd
@_docstring.interpd
def axhline(self, y=0, xmin=0, xmax=1, **kwargs):
"""
Add a horizontal line spanning the whole or fraction of the Axes.
Expand Down Expand Up @@ -839,7 +839,7 @@ def axhline(self, y=0, xmin=0, xmax=1, **kwargs):
self._request_autoscale_view("y")
return l

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

@_docstring.dedent_interpd
@_docstring.interpd
def axline(self, xy1, xy2=None, *, slope=None, **kwargs):
"""
Add an infinitely long straight line.
Expand Down Expand Up @@ -995,7 +995,7 @@ def axline(self, xy1, xy2=None, *, slope=None, **kwargs):
self._request_autoscale_view()
return line

@_docstring.dedent_interpd
@_docstring.interpd
def axhspan(self, ymin, ymax, xmin=0, xmax=1, **kwargs):
"""
Add a horizontal span (rectangle) across the Axes.
Expand Down Expand Up @@ -1050,7 +1050,7 @@ def axhspan(self, ymin, ymax, xmin=0, xmax=1, **kwargs):
self._request_autoscale_view("y")
return p

@_docstring.dedent_interpd
@_docstring.interpd
def axvspan(self, xmin, xmax, ymin=0, ymax=1, **kwargs):
"""
Add a vertical span (rectangle) across the Axes.
Expand Down Expand Up @@ -1301,7 +1301,7 @@ def vlines(self, x, ymin, ymax, colors=None, linestyles='solid',
@_preprocess_data(replace_names=["positions", "lineoffsets",
"linelengths", "linewidths",
"colors", "linestyles"])
@_docstring.dedent_interpd
@_docstring.interpd
def eventplot(self, positions, orientation='horizontal', lineoffsets=1,
linelengths=1, linewidths=None, colors=None, alpha=None,
linestyles='solid', **kwargs):
Expand Down Expand Up @@ -1547,7 +1547,7 @@ def eventplot(self, positions, orientation='horizontal', lineoffsets=1,

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

@_api.deprecated("3.9", alternative="plot")
@_preprocess_data(replace_names=["x", "y"], label_namer="y")
@_docstring.dedent_interpd
@_docstring.interpd
def plot_date(self, x, y, fmt='o', tz=None, xdate=True, ydate=False,
**kwargs):
"""
Expand Down Expand Up @@ -1883,7 +1883,7 @@ def plot_date(self, x, y, fmt='o', tz=None, xdate=True, ydate=False,
return self.plot(x, y, fmt, **kwargs)

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

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

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

@_preprocess_data()
@_docstring.dedent_interpd
@_docstring.interpd
def bar(self, x, height, width=0.8, bottom=None, *, align="center",
**kwargs):
r"""
Expand Down Expand Up @@ -2652,7 +2652,7 @@ def bar(self, x, height, width=0.8, bottom=None, *, align="center",
return bar_container

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

@_preprocess_data()
@_docstring.dedent_interpd
@_docstring.interpd
def broken_barh(self, xranges, yrange, **kwargs):
"""
Plot a horizontal sequence of rectangles.
Expand Down Expand Up @@ -3455,7 +3455,7 @@ def _errorevery_to_mask(x, errorevery):
@_api.make_keyword_only("3.9", "ecolor")
@_preprocess_data(replace_names=["x", "y", "xerr", "yerr"],
label_namer="y")
@_docstring.dedent_interpd
@_docstring.interpd
def errorbar(self, x, y, yerr=None, xerr=None,
fmt='', ecolor=None, elinewidth=None, capsize=None,
barsabove=False, lolims=False, uplims=False,
Expand Down Expand Up @@ -4985,7 +4985,7 @@ def scatter(self, x, y, s=None, c=None, marker=None, cmap=None, norm=None,

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

return collection

@_docstring.dedent_interpd
@_docstring.interpd
def arrow(self, x, y, dx, dy, **kwargs):
"""
Add an arrow to the Axes.
Expand Down Expand Up @@ -5435,7 +5435,7 @@ def _quiver_units(self, args, kwargs):

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

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

def fill_betweenx(self, y, x1, x2=0, where=None,
Expand All @@ -5732,7 +5732,7 @@ def fill_betweenx(self, y, x1, x2=0, where=None,
dir="vertical", ind="y", dep="x"
)
fill_betweenx = _preprocess_data(
_docstring.dedent_interpd(fill_betweenx),
_docstring.interpd(fill_betweenx),
replace_names=["y", "x1", "x2", "where"])

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

@_preprocess_data()
@_docstring.dedent_interpd
@_docstring.interpd
def pcolor(self, *args, shading=None, alpha=None, norm=None, cmap=None,
vmin=None, vmax=None, **kwargs):
r"""
Expand Down Expand Up @@ -6310,7 +6310,7 @@ def pcolor(self, *args, shading=None, alpha=None, norm=None, cmap=None,
return collection

@_preprocess_data()
@_docstring.dedent_interpd
@_docstring.interpd
def pcolormesh(self, *args, alpha=None, norm=None, cmap=None, vmin=None,
vmax=None, shading=None, antialiased=False, **kwargs):
"""
Expand Down Expand Up @@ -6537,7 +6537,7 @@ def pcolormesh(self, *args, alpha=None, norm=None, cmap=None, vmin=None,
return collection

@_preprocess_data()
@_docstring.dedent_interpd
@_docstring.interpd
def pcolorfast(self, *args, alpha=None, norm=None, cmap=None, vmin=None,
vmax=None, **kwargs):
"""
Expand Down Expand Up @@ -6724,7 +6724,7 @@ def pcolorfast(self, *args, alpha=None, norm=None, cmap=None, vmin=None,
return ret

@_preprocess_data()
@_docstring.dedent_interpd
@_docstring.interpd
def contour(self, *args, **kwargs):
"""
Plot contour lines.
Expand All @@ -6742,7 +6742,7 @@ def contour(self, *args, **kwargs):
return contours

@_preprocess_data()
@_docstring.dedent_interpd
@_docstring.interpd
def contourf(self, *args, **kwargs):
"""
Plot filled contours.
Expand Down Expand Up @@ -7374,7 +7374,7 @@ def stairs(self, values, edges=None, *,

@_api.make_keyword_only("3.9", "range")
@_preprocess_data(replace_names=["x", "y", "weights"])
@_docstring.dedent_interpd
@_docstring.interpd
def hist2d(self, x, y, bins=10, range=None, density=False, weights=None,
cmin=None, cmax=None, **kwargs):
"""
Expand Down Expand Up @@ -7481,7 +7481,7 @@ def hist2d(self, x, y, bins=10, range=None, density=False, weights=None,
return h, xedges, yedges, pc

@_preprocess_data(replace_names=["x", "weights"], label_namer="x")
@_docstring.dedent_interpd
@_docstring.interpd
def ecdf(self, x, weights=None, *, complementary=False,
orientation="vertical", compress=False, **kwargs):
"""
Expand Down Expand Up @@ -7584,7 +7584,7 @@ def ecdf(self, x, weights=None, *, complementary=False,

@_api.make_keyword_only("3.9", "NFFT")
@_preprocess_data(replace_names=["x"])
@_docstring.dedent_interpd
@_docstring.interpd
def psd(self, x, NFFT=None, Fs=None, Fc=None, detrend=None,
window=None, noverlap=None, pad_to=None,
sides=None, scale_by_freq=None, return_line=None, **kwargs):
Expand Down Expand Up @@ -7696,7 +7696,7 @@ def psd(self, x, NFFT=None, Fs=None, Fc=None, detrend=None,

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

@_api.make_keyword_only("3.9", "Fs")
@_preprocess_data(replace_names=["x"])
@_docstring.dedent_interpd
@_docstring.interpd
def magnitude_spectrum(self, x, Fs=None, Fc=None, window=None,
pad_to=None, sides=None, scale=None,
**kwargs):
Expand Down Expand Up @@ -7886,7 +7886,7 @@ def magnitude_spectrum(self, x, Fs=None, Fc=None, window=None,

@_api.make_keyword_only("3.9", "Fs")
@_preprocess_data(replace_names=["x"])
@_docstring.dedent_interpd
@_docstring.interpd
def angle_spectrum(self, x, Fs=None, Fc=None, window=None,
pad_to=None, sides=None, **kwargs):
"""
Expand Down Expand Up @@ -7956,7 +7956,7 @@ def angle_spectrum(self, x, Fs=None, Fc=None, window=None,

@_api.make_keyword_only("3.9", "Fs")
@_preprocess_data(replace_names=["x"])
@_docstring.dedent_interpd
@_docstring.interpd
def phase_spectrum(self, x, Fs=None, Fc=None, window=None,
pad_to=None, sides=None, **kwargs):
"""
Expand Down Expand Up @@ -8026,7 +8026,7 @@ def phase_spectrum(self, x, Fs=None, Fc=None, window=None,

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

@_api.make_keyword_only("3.9", "NFFT")
@_preprocess_data(replace_names=["x"])
@_docstring.dedent_interpd
@_docstring.interpd
def specgram(self, x, NFFT=None, Fs=None, Fc=None, detrend=None,
window=None, noverlap=None,
cmap=None, xextent=None, pad_to=None, sides=None,
Expand Down Expand Up @@ -8252,7 +8252,7 @@ def specgram(self, x, NFFT=None, Fs=None, Fc=None, detrend=None,
return spec, freqs, t, im

@_api.make_keyword_only("3.9", "precision")
@_docstring.dedent_interpd
@_docstring.interpd
def spy(self, Z, precision=0, marker=None, markersize=None,
aspect='equal', origin="upper", **kwargs):
"""
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/axes/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -3242,7 +3242,7 @@ def set_axisbelow(self, b):
axis.set_zorder(zorder)
self.stale = True

@_docstring.dedent_interpd
@_docstring.interpd
def grid(self, visible=None, which='major', axis='both', **kwargs):
"""
Configure the grid lines.
Expand Down
Loading
Loading