8000 More fixes to pydocstyle D403 (First word capitalization) · matplotlib/matplotlib@2dd1110 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2dd1110

Browse files
committed
More fixes to pydocstyle D403 (First word capitalization)
1 parent 382be60 commit 2dd1110

22 files changed

+75
-83
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
@@ -867,10 +867,10 @@ def set_position(self, pos, which='both'):
867867

868868
def _set_position(self, pos, which='both'):
869869
"""
870-
private version of set_position. Call this internally
871-
to get the same functionality of `get_position`, but not
872-
to take the axis out of the constrained_layout
873-
hierarchy.
870+
Private version of set_position.
871+
872+
Call this internally to get the same functionality of `get_position`,
873+
but not to take the axis out of the constrained_layout hierarchy.
874874
"""
875875
if not isinstance(pos, mtransforms.BboxBase):
876876
pos = mtransforms.Bbox.from_bounds(*pos)
@@ -910,7 +910,7 @@ def get_axes_locator(self):
910910
return self._axes_locator
911911

912912
def _set_artist_props(self, a):
913-
"""set the boilerplate props for artists added to axes"""
913+
"""Set the boilerplate props for artists added to axes."""
914914
a.set_figure(self.figure)
915915
if not a.is_transform_set():
916916
a.set_transform(self.transData)
@@ -1762,11 +1762,11 @@ def get_legend(self):
17621762
return self.legend_
17631763

17641764
def get_images(self):
1765-
"""return a list of Axes images contained by the Axes"""
1765+
"""Return a list of Axes images contained by the Axes."""
17661766
return cbook.silent_list('AxesImage', self.images)
17671767

17681768
def get_lines(self):
1769-
"""Return a list of lines contained by the Axes"""
1769+
"""Return a list of lines contained by the Axes."""
17701770
return cbook.silent_list('Line2D', self.lines)
17711771

17721772
def get_xaxis(self):
@@ -1989,7 +1989,7 @@ def add_patch(self, p):
19891989
return p
19901990

19911991
def _update_patch_limits(self, patch):
1992-
"""update the data limits for patch *p*"""
1992+
"""Update the data limits for the given patch."""
19931993
# hist can add zero height Rectangles, which is useful to keep
19941994
# the bins, counts and patches lined up, but it throws off log
19951995
# 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
@@ -1631,15 +1631,11 @@ def set_orientation(self, orientation=None):
16311631
self.switch_orientation()
16321632

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

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

lib/matplotlib/contour.py

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

12961296
def get_alpha(self):
1297-
"""returns alpha to be applied to all ContourSet artists"""
1297+
"""Return alpha to be applied to all ContourSet artists."""
12981298
return self.alpha
12991299

13001300
def set_alpha(self, alpha):

lib/matplotlib/image.py

Lines changed: 19 additions & 13 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,15 @@ def get_cursor_data(self, event):
12701272

12711273

12721274
class FigureImage(_ImageBase):
1275+
"""
1276+
An image attached to a figure.
1277+
1278+
cmap is a colors.Colormap instance
1279+
norm is a colors.Normalize instance to map luminance to 0-1
1280+
1281+
kwargs are an optional list of Artist keyword args
1282+
"""
1283+
12731284
zorder = 0
12741285

12751286
_interpolation = 'nearest'
@@ -1282,12 +1293,6 @@ def __init__(self, fig,
12821293
origin=None,
12831294
**kwargs
12841295
):
1285-
"""
1286-
cmap is a colors.Colormap instance
1287-
norm is a colors.Normalize instance to map luminance to 0-1
1288-
1289-
kwargs are an optional list of Artist keyword args
1290-
"""
12911296
super().__init__(
12921297
None,
12931298
norm=norm,
@@ -1331,7 +1336,14 @@ def set_data(self, A):
13311336

13321337

13331338
class BboxImage(_ImageBase):
1334-
"""The Image class whose size is determined by the given bbox."""
1339+
"""
1340+
The Image class whose size is determined by the given bbox.
1341+
1342+
cmap is a colors.Colormap instance
1343+
norm is a colors.Normalize instance to map luminance to 0-1
1344+
1345+
kwargs are an optional list of Artist keyword args
1346+
"""
13351347

13361348
def __init__(self, bbox,
13371349
cmap=None,
@@ -1343,12 +1355,6 @@ def __init__(self, bbox,
13431355
resample=False,
13441356
**kwargs
13451357
):
1346-
"""
1347-
cmap is a colors.Colormap instance
1348-
norm is a colors.Normalize instance to map luminance to 0-1
1349-
1350-
kwargs are an optional list of Artist keyword args
1351-
"""
13521358
super().__init__(
13531359
None,
13541360
cmap=cmap,

lib/matplotlib/tests/test_axes.py

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

17011701

17021702
def test_bar_timedelta():
1703-
"""smoketest that bar can handle width and height in delta units"""
1703+
"""Smoketest that bar can handle width and height in delta units."""
17041704
fig, ax = plt.subplots()
17051705
ax.bar(datetime.datetime(2018, 1, 1), 1.,
17061706
width=datetime.timedelta(hours=3))
10000

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( 10000 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:
@@ -1380,18 +1380,18 @@ def __init__(self, canvas, axes, useblit=True, horizOn=False, vertOn=True,
13801380
self.connect()
13811381

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

13881388
def disconnect(self):
1389-
"""disconnect events"""
1389+
"""Disconnect events."""
13901390
self.canvas.mpl_disconnect(self._cidmotion)
13911391
self.canvas.mpl_disconnect(self._ciddraw)
13921392

13931393
def clear(self, event):
1394-
"""clear the cursor"""
1394+
"""Clear the cursor."""
13951395
if self.ignore(event):
13961396
return
13971397
if self.useblit:
@@ -1471,7 +1471,7 @@ def set_active(self, active):
14711471
self.update_background(None)
14721472

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

0 commit comments

Comments
 (0)
0