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

Skip to content

Commit 717d1fa

Browse files
authored
Merge pull request matplotlib#17125 from anntzer/multidoc
Make multiline docstrings start with a newline.
2 parents 533bb57 + 45f6107 commit 717d1fa

30 files changed

+156
-185
lines changed

.flake8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ ignore =
1313
N801, N802, N803, N806, N812,
1414
# pydocstyle
1515
D100, D101, D102, D103, D104, D105, D106, D107,
16-
D200, D202, D203, D204, D205, D207, D212, D213,
16+
D200, D202, D203, D204, D205, D207, D212,
1717
D301
1818
D400, D401, D402, D403, D413,
1919

lib/matplotlib/animation.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,9 @@ def correct_roundoff(x, dpi, n):
9393
return correct_roundoff(wnew, dpi, n), correct_roundoff(hnew, dpi, n)
9494

9595

96-
# A registry for available MovieWriter classes
9796
class MovieWriterRegistry:
9897
"""Registry of available writer classes by human readable name."""
98+
9999
def __init__(self):
100100
self._registered = dict()
101101

@@ -104,7 +104,8 @@ def set_dirty(self):
104104
"""Sets a flag to re-setup the writers."""
105105

106106
def register(self, name):
107-
"""Decorator for registering a class under a name.
107+
"""
108+
Decorator for registering a class under a name.
108109
109110
Example use::
110111
@@ -564,7 +565,8 @@ def finish(self):
564565
# Base class of ffmpeg information. Has the config keys and the common set
565566
# of arguments that controls the *output* side of things.
566567
class FFMpegBase:
567-
"""Mixin class for FFMpeg output.
568+
"""
569+
Mixin class for FFMpeg output.
568570
569571
To be useful this must be multiply-inherited from with a
570572
`MovieWriterBase` sub-class.
@@ -606,7 +608,8 @@ def isAvailable(cls):
606608
# Combine FFMpeg options with pipe-based writing
607609
@writers.register('ffmpeg')
608610
class FFMpegWriter(FFMpegBase, MovieWriter):
609-
"""Pipe-based ffmpeg writer.
611+
"""
612+
Pipe-based ffmpeg writer.
610613
611614
Frames are streamed directly to ffmpeg via a pipe and written in a single
612615
pass.

lib/matplotlib/artist.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,8 @@ def set_sketch_params(self, scale=None, length=None, randomness=None):
669669
self.stale = True
670670

671671
def set_path_effects(self, path_effects):
672-
"""Set the path effects.
672+
"""
673+
Set the path effects.
673674
674675
Parameters
675676
----------
@@ -883,7 +884,8 @@ def get_agg_filter(self):
883884
return self._agg_filter
884885

885886
def set_agg_filter(self, filter_func):
886-
"""Set the agg filter.
887+
"""
888+
Set the agg filter.
887889
888890
Parameters
889891
----------

lib/matplotlib/axes/_axes.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7834,7 +7834,8 @@ def _kde_method(X, coords):
78347834

78357835
def violin(self, vpstats, positions=None, vert=True, widths=0.5,
78367836
showmeans=False, showextrema=True, showmedians=False):
7837-
"""Drawing function for violin plots.
7837+
"""
7838+
Drawing function for violin plots.
78387839
78397840
Draw a violin plot for each column of *vpstats*. Each filled area
78407841
extends to represent the entire data range, with optional lines at the

lib/matplotlib/axes/_base.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3022,7 +3022,8 @@ def locator_params(self, axis='both', tight=None, **kwargs):
30223022
scalex=update_x, scaley=update_y)
30233023

30243024
def tick_params(self, axis='both', **kwargs):
3025-
"""Change the appearance of ticks, tick labels, and gridlines.
3025+
"""
3026+
Change the appearance of ticks, tick labels, and gridlines.
30263027
30273028
Tick properties that are not explicitly set using the keyword
30283029
arguments remain unchanged unless *reset* is True.

lib/matplotlib/axis.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1885,8 +1885,7 @@ def __init__(self, *args, **kwargs):
18851885
self.offset_text_position = 'bottom'
18861886

18871887
def contains(self, mouseevent):
1888-
"""Test whether the mouse event occurred in the x axis.
1889-
"""
1888+
"""Test whether the mouse event occurred in the x axis."""
18901889
inside, info = self._default_contains(mouseevent)
18911890
if inside is not None:
18921891
return inside, info

lib/matplotlib/backend_bases.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,8 @@ def get_registered_canvas_class(format):
116116

117117

118118
class RendererBase:
119-
"""An abstract base class to handle drawing/rendering operations.
119+
"""
120+
An abstract base class to handle drawing/rendering operations.
120121
121122
The following methods must be implemented in the backend for full
122123
functionality (though just implementing :meth:`draw_path` alone would

lib/matplotlib/backends/_backend_tk.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,9 @@ def idle_draw(*args):
260260
self._idle_callback = self._tkcanvas.after_idle(idle_draw)
261261

262262
def get_tk_widget(self):
263-
"""Return the Tk widget used to implement FigureCanvasTkAgg.
263+
"""
264+
Return the Tk widget used to implement FigureCanvasTkAgg.
265+
264266
Although the initial implementation uses a Tk canvas, this routine
265267
is intended to hide that fact.
266268
"""

lib/matplotlib/backends/backend_gtk3agg.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ def _render_figure(self, width, height):
2424
backend_agg.FigureCanvasAgg.draw(self)
2525

2626
def on_draw_event(self, widget, ctx):
27-
"""GtkDrawable draw event, like expose_event in GTK 2.X.
28-
"""
27+
"""GtkDrawable draw event, like expose_event in GTK 2.X."""
2928
allocation = self.get_allocation()
3029
w, h = allocation.width, allocation.height
3130

lib/matplotlib/backends/backend_pdf.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,9 @@ def pdfRepr(obj):
226226

227227

228228
class Reference:
229-
"""PDF reference object.
229+
"""
230+
PDF reference object.
231+
230232
Use PdfFile.reserveObject() to create References.
231233
"""
232234

@@ -1223,7 +1225,8 @@ def alphaState(self, alpha):
12231225
return name
12241226

12251227
def _soft_mask_state(self, smask):
1226-
"""Return an ExtGState that sets the soft mask to the given shading.
1228+
"""
1229+
Return an ExtGState that sets the soft mask to the given shading.
12271230
12281231
Parameters
12291232
----------
@@ -1345,7 +1348,8 @@ def writeHatches(self):
13451348
self.writeObject(self.hatchObject, hatchDict)
13461349

13471350
def addGouraudTriangles(self, points, colors):
1348-
"""Add a Gouraud triangle shading
1351+
"""
1352+
Add a Gouraud triangle shading.
13491353
13501354
Parameters
13511355
----------
@@ -1603,11 +1607,12 @@ def writePath(self, path, transform, clip=False, sketch=None):
16031607
self.output(*cmds)
16041608

16051609
def reserveObject(self, name=''):
1606-
"""Reserve an ID for an indirect object.
1610+
"""
1611+
Reserve an ID for an indirect object.
1612+
16071613
The name is used for debugging in case we forget to print out
16081614
the object with writeObject.
16091615
"""
1610-
16111616
id = next(self._object_seq)
16121617
self.xrefTable.append([None, 0, name])
16131618
return Reference(id)

lib/matplotlib/backends/backend_qt5.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -293,14 +293,14 @@ def leaveEvent(self, event):
293293
FigureCanvasBase.leave_notify_event(self, guiEvent=event)
294294

295295
def mouseEventCoords(self, pos):
296-
"""Calculate mouse coordinates in physical pixels
296+
"""
297+
Calculate mouse coordinates in physical pixels.
297298
298299
Qt5 use logical pixels, but the figure is scaled to physical
299-
pixels for rendering. Transform to physical pixels so that
300+
pixels for rendering. Transform to physical pixels so that
300301
all of the down-stream transforms work as expected.
301302
302303
Also, the origin is different and needs to be corrected.
303-
304304
"""
305305
dpi_ratio = self._dpi_ratio
306306
x = pos.x()
@@ -442,8 +442,7 @@ def stop_event_loop(self, event=None):
442442
self._event_loop.quit()
443443

444444
def draw(self):
445-
"""Render the figure, and queue a request for a Qt draw.
446-
"""
445+
"""Render the figure, and queue a request for a Qt draw."""
447446
# The renderer draw is done here; delaying causes problems with code
448447
# that uses the result of the draw() to update plot elements.
449448
if self._is_drawing:
@@ -453,9 +452,8 @@ def draw(self):
453452
self.update()
454453

455454
def draw_idle(self):
456-
"""Queue redraw of the Agg buffer and request Qt paintEvent.
457-
"""
458-
# The Agg draw needs to be handled by the same thread matplotlib
455+
"""Queue redraw of the Agg buffer and request Qt paintEvent."""
456+
# The Agg draw needs to be handled by the same thread Matplotlib
459457
# modifies the scene graph from. Post Agg draw request to the
460458
# current event loop in order to ensure thread affinity and to
461459
# accumulate multiple draw requests from event handling.

lib/matplotlib/backends/qt_editor/figureoptions.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ def cmp_key(label):
7575
curves = []
7676

7777
def prepare_data(d, init):
78-
"""Prepare entry for FormLayout.
78+
"""
79+
Prepare entry for FormLayout.
7980
8081
*d* is a mapping of shorthands to style names (a single style may
8182
have multiple shorthands, in particular the shorthands `None`,

lib/matplotlib/cbook/__init__.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,7 @@ def __getstate__(self):
165165
return {**vars(self), "callbacks": {}, "_func_cid_map": {}}
166166

167167
def connect(self, s, func):
168-
"""Register *func* to be called when signal *s* is generated.
169-
"""
168+
"""Register *func* to be called when signal *s* is generated."""
170169
self._func_cid_map.setdefault(s, {})
171170
try:
172171
proxy = weakref.WeakMethod(func, self._remove_proxy)
@@ -197,8 +196,7 @@ def _remove_proxy(self, proxy, *, _is_finalizing=sys.is_finalizing):
197196
del self._func_cid_map[signal]
198197

199198
def disconnect(self, cid):
200-
"""Disconnect the callback registered with callback id *cid*.
201-
"""
199+
"""Disconnect the callback registered with callback id *cid*."""
202200
for eventname, callbackd in list(self.callbacks.items()):
203201
try:
204202
del callbackd[cid]

lib/matplotlib/cm.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,8 @@ def to_rgba(self, x, alpha=None, bytes=False, norm=True):
270270
return rgba
271271

272272
def set_array(self, A):
273-
"""Set the image array from numpy array *A*.
273+
"""
274+
Set the image array from numpy array *A*.
274275
275276
Parameters
276277
----------

lib/matplotlib/gridspec.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -462,8 +462,7 @@ def __init__(self, nrows, ncols,
462462
artist=self)
463463

464464
def get_subplot_params(self, figure=None):
465-
"""Return a dictionary of subplot layout parameters.
466-
"""
465+
"""Return a dictionary of subplot layout parameters."""
467466
hspace = (self._hspace if self._hspace is not None
468467
else figure.subplotpars.hspace if figure is not None
469468
else rcParams["figure.subplot.hspace"])

lib/matplotlib/lines.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@
3131

3232

3333
def _get_dash_pattern(style):
34-
"""Convert linestyle -> dash pattern
35-
"""
34+
"""Convert linestyle to dash pattern."""
3635
# go from short hand -> full strings
3736
if isinstance(style, str):
3837
style = ls_mapper.get(style, style)
@@ -495,7 +494,8 @@ def get_pickradius(self):
495494
return self._pickradius
496495

497496
def set_pickradius(self, d):
498-
"""Set the pick radius used for containment tests.
497+
"""
498+
Set the pick radius used for containment tests.
499499
500500
See `.contains` for more details.
501501

lib/matplotlib/mlab.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1065,7 +1065,8 @@ def silverman_factor(self):
10651065
covariance_factor = scotts_factor
10661066

10671067
def evaluate(self, points):
1068-
"""Evaluate the estimated pdf on a set of points.
1068+
"""
1069+
Evaluate the estimated pdf on a set of points.
10691070
10701071
Parameters
10711072
----------

lib/matplotlib/patches.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,8 @@ def get_capstyle(self):
470470
return self._capstyle
471471

472472
def set_joinstyle(self, s):
473-
"""Set the joinstyle.
473+
"""
474+
Set the joinstyle.
474475
475476
Parameters
476477
----------
@@ -4207,7 +4208,8 @@ def __init__(self, xyA, xyB, coordsA, coordsB=None,
42074208
clip_on=False,
42084209
dpi_cor=1.,
42094210
**kwargs):
4210-
"""Connect point *xyA* in *coordsA* with point *xyB* in *coordsB*
4211+
"""
4212+
Connect point *xyA* in *coordsA* with point *xyB* in *coordsB*.
42114213
42124214
Valid keys are
42134215

lib/matplotlib/projections/polar.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1258,7 +1258,8 @@ def get_rlabel_position(self):
12581258
return np.rad2deg(self._r_label_position.get_matrix()[0, 2])
12591259

12601260
def set_rlabel_position(self, value):
1261-
"""Updates the theta position of the radius labels.
1261+
"""
1262+
Updates the theta position of the radius labels.
12621263
12631264
Parameters
12641265
----------

lib/matplotlib/streamplot.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,8 @@ def __init__(self, lines, arrows, **kwargs):
246246
# ========================
247247

248248
class DomainMap:
249-
"""Map representing different coordinate systems.
249+
"""
250+
Map representing different coordinate systems.
250251
251252
Coordinate definitions:
252253
@@ -361,7 +362,8 @@ def within_grid(self, xi, yi):
361362

362363

363364
class StreamMask:
364-
"""Mask to keep track of discrete regions crossed by streamlines.
365+
"""
366+
Mask to keep track of discrete regions crossed by streamlines.
365367
366368
The resolution of this grid determines the approximate spacing between
367369
trajectories. Streamlines are only allowed to pass through zeroed cells:
@@ -396,7 +398,8 @@ def _undo_trajectory(self):
396398
self._mask[t] = 0
397399

398400
def _update_trajectory(self, xm, ym):
399-
"""Update current trajectory position in mask.
401+
"""
402+
Update current trajectory position in mask.
400403
401404
If the new position has already been filled, raise `InvalidIndexError`.
402405
"""
@@ -446,7 +449,8 @@ def backward_time(xi, yi):
446449
return -dxi, -dyi
447450

448451
def integrate(x0, y0):
449-
"""Return x, y grid-coordinates of trajectory based on starting point.
452+
"""
453+
Return x, y grid-coordinates of trajectory based on starting point.
450454
451455
Integrate both forward and backward in time from starting point in
452456
grid coordinates.
@@ -492,7 +496,8 @@ class OutOfBounds(IndexError):
492496

493497

494498
def _integrate_rk12(x0, y0, dmap, f, maxlength):
495-
"""2nd-order Runge-Kutta algorithm with adaptive step size.
499+
"""
500+
2nd-order Runge-Kutta algorithm with adaptive step size.
496501
497502
This method is also referred to as the improved Euler's method, or Heun's
498503
method. This method is favored over higher-order methods because:
@@ -658,7 +663,8 @@ def interpgrid(a, xi, yi):
658663

659664

660665
def _gen_starting_points(shape):
661-
"""Yield starting points for streamlines.
666+
"""
667+
Yield starting points for streamlines.
662668
663669
Trying points on the boundary first gives higher quality streamlines.
664670
This algorithm starts with a point on the mask corner and spirals inward.

0 commit comments

Comments
 (0)