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

Skip to content

Commit 54b4263

Browse files
authored
Merge pull request #16873 from timhoffm/pydocstyle-D403
More fixes to pydocstyle D403 (First word capitalization)
2 parents ad76c83 + 4cc2b71 commit 54b4263

22 files changed

+60
-80
lines changed

lib/matplotlib/artist.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -786,7 +786,7 @@ def set_clip_path(self, path, transform=None):
786786
def get_alpha(self):
787787
"""
788788
Return the alpha value used for blending - not supported on all
789-
backends
789+
backends.
790790
"""
791791
return self._alpha
792792

lib/matplotlib/axes/_axes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3327,8 +3327,8 @@ def errorbar(self, x, y, yerr=None, xerr=None,
33273327

33283328
def xywhere(xs, ys, mask):
33293329
"""
3330-
return xs[mask], ys[mask] where mask is True but xs and
3331-
ys are not arrays
3330+
Return xs[mask], ys[mask] where mask is True but xs and
3331+
ys are not arrays.
33323332
"""
33333333
assert len(xs) == len(ys)
33343334
assert len(xs) == len(mask)

lib/matplotlib/axes/_base.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -865,10 +865,10 @@ def set_position(self, pos, which='both'):
865865

866866
def _set_position(self, pos, which='both'):
867867
"""
868-
private version of set_position. Call this internally
869-
to get the same functionality of `get_position`, but not
870-
to take the axis out of the constrained_layout
871-
hierarchy.
868+
Private version of set_position.
869+
870+
Call this internally to get the same functionality of `get_position`,
871+
but not to take the axis out of the constrained_layout hierarchy.
872872
"""
873873
if not isinstance(pos, mtransforms.BboxBase):
874874
pos = mtransforms.Bbox.from_bounds(*pos)
@@ -908,7 +908,7 @@ def get_axes_locator(self):
908908
return self._axes_locator
909909

910910
def _set_artist_props(self, a):
911-
"""set the boilerplate props for artists added to axes"""
911+
"""Set the boilerplate props for artists added to axes."""
912912
a.set_figure(self.figure)
913913
if not a.is_transform_set():
914914
a.set_transform(self.transData)
@@ -1750,11 +1750,11 @@ def get_legend(self):
17501750
return self.legend_
17511751

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

17561756
def get_lines(self):
1757-
"""Return a list of lines contained by the Axes"""
1757+
"""Return a list of lines contained by the Axes."""
17581758
return cbook.silent_list('Line2D', self.lines)
17591759

17601760
def get_xaxis(self):
@@ -1978,7 +1978,7 @@ def add_patch(self, p):
19781978
return p
19791979

19801980
def _update_patch_limits(self, patch):
1981-
"""update the data limits for patch *p*"""
1981+
"""Update the data limits for the given patch."""
19821982
# hist can add zero height Rectangles, which is useful to keep
19831983
# the bins, counts and patches lined up, but it throws off log
19841984
# scaling. We'll ignore rects with zero height or width in

lib/matplotlib/axes/_subplots.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,19 +78,19 @@ def change_geometry(self, numrows, numcols, num):
7878
self.set_position(self.figbox)
7979

8080
def get_subplotspec(self):
81-
"""get the SubplotSpec instance associated with the subplot"""
81+
"""Return the SubplotSpec instance associated with the subplot."""
8282
return self._subplotspec
8383

8484
def set_subplotspec(self, subplotspec):
85-
"""set the SubplotSpec instance associated with the subplot"""
85+
"""Set the SubplotSpec instance associated with the subplot."""
8686
self._subplotspec = subplotspec
8787

8888
def get_gridspec(self):
89-
"""get the GridSpec instance associated with the subplot"""
89+
"""Return the GridSpec instance associated with the subplot."""
9090
return self._subplotspec.get_gridspec()
9191

9292
def update_params(self):
93-
"""update the subplot position from fig.subplotpars"""
93+
"""Update the subplot position from ``self.figure.subplotpars``."""
9494
self.figbox, _, _, self.numRows, self.numCols = \
9595
self.get_subplotspec().get_position(self.figure,
9696
return_all=True)

lib/matplotlib/backend_bases.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -753,8 +753,8 @@ def restore(self):
753753

754754
def get_alpha(self):
755755
"""
756-
Return the alpha value used for blending - not supported on
757-
all backends.
756+
Return the alpha value used for blending - not supported on all
757+
backends.
758758
"""
759759
return self._alpha
760760

lib/matplotlib/backends/backend_ps.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1214,7 +1214,7 @@ def xpdf_distill(tmpfile, eps=False, ptype='letter', bbox=None, rotated=False):
12141214

12151215
def get_bbox_header(lbrt, rotated=False):
12161216
"""
1217-
return a postscript header string for the given bbox lbrt=(l, b, r, t).
1217+
Return a postscript header string for the given bbox lbrt=(l, b, r, t).
12181218
Optionally, return rotate command.
12191219
"""
12201220

lib/matplotlib/backends/backend_wx.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ def set_joinstyle(self, js):
417417
self.unselect()
418418

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

14081408

14091409
class StatusbarWx(StatusbarBase, wx.StatusBar):
1410-
"""for use with ToolManager"""
1410+
"""For use with ToolManager."""
14111411
def __init__(self, parent, *args, **kwargs):
14121412
StatusbarBase.__init__(self, *args, **kwargs)
14131413
wx.StatusBar.__init__(self, parent, -1)

lib/matplotlib/collections.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1630,15 +1630,11 @@ def set_orientation(self, orientation=None):
16301630
self.switch_orientation()
16311631

16321632
def get_linelength(self):
1633-
"""
1634-
get the length of the lines used to mark each event
1635-
"""
1633+
"""Return the length of the lines used to mark each event."""
16361634
return self._linelength
16371635

16381636
def set_linelength(self, linelength):
1639-
"""
1640-
set the length of the lines used to mark each event
1641-
"""
1637+
"""Set the length of the lines used to mark each event."""
16421638
if linelength == self.get_linelength():
16431639
return
16441640
lineoffset = self.get_lineoffset()

lib/matplotlib/contour.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1295,7 +1295,7 @@ def _process_linestyles(self):
12951295
return tlinestyles
12961296

12971297
def get_alpha(self):
1298-
"""returns alpha to be applied to all ContourSet artists"""
1298+
"""Return alpha to be applied to all ContourSet artists."""
12991299
return self.alpha
13001300

13011301
def set_alpha(self, alpha):

lib/matplotlib/image.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -819,6 +819,8 @@ def get_filterrad(self):
819819

820820
class AxesImage(_ImageBase):
821821
"""
822+
An image attached to an Axes.
823+
822824
Parameters
823825
----------
824826
ax : `~.axes.Axes`
@@ -1270,6 +1272,8 @@ def get_cursor_data(self, event):
12701272

12711273

12721274
class FigureImage(_ImageBase):
1275+
"""An image attached to a figure."""
1276+
12731277
zorder = 0
12741278

12751279
_interpolation = 'nearest'

lib/matplotlib/tests/test_axes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1703,7 +1703,7 @@ def test_barh_tick_label():
17031703

17041704

17051705
def test_bar_timedelta():
1706-
"""smoketest that bar can handle width and height in delta units"""
1706+
"""Smoketest that bar can handle width and height in delta units."""
17071707
fig, ax = plt.subplots()
17081708
ax.bar(datetime.datetime(2018, 1, 1), 1.,
17091709
width=datetime.timedelta(hours=3))

lib/matplotlib/tests/test_image.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1073,7 +1073,7 @@ def test_image_cursor_formatting():
10731073

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

lib/matplotlib/tests/test_legend.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ def test_warn_args_kwargs(self):
356356

357357
@image_comparison(['legend_stackplot.png'])
358358
def test_legend_stackplot():
359-
"""test legend for PolyCollection using stackplot"""
359+
"""Test legend for PolyCollection using stackplot."""
360360
# related to #1341, #1943, and PR #3303
361361
fig = plt.figure()
362362
ax = fig.add_subplot(111)

lib/matplotlib/tests/test_preprocess_data.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def plot_func(ax, x, y, ls="x", label=None, w="xyz"):
2424

2525

2626
def test_compiletime_checks():
27-
"""test decorator invocations -> no replacements"""
27+
"""Test decorator invocations -> no replacements."""
2828

2929
def func(ax, x, y): pass
3030
def func_args(ax, x, y, *args): pass
@@ -58,7 +58,7 @@ def func_no_ax_args(*args, **kwargs): pass
5858

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

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

132132

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

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

158158

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

162162
@_preprocess_data(replace_names=["x", "y"], label_namer=None)
163163
def func_no_label(ax, x, y, ls="x", label=None, w="xyz"):

lib/matplotlib/widgets.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ def on_clicked(self, func):
649649
return cid
650650

651651
def disconnect(self, cid):
652-
"""remove the observer with connection id *cid*"""
652+
"""Remove the observer with connection id *cid*."""
653653
try:
654654
del self.observers[cid]
655655
except KeyError:
@@ -1378,18 +1378,18 @@ def __init__(self, canvas, axes, useblit=True, horizOn=False, vertOn=True,
13781378
self.connect()
13791379

13801380
def connect(self):
1381-
"""connect events"""
1381+
"""Connect events."""
13821382
self._cidmotion = self.canvas.mpl_connect('motion_notify_event',
13831383
self.onmove)
13841384
self._ciddraw = self.canvas.mpl_connect('draw_event', self.clear)
13851385

13861386
def disconnect(self):
1387-
"""disconnect events"""
1387+
"""Disconnect events."""
13881388
self.canvas.mpl_disconnect(self._cidmotion)
13891389
self.canvas.mpl_disconnect(self._ciddraw)
13901390

13911391
def clear(self, event):
1392-
"""clear the cursor"""
1392+
"""Clear the cursor."""
13931393
if self.ignore(event):
13941394
return
13951395
if self.useblit:
@@ -1469,7 +1469,7 @@ def set_active(self, active):
14691469
self.update_background(None)
14701470

14711471
def update_background(self, event):
1472-
"""force an update of the background"""
1472+
"""Force an update of the background."""
14731473
# If you add a call to `ignore` here, you'll want to check edge case:
14741474
# `release` can call a draw event even when `ignore` is True.
14751475
if self.useblit:

lib/mpl_toolkits/axes_grid1/colorbar.py

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,7 @@ def __init__(self, locator=None, extend="neither", orientation="vertical"):
198198
self.orientation = orientation
199199

200200
def get_original_position(self, axes, renderer):
201-
"""
202-
get the original position of the axes.
203-
"""
201+
"""Return the original position of the axes."""
204202
if self._locator is None:
205203
bbox = axes.get_position(original=True)
206204
else:
@@ -209,7 +207,8 @@ def get_original_position(self, axes, renderer):
209207

210208
def get_end_vertices(self):
211209
"""
212-
return a tuple of two vertices for the colorbar extended ends.
210+
Return a tuple of two vertices for the colorbar extended ends.
211+
213212
The first vertices is for the minimum end, and the second is for
214213
the maximum end.
215214
"""
@@ -246,24 +245,18 @@ def get_end_vertices(self):
246245
return bottom, top
247246

248247
def get_path_patch(self):
249-
"""
250-
get the path for axes patch
251-
"""
248+
"""Return the path for axes patch."""
252249
end1, end2 = self.get_end_vertices()
253250
verts = [] + end1 + end2 + end1[:1]
254251
return Path(verts)
255252

256253
def get_path_ends(self):
257-
"""
258-
get the paths for extended ends
259-
"""
254+
"""Return the paths for extended ends."""
260255
end1, end2 = self.get_end_vertices()
261256
return Path(end1), Path(end2)
262257

263258
def __call__(self, axes, renderer):
264-
"""
265-
Return the adjusted position of the axes
266-
"""
259+
"""Return the adjusted position of the axes."""
267260
bbox0 = self.get_original_position(axes, renderer)
268261
bbox = bbox0
269262

@@ -490,9 +483,7 @@ def _add_ends(self):
490483
self.ax.add_artist(self.extension_patch2)
491484

492485
def _set_label_text(self):
493-
"""
494-
set label.
495-
"""
486+
"""Set the colorbar label."""
496487
self.cbar_axis.set_label_text(self._label, **self._labelkw)
497488

498489
def set_label_text(self, label, **kw):
@@ -657,9 +648,7 @@ def _mesh(self):
657648
return X, Y
658649

659650
def set_alpha(self, alpha):
660-
"""
661-
set alpha value.
662-
"""
651+
"""Set the alpha value for transparency."""
663652
self.alpha = alpha
664653

665654

lib/mpl_toolkits/axisartist/angle_helper.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -331,12 +331,7 @@ def __init__(self, nx, ny,
331331
self.lat_minmax = lat_minmax
332332

333333
def __call__(self, transform_xy, x1, y1, x2, y2):
334-
"""
335-
get extreme values.
336-
337-
x1, y1, x2, y2 in image coordinates (0-based)
338-
nx, ny : number of divisions in each axis
339-
"""
334+
# docstring inherited
340335
x_, y_ = np.linspace(x1, x2, self.nx), np.linspace(y1, y2, self.ny)
341336
x, y = np.meshgrid(x_, y_)
342337
lon, lat = transform_xy(np.ravel(x), np.ravel(y))

lib/mpl_toolkits/axisartist/axislines.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ def get_axislabel_transform(self, axes):
158158

159159
def get_axislabel_pos_angle(self, axes):
160160
"""
161-
label reference position in transAxes.
161+
Return the label reference position in transAxes.
162162
163163
get_label_transform() returns a transform of (transAxes+offset)
164164
"""
@@ -263,7 +263,7 @@ def get_axislabel_transform(self, axes):
263263

264264
def get_axislabel_pos_angle(self, axes):
265265
"""
266-
label reference position in transAxes.
266+
Return the label reference position in transAxes.
267267
268268
get_label_transform() returns a transform of (transAxes+offset)
269269
"""
@@ -418,7 +418,7 @@ def new_floating_axis(self, nth_coord, value,
418418

419419
def get_gridlines(self, which="major", axis="both"):
420420
"""
421-
return list of gridline coordinates in data coordinates.
421+
Return list of gridline coordinates in data coordinates.
422422
423423
*which* : "major" or "minor"
424424
*axis* : "both", "x" or "y"

0 commit comments

Comments
 (0)