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

Skip to content

Commit e74a8bf

Browse files
committed
Fix some docstring style issues.
1 parent a3bd6ba commit e74a8bf

File tree

14 files changed

+33
-35
lines changed

14 files changed

+33
-35
lines changed

.flake8

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,9 @@ ignore =
1212
N801, N802, N803, N806, N812,
1313
# pydocstyle
1414
D100, D101, D102, D103, D104, D105, D106, D107,
15-
D200, D202, D203, D204, D205, D207, D208, D209,
16-
D210, D211, D212, D213, D214, D215,
17-
D300, D301, D302,
18-
D400, D401, D402, D403, D404, D405, D406, D407, D408, D409,
19-
D410, D411, D412, D413, D414,
15+
D200, D202, D203, D204, D205, D207, D208, D209, D212, D213,
16+
D300, D301
17+
D400, D401, D402, D403, D412, D413,
2018

2119
exclude =
2220
.git

doc/sphinxext/gallery_order.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828

2929
class MplExplicitOrder(ExplicitOrder):
30-
""" for use within the 'subsection_order' key"""
30+
"""For use within the 'subsection_order' key."""
3131
def __call__(self, item):
3232
"""Return a string determining the sort order."""
3333
if item in self.ordered_list:
@@ -65,7 +65,7 @@ def __call__(self, item):
6565

6666

6767
class MplExplicitSubOrder(object):
68-
""" for use within the 'within_subsection_order' key """
68+
"""For use within the 'within_subsection_order' key."""
6969
def __init__(self, src_dir):
7070
self.src_dir = src_dir # src_dir is unused here
7171
self.ordered_list = explicit_subsection_order

lib/matplotlib/__init__.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -705,12 +705,11 @@ def gen_candidates():
705705

706706

707707
class RcParams(MutableMapping, dict):
708-
709708
"""
710-
A dictionary object including validation
709+
A dictionary object including validation.
711710
712-
validating functions are defined and associated with rc parameters in
713-
:mod:`matplotlib.rcsetup`
711+
Validating functions are defined and associated with rc parameters in
712+
:mod:`matplotlib.rcsetup`.
714713
"""
715714

716715
validate = {key: converter

lib/matplotlib/_layoutbox.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,7 @@ def soft_constraints(self):
223223
sol.addConstraint(i | 150000)
224224

225225
def set_parent(self, parent):
226-
''' replace the parent of this with the new parent
227-
'''
226+
"""Replace the parent of this with the new parent."""
228227
self.parent = parent
229228
self.parent_constrain()
230229

@@ -378,14 +377,15 @@ def find_child_subplots(self):
378377

379378
def layout_from_subplotspec(self, subspec,
380379
name='', artist=None, pos=False):
381-
''' Make a layout box from a subplotspec. The layout box is
380+
"""
381+
Make a layout box from a subplotspec. The layout box is
382382
constrained to be a fraction of the width/height of the parent,
383383
and be a fraction of the parent width/height from the left/bottom
384384
of the parent. Therefore the parent can move around and the
385385
layout for the subplot spec should move with it.
386386
387387
The parent is *usually* the gridspec that made the subplotspec.??
388-
'''
388+
"""
389389
lb = LayoutBox(parent=self, name=name, artist=artist, pos=pos)
390390
gs = subspec.get_gridspec()
391391
nrows, ncols = gs.get_geometry()

lib/matplotlib/backends/backend_qt5.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,7 @@ class NavigationToolbar2QT(NavigationToolbar2, QtWidgets.QToolBar):
674674
message = QtCore.Signal(str)
675675

676676
def __init__(self, canvas, parent, coordinates=True):
677-
""" coordinates: should we show the coordinates on the right? """
677+
"""coordinates: should we show the coordinates on the right?"""
678678
self.canvas = canvas
679679
self.parent = parent
680680
self.coordinates = coordinates

lib/matplotlib/backends/backend_wx.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -836,7 +836,7 @@ def _onKeyUp(self, evt):
836836
evt.Skip()
837837

838838
def _set_capture(self, capture=True):
839-
"""control wx mouse capture """
839+
"""Control wx mouse capture."""
840840
if self.HasCapture():
841841
self.ReleaseMouse()
842842
if capture:

lib/matplotlib/bezier.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@ def split_de_casteljau(beta, t):
9898
@cbook._rename_parameter("3.1", "tolerence", "tolerance")
9999
def find_bezier_t_intersecting_with_closedpath(
100100
bezier_point_at_t, inside_closedpath, t0=0., t1=1., tolerance=0.01):
101-
""" Find a parameter t0 and t1 of the given bezier path which
101+
"""
102+
Find a parameter t0 and t1 of the given bezier path which
102103
bounds the intersecting points with a provided closed
103104
path(*inside_closedpath*). Search starts from *t0* and *t1* and it
104105
uses a simple bisecting algorithm therefore one of the end point
@@ -223,8 +224,9 @@ def _f(r):
223224

224225
@cbook._rename_parameter("3.1", "tolerence", "tolerance")
225226
def split_path_inout(path, inside, tolerance=0.01, reorder_inout=False):
226-
""" divide a path into two segment at the point where inside(x, y)
227-
becomes False.
227+
"""
228+
Divide a path into two segments at the point where ``inside(x, y)`` becomes
229+
False.
228230
"""
229231

230232
path_iter = path.iter_segments()
@@ -306,10 +308,9 @@ def get_cos_sin(x0, y0, x1, y1):
306308

307309
@cbook._rename_parameter("3.1", "tolerence", "tolerance")
308310
def check_if_parallel(dx1, dy1, dx2, dy2, tolerance=1.e-5):
309-
""" returns
310-
* 1 if two lines are parallel in same direction
311-
* -1 if two lines are parallel in opposite direction
312-
* 0 otherwise
311+
"""
312+
Return 1 if two lines are parallel in same direction, -1 if two lines are
313+
parallel in opposite direction, 0 otherwise.
313314
"""
314315
theta1 = np.arctan2(dx1, dy1)
315316
theta2 = np.arctan2(dx2, dy2)

lib/matplotlib/dates.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ class strpdate2num(object):
321321
you know the date format string of the date you are parsing.
322322
"""
323323
def __init__(self, fmt):
324-
""" fmt: any valid strptime format is supported """
324+
"""fmt: any valid strptime format is supported"""
325325
self.fmt = fmt
326326

327327
def __call__(self, s):

lib/matplotlib/tests/test_axes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3572,7 +3572,7 @@ def test_empty_eventplot():
35723572
([[]], [[], [0, 1]], [[0, 1], []]),
35733573
('_empty', 'vertical', 'horizontal', None, 'none')))
35743574
def test_eventplot_orientation(data, orientation):
3575-
"""Introduced when fixing issue #6412. """
3575+
"""Introduced when fixing issue #6412."""
35763576
opts = {} if orientation == "_empty" else {'orientation': orientation}
35773577
fig, ax = plt.subplots(1, 1)
35783578
ax.eventplot(data, **opts)
@@ -5581,7 +5581,7 @@ def test_broken_barh_empty():
55815581

55825582

55835583
def test_broken_barh_timedelta():
5584-
"""Check that timedelta works as x, dx pair for this method """
5584+
"""Check that timedelta works as x, dx pair for this method."""
55855585
fig, ax = plt.subplots()
55865586
pp = ax.broken_barh([(datetime.datetime(2018, 11, 9, 0, 0, 0),
55875587
datetime.timedelta(hours=1))], [1, 2])

lib/matplotlib/tests/test_constrainedlayout.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ def test_constrained_layout10():
184184
@image_comparison(baseline_images=['constrained_layout11'],
185185
extensions=['png'])
186186
def test_constrained_layout11():
187-
'Test for multiple nested gridspecs '
187+
'Test for multiple nested gridspecs'
188188
fig = plt.figure(constrained_layout=True, figsize=(10, 3))
189189
gs0 = gridspec.GridSpec(1, 2, figure=fig)
190190
gsl = gridspec.GridSpecFromSubplotSpec(1, 2, gs0[0])

lib/matplotlib/tests/test_mlab.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1383,7 +1383,7 @@ def test_csd(self):
13831383
assert spec.shape == freqs.shape
13841384

13851385
def test_csd_padding(self):
1386-
"""Test zero padding of csd(). """
1386+
"""Test zero padding of csd()."""
13871387
if self.NFFT_density is None: # for derived classes
13881388
return
13891389
sargs = dict(x=self.y, y=self.y+1, Fs=self.Fs, window=mlab.window_none,

lib/matplotlib/tests/test_preprocess_data.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def test_function_call_without_data(func):
7575

7676
@pytest.mark.parametrize('func', all_funcs, ids=all_func_ids)
7777
def test_function_call_with_dict_data(func):
78-
"""Test with dict data -> label comes from the value of 'x' parameter """
78+
"""Test with dict data -> label comes from the value of 'x' parameter."""
7979
data = {"a": [1, 2], "b": [8, 9], "w": "NOT"}
8080
assert (func(None, "a", "b", data=data) ==
8181
"x: [1, 2], y: [8, 9], ls: x, w: xyz, label: b")
@@ -111,7 +111,7 @@ def test_function_call_with_dict_data_not_in_data(func):
111111

112112
@pytest.mark.parametrize('func', all_funcs, ids=all_func_ids)
113113
def test_function_call_with_pandas_data(func, pd):
114-
"""test with pandas dataframe -> label comes from data["col"].name """
114+
"""Test with pandas dataframe -> label comes from ``data["col"].name``."""
115115
data = pd.DataFrame({"a": np.array([1, 2], dtype=np.int32),
116116
"b": np.array([8, 9], dtype=np.int32),
117117
"w": ["NOT", "NOT"]})

lib/mpl_toolkits/axisartist/grid_finder.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ def __call__(self, transform_xy, x1, y1, x2, y2):
3737
return self._add_pad(lon_min, lon_max, lat_min, lat_max)
3838

3939
def _add_pad(self, lon_min, lon_max, lat_min, lat_max):
40-
""" a small amount of padding is added because the current
41-
clipping algorithms seems to fail when the gridline ends at
42-
the bbox boundary.
40+
"""
41+
A small amount of padding is added because the current clipping
42+
algorithms seems to fail when the gridline ends at the bbox boundary.
4343
"""
4444
dlon = (lon_max - lon_min) / self.nx
4545
dlat = (lat_max - lat_min) / self.ny

lib/mpl_toolkits/mplot3d/axis3d.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def tick_update_position(tick, tickxs, tickys, labelpos):
4646

4747

4848
class Axis(maxis.XAxis):
49-
"""An Axis class for the 3D plots. """
49+
"""An Axis class for the 3D plots."""
5050
# These points from the unit cube make up the x, y and z-planes
5151
_PLANES = (
5252
(0, 3, 7, 4), (1, 2, 6, 5), # yz planes

0 commit comments

Comments
 (0)