8000 More fixes to pydocstyle D403 (First word capitalization) by timhoffm · Pull Request #16873 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

More fixes to pydocstyle D403 (First word capitalization) #16873

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
Mar 26, 2020
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/artist.py
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,7 @@ def set_clip_path(self, path, transform=None):
def get_alpha(self):
"""
Return the alpha value used for blending - not supported on all
backends
backends.
"""
return self._alpha

Expand Down
4 changes: 2 additions & 2 deletions lib/matplotlib/axes/_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -3327,8 +3327,8 @@ def errorbar(self, x, y, yerr=None, xerr=None,

def xywhere(xs, ys, mask):
"""
return xs[mask], ys[mask] where mask is True but xs and
ys are not arrays
Return xs[mask], ys[mask] where mask is True but xs and
ys are not arrays.
"""
assert len(xs) == len(ys)
assert len(xs) == len(mask)
Expand Down
16 changes: 8 additions & 8 deletions lib/matplotlib/axes/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -867,10 +867,10 @@ def set_position(self, pos, which='both'):

def _set_position(self, pos, which='both'):
"""
private version of set_position. Call this internally
to get the same functionality of `get_position`, but not
to take the axis out of the constrained_layout
hierarchy.
Private version of set_position.

Call this internally to get the same functionality of `get_position`,
but not to take the axis out of the constrained_layout hierarchy.
"""
if not isinstance(pos, mtransforms.BboxBase):
pos = mtransforms.Bbox.from_bounds(*pos)
Expand Down Expand Up @@ -910,7 +910,7 @@ def get_axes_locator(self):
return self._axes_locator

def _set_artist_props(self, a):
"""set the boilerplate props for artists added to axes"""
"""Set the boilerplate props for artists added to axes."""
a.set_figure(self.figure)
if not a.is_transform_set():
a.set_transform(self.transData)
Expand Down Expand Up @@ -1762,11 +1762,11 @@ def get_legend(self):
return self.legend_

def get_images(self):
"""return a list of Axes images contained by the Axes"""
r"""Return a list of `.AxesImage`\s contained by the Axes."""
return cbook.silent_list('AxesImage', self.images)

def get_lines(self):
"""Return a list of lines contained by the Axes"""
"""Return a list of lines contained by the Axes."""
return cbook.silent_list('Line2D', self.lines)

def get_xaxis(self):
Expand Down Expand Up @@ -1989,7 +1989,7 @@ def add_patch(self, p):
return p

def _update_patch_limits(self, patch):
"""update the data limits for patch *p*"""
"""Update the data limits for the given patch."""
# hist can add zero height Rectangles, which is useful to keep
# the bins, counts and patches lined up, but it throws off log
# scaling. We'll ignore rects with zero height or width in
Expand Down
8 changes: 4 additions & 4 deletions lib/matplotlib/axes/_subplots.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,19 +78,19 @@ def change_geometry(self, numrows, numcols, num):
self.set_position(self.figbox)

def get_subplotspec(self):
"""get the SubplotSpec instance associated with the subplot"""
"""Return the SubplotSpec instance associated with the subplot."""
return self._subplotspec

def set_subplotspec(self, subplotspec):
"""set the SubplotSpec instance associated with the subplot"""
"""Set the SubplotSpec instance associated with the subplot."""
self._subplotspec = subplotspec

def get_gridspec(self):
"""get the GridSpec instance associated with the subplot"""
"""Return the GridSpec instance associated with the subplot."""
return self._subplotspec.get_gridspec()

def update_params(self):
"""update the subplot position from fig.subplotpars"""
"""Update the subplot position from ``self.figure.subplotpars``."""
self.figbox, _, _, self.numRows, self.numCols = \
self.get_subplotspec().get_position(self.figure,
return_all=True)
Expand Down
4 changes: 2 additions & 2 deletions lib/matplotlib/backend_bases.py
Original file line number Diff line number Diff line change
Expand Up @@ -753,8 +753,8 @@ def restore(self):

def get_alpha(self):
"""
Return the alpha value used for blending - not supported on
all backends.
Return the alpha value used for blending - not supported on all
backends.
"""
return self._alpha

Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/backends/backend_ps.py
Original file line number Diff line number Diff line change
Expand Up @@ -1214,7 +1214,7 @@ def xpdf_distill(tmpfile, eps=False, ptype='letter', bbox=None, rotated=False):

def get_bbox_header(lbrt, rotated=False):
"""
return a postscript header string for the given bbox lbrt=(l, b, r, t).
Return a postscript header string for the given bbox lbrt=(l, b, r, t).
Optionally, return rotate command.
"""

Expand Down
4 changes: 2 additions & 2 deletions lib/matplotlib/backends/backend_wx.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ def set_joinstyle(self, js):
self.unselect()

def get_wxcolour(self, color):
"""return a wx.Colour from RGB format"""
"""Convert the given RGB(A) color to a wx.Colour."""
_log.debug("%s - get_wx_color()", type(self))
if len(color) == 3:
r, g, b = color
Expand Down Expand Up @@ -1407,7 +1407,7 @@ def remove_toolitem(self, name):


class StatusbarWx(StatusbarBase, wx.StatusBar):
"""for use with ToolManager"""
"""For use with ToolManager."""
def __init__(self, parent, *args, **kwargs):
StatusbarBase.__init__(self, *args, **kwargs)
wx.StatusBar.__init__(self, parent, -1)
Expand Down
8 changes: 2 additions & 6 deletions lib/matplotlib/collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -1631,15 +1631,11 @@ def set_orientation(self, orientation=None):
self.switch_orientation()

def get_linelength(self):
"""
get the length of the lines used to mark each event
"""
"""Return the length of the lines used to mark each event."""
return self._linelength

def set_linelength(self, linelength):
"""
set the length of the lines used to mark each event
"""
"""Set the length of the lines used to mark each event."""
if linelength == self.get_linelength():
return
lineoffset = self.get_lineoffset()
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/contour.py
Original file line number Diff line number Diff line change
Expand Up @@ -1294,7 +1294,7 @@ def _process_linestyles(self):
return tlinestyles

def get_alpha(self):
"""returns alpha to be applied to all ContourSet artists"""
"""Return alpha to be applied to all ContourSet artists."""
return self.alpha

def set_alpha(self, alpha):
Expand Down
4 changes: 4 additions & 0 deletions lib/matplotlib/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -819,6 +819,8 @@ def get_filterrad(self):

class AxesImage(_ImageBase):
"""
An image attached to an Axes.

Parameters
----------
ax : `~.axes.Axes`
Expand Down Expand Up @@ -1270,6 +1272,8 @@ def get_cursor_data(self, event):


class FigureImage(_ImageBase):
"""An image attached to a figure."""

zorder = 0

_interpolation = 'nearest'
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/tests/test_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1700,7 +1700,7 @@ def test_barh_tick_label():


def test_bar_timedelta():
"""smoketest that bar can handle width and height in delta units"""
"""Smoketest that bar can handle width and height in delta units."""
fig, ax = plt.subplots()
ax.bar(datetime.datetime(2018, 1, 1), 1.,
width=datetime.timedelta(hours=3))
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/tests/test_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -1073,7 +1073,7 @@ def test_image_cursor_formatting():

@check_figures_equal()
def test_image_array_alpha(fig_test, fig_ref):
"""per-pixel alpha channel test"""
"""Per-pixel alpha channel test."""
x = np.linspace(0, 1)
xx, yy = np.meshgrid(x, x)

Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/tests/test_legend.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ def test_warn_args_kwargs(self):

@image_comparison(['legend_stackplot.png'])
def test_legend_stackplot():
"""test legend for PolyCollection using stackplot"""
"""Test legend for PolyCollection using stackplot."""
# related to #1341, #1943, and PR #3303
fig = plt.figure()
ax = fig.add_subplot(111)
Expand Down
10 changes: 5 additions & 5 deletions lib/matplotlib/tests/test_preprocess_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def plot_func(ax, x, y, ls="x", label=None, w="xyz"):


def test_compiletime_checks():
"""test decorator invocations -> no replacements"""
"""Test decorator invocations -> no replacements."""

def func(ax, x, y): pass
def func_args(ax, x, y, *args): pass
Expand Down Expand Up @@ -58,7 +58,7 @@ def func_no_ax_args(*args, **kwargs): pass

@pytest.mark.parametrize('func', all_funcs, ids=all_func_ids)
def test_function_call_without_data(func):
"""test without data -> no replacements"""
"""Test without data -> no replacements."""
assert (func(None, "x", "y") ==
"x: ['x'], y: ['y'], ls: x, w: xyz, label: None")
assert (func(None, x="x", y="y") ==
Expand Down Expand Up @@ -93,7 +93,7 @@ def test_function_call_with_dict_data(func):

@pytest.mark.parametrize('func', all_funcs, ids=all_func_ids)
def test_function_call_with_dict_data_not_in_data(func):
"""test the case that one var is not in data -> half replaces, half kept"""
"""Test the case that one var is not in data -> half replaces, half kept"""
data = {"a": [1, 2], "w": "NOT"}
assert (func(None, "a", "b", data=data) ==
"x: [1, 2], y: ['b'], ls: x, w: xyz, label: b")
Expand Down Expand Up @@ -131,7 +131,7 @@ def test_function_call_with_pandas_data(func, pd):


def test_function_call_replace_all():
"""Test without a "replace_names" argument, all vars should be replaced"""
"""Test without a "replace_names" argument, all vars should be replaced."""
data = {"a": [1, 2], "b": [8, 9], "x": "xyz"}

@_preprocess_data(label_namer="y")
Expand All @@ -157,7 +157,7 @@ def func_replace_all(ax, x, y, ls="x", label=None, w="NOT"):


def test_no_label_replacements():
"""Test with "label_namer=None" -> no label replacement at all"""
"""Test with "label_namer=None" -> no label replacement at all."""

@_preprocess_data(replace_names=["x", "y"], label_namer=None)
def func_no_label(ax, x, y, ls="x", label=None, w="xyz"):
Expand Down
10 changes: 5 additions & 5 deletions lib/matplotlib/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ def on_clicked(self, func):
return cid

def disconnect(self, cid):
"""remove the observer with connection id *cid*"""
"""Remove the observer with connection id *cid*."""
try:
del self.observers[cid]
except KeyError:
Expand Down Expand Up @@ -1380,18 +1380,18 @@ def __init__(self, canvas, axes, useblit=True, horizOn=False, vertOn=True,
self.connect()

def connect(self):
"""connect events"""
"""Connect events."""
self._cidmotion = self.canvas.mpl_connect('motion_notify_event',
self.onmove)
self._ciddraw = self.canvas.mpl_connect('draw_event', self.clear)

def disconnect(self):
"""disconnect events"""
"""Disconnect events."""
self.canvas.mpl_disconnect(self._cidmotion)
self.canvas.mpl_disconnect(self._ciddraw)

def clear(self, event):
"""clear the cursor"""
"""Clear the cursor."""
if self.ignore(event):
return
if self.useblit:
Expand Down Expand Up @@ -1471,7 +1471,7 @@ def set_active(self, active):
self.update_background(None)

def update_background(self, event):
"""force an update of the background"""
"""Force an update of the background."""
# If you add a call to `ignore` here, you'll want to check edge case:
# `release` can call a draw event even when `ignore` is True.
if self.useblit:
Expand Down
27 changes: 8 additions & 19 deletions lib/mpl_toolkits/axes_grid1/colorbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,7 @@ def __init__(self, locator=None, extend="neither", orientation="vertical"):
self.orientation = orientation

def get_original_position(self, axes, renderer):
"""
get the original position of the axes.
"""
"""Return the original position of the axes."""
if self._locator is None:
bbox = axes.get_position(original=True)
else:
Expand All @@ -209,7 +207,8 @@ def get_original_position(self, axes, renderer):

def get_end_vertices(self):
"""
return a tuple of two vertices for the colorbar extended ends.
Return a tuple of two vertices for the colorbar extended ends.

The first vertices is for the minimum end, and the second is for
the maximum end.
"""
Expand Down Expand Up @@ -246,24 +245,18 @@ def get_end_vertices(self):
return bottom, top

def get_path_patch(self):
"""
get the path for axes patch
"""
"""Return the path for axes patch."""
end1, end2 = self.get_end_vertices()
verts = [] + end1 + end2 + end1[:1]
return Path(verts)

def get_path_ends(self):
"""
get the paths for extended ends
"""
"""Return the paths for extended ends."""
end1, end2 = self.get_end_vertices()
return Path(end1), Path(end2)

def __call__(self, axes, renderer):
"""
Return the adjusted position of the axes
"""
"""Return the adjusted position of the axes."""
bbox0 = self.get_original_position(axes, renderer)
bbox = bbox0

Expand Down Expand Up @@ -490,9 +483,7 @@ def _add_ends(self):
self.ax.add_artist(self.extension_patch2)

def _set_label_text(self):
"""
set label.
"""
"""Set the colorbar label."""
self.cbar_axis.set_label_text(self._label, **self._labelkw)

def set_label_text(self, label, **kw):
Expand Down Expand Up @@ -657,9 +648,7 @@ def _mesh(self):
return X, Y

def set_alpha(self, alpha):
"""
set alpha value.
"""
"""Set the alpha value for transparency."""
self.alpha = alpha


Expand Down
7 changes: 1 addition & 6 deletions lib/mpl_toolkits/axisartist/angle_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,12 +347,7 @@ def __init__(self, nx, ny,
self.lat_minmax = lat_minmax

def __call__(self, transform_xy, x1, y1, x2, y2):
"""
get extreme values.

x1, y1, x2, y2 in image coordinates (0-based)
nx, ny : number of divisions in each axis
"""
# docstring inherited
x_, y_ = np.linspace(x1, x2, self.nx), np.linspace(y1, y2, self.ny)
x, y = np.meshgrid(x_, y_)
lon, lat = transform_xy(np.ravel(x), np.ravel(y))
Expand Down
6 changes: 3 additions & 3 deletions lib/mpl_toolkits/axisartist/axislines.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def get_axislabel_transform(self, axes):

def get_axislabel_pos_angle(self, axes):
"""
label reference position in transAxes.
Return the label reference position in transAxes.

get_label_transform() returns a transform of (transAxes+offset)
"""
Expand Down Expand Up @@ -263,7 +263,7 @@ def get_axislabel_transform(self, axes):

def get_axislabel_pos_angle(self, axes):
"""
label reference position in transAxes.
Return the label reference position in transAxes.

get_label_transform() returns a transform of (transAxes+offset)
"""
Expand Down Expand Up @@ -418,7 +418,7 @@ def new_floating_axis(self, nth_coord, value,

def get_gridlines(self, which="major", axis="both"):
"""
return list of gridline coordinates in data coordinates.
Return list of gridline coordinates in data coordinates.

*which* : "major" or "minor"
*axis* : "both", "x" or "y"
Expand Down
Loading
0