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

Skip to content

Commit 54a6409

Browse files
committed
Fix pydocstyle D403 (First word of the first line should be properly capitalized)
1 parent 3530d43 commit 54a6409

10 files changed

Lines changed: 80 additions & 85 deletions

File tree

lib/matplotlib/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ def get_cachedir():
603603

604604

605605
def _get_data_path():
606-
'get the path to matplotlib data'
606+
"""Return the path to matplotlib data."""
607607

608608
if 'MATPLOTLIBDATA' in os.environ:
609609
path = os.environ['MATPLOTLIBDATA']

lib/matplotlib/_constrained_layout.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,7 @@ def _in_same_row(rownum0min, rownum0max, rownumCmin, rownumCmax):
6666

6767

6868
def _axes_all_finite_sized(fig):
69-
"""
70-
helper function to make sure all axes in the
71-
figure have a finite width and height. If not, return False
72-
"""
69+
"""Return whether all axes in the figure have a finite width and height."""
7370
for ax in fig.axes:
7471
if ax._layoutbox is not None:
7572
newpos = ax._poslayoutbox.get_rect()
@@ -471,10 +468,7 @@ def _align_spines(fig, gs):
471468

472469

473470
def _arrange_subplotspecs(gs, hspace=0, wspace=0):
474-
"""
475-
arrange the subplotspec children of this gridspec, and then recursively
476-
do the same of any gridspec children of those gridspecs...
477-
"""
471+
"""Recursively arrange the subplotspec children of the given gridspec."""
478472
sschildren = []
479473
for child in gs.children:
480474
if child._is_subplotspec_layoutbox():

lib/matplotlib/axis.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,9 @@ def _set_artist_props(self, a):
326326
a.set_figure(self.figure)
327327

328328
def get_view_interval(self):
329-
'return the view Interval instance for the axis this tick is ticking'
329+
"""
330+
Return the view limits ``(min, max)`` of the axis the tick belongs to.
331+
"""
330332
raise NotImplementedError('Derived must override')
331333

332334
def _apply_params(self, **kw):
@@ -624,7 +626,7 @@ def update_position(self, loc):
624626
self.stale = True
625627

626628
def get_view_interval(self):
627-
"""Return the Interval instance for this axis view limits."""
629+
# docstring inherited
628630
return self.axes.viewLim.intervaly
629631

630632

@@ -839,7 +841,7 @@ def get_children(self):
839841
*self.get_major_ticks(), *self.get_minor_ticks()]
840842

841843
def cla(self):
842-
'clear the current axis'
844+
"""Clear this axis."""
843845

844846
self.label.set_text('') # self.set_label_text would change isDefault_
845847

@@ -971,7 +973,7 @@ def set_clip_path(self, clippath, transform=None):
971973
self.stale = True
972974

973975
def get_view_interval(self):
974-
"""Return the Interval instance for this axis view limits."""
976+
"""Return the view limits ``(min, max)`` of this axis."""
975977
raise NotImplementedError('Derived must override')
976978

977979
def set_view_interval(self, vmin, vmax, ignore=False):
@@ -1391,11 +1393,11 @@ def get_ticks_direction(self, minor=False):
13911393
[tick._tickdir for tick in self.get_major_ticks()])
13921394

13931395
def _get_tick(self, major):
1394-
'return the default tick instance'
1396+
"""Return the default tick instance."""
13951397
raise NotImplementedError('derived must override')
13961398

13971399
def _copy_tick_props(self, src, dest):
1398-
'Copy the props from src tick to dest tick'
1400+
"""Copy the properties from *src* tick to *dest* tick."""
13991401
if src is None or dest is None:
14001402
return
14011403
dest.label1.update_from(src.label1)
@@ -1502,11 +1504,10 @@ def grid(self, b=None, which='major', **kwargs):
15021504

15031505
def update_units(self, data):
15041506
"""
1505-
introspect *data* for units converter and update the
1507+
Introspect *data* for units converter and update the
15061508
axis.converter instance if necessary. Return *True*
15071509
if *data* is registered for unit conversion.
15081510
"""
1509-
15101511
converter = munits.registry.get_converter(data)
15111512
if converter is None:
15121513
return False
@@ -1524,8 +1525,8 @@ def update_units(self, data):
15241525

15251526
def _update_axisinfo(self):
15261527
"""
1527-
check the axis converter for the stored units to see if the
1528-
axis info needs to be updated
1528+
Check the axis converter for the stored units to see if the
1529+
axis info needs to be updated.
15291530
"""
15301531
if self.converter is None:
15311532
return

lib/matplotlib/colorbar.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -340,16 +340,12 @@ def set_clim(self, vmin=None, vmax=None):
340340

341341
@cbook.deprecated("3.1", alternative="ScalarMappable.get_cmap")
342342
def get_cmap(self):
343-
"""
344-
return the colormap
345-
"""
343+
"""Return the colormap."""
346344
return self.cmap
347345

348346
@cbook.deprecated("3.1", alternative="ScalarMappable.get_clim")
349347
def get_clim(self):
350-
"""
351-
return the min, max of the color limits for image scaling
352-
"""
348+
"""Return the min, max of the color limits for image scaling."""
353349
return self.norm.vmin, self.norm.vmax
354350

355351

lib/matplotlib/dates.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1352,7 +1352,7 @@ def set_axis(self, axis):
13521352
self._locator.set_axis(axis)
13531353

13541354
def refresh(self):
1355-
'Refresh internal information based on current limits.'
1355+
# docstring inherited
13561356
dmin, dmax = self.viewlim_to_dt()
13571357
self._locator = self.get_locator(dmin, dmax)
13581358

lib/matplotlib/image.py

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -537,10 +537,9 @@ def make_image(self, renderer, magnification=1.0, unsampled=False):
537537

538538
def _draw_unsampled_image(self, renderer, gc):
539539
"""
540-
draw unsampled image. The renderer should support a draw_image method
540+
Draw unsampled image. The renderer should support a draw_image method
541541
with scale parameter.
542542
"""
543-
544543
im, l, b, trans = self.make_image(renderer, unsampled=True)
545544

546545
if im is None:
@@ -552,7 +551,8 @@ def _draw_unsampled_image(self, renderer, gc):
552551

553552
def _check_unsampled_image(self, renderer):
554553
"""
555-
return True if the image is better to be drawn unsampled.
554+
Return whether the image is better to be drawn unsampled.
555+
556556
The derived class needs to override it.
557557
"""
558558
return False
@@ -852,12 +852,20 @@ def _check_unsampled_image(self, renderer):
852852

853853
def set_extent(self, extent):
854854
"""
855-
extent is data axes (left, right, bottom, top) for making image plots
855+
Set the image extent.
856856
857-
This updates ax.dataLim, and, if autoscaling, sets viewLim
858-
to tightly fit the image, regardless of dataLim. Autoscaling
857+
Parameters
858+
----------
859+
extent : 4-tuple of float
860+
The position and size of the image as tuple
861+
``(left, right, bottom, top)`` in data coordinates.
862+
863+
Notes
864+
-----
865+
This updates ``ax.dataLim`, and, if autoscaling, sets ``ax.viewLim``
866+
to tightly fit the image, regardless of ``dataLim``. Autoscaling
859867
state is not changed, so following this with ax.autoscale_view
860-
will redo the autoscaling in accord with dataLim.
868+
will redo the autoscaling in accord with ``dataLim``.
861869
"""
862870
self._extent = xmin, xmax, ymin, ymax = extent
863871
corners = (xmin, ymin), (xmax, ymax)
@@ -871,7 +879,7 @@ def set_extent(self, extent):
871879
self.stale = True
872880

873881
def get_extent(self):
874-
"""Get the image extent: left, right, bottom, top"""
882+
"""Return the image extent as tuple (left, right, bottom, top)."""
875883
if self._extent is not None:
876884
return self._extent
877885
else:
@@ -923,17 +931,18 @@ def format_cursor_data(self, data):
923931
class NonUniformImage(AxesImage):
924932
def __init__(self, ax, *, interpolation='nearest', **kwargs):
925933
"""
926-
kwargs are identical to those for AxesImage, except
927-
that 'nearest' and 'bilinear' are the only supported 'interpolation'
928-
options.
934+
Parameters
935+
----------
936+
interpolation : {'nearest', 'bilinear'}
937+
938+
**kwargs
939+
All other keyword arguments are identical to those of `.AxesImage`.
929940
"""
930941
super().__init__(ax, **kwargs)
931942
self.set_interpolation(interpolation)
932943

933944
def _check_unsampled_image(self, renderer):
934-
"""
935-
return False. Do not use unsampled image.
936-
"""
945+
"""Return False. Do not use unsampled image."""
937946
return False
938947

939948
def make_image(self, renderer, magnification=1.0, unsampled=False):
@@ -1204,7 +1213,7 @@ def __init__(self, fig,
12041213
self.magnification = 1.0
12051214

12061215
def get_extent(self):
1207-
"""Get the image extent: left, right, bottom, top"""
1216+
"""Return the image extent as tuple (left, right, bottom, top)."""
12081217
numrows, numcols = self.get_size()
12091218
return (-0.5 + self.ox, numcols-0.5 + self.ox,
12101219
-0.5 + self.oy, numrows-0.5 + self.oy)

lib/matplotlib/patches.py

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ def set_fill(self, b):
405405
self.stale = True
406406

407407
def get_fill(self):
408-
'return whether fill is set'
408+
"""Return whether the patch is filled."""
409409
return self._fill
410410

411411
# Make fill a property so as to preserve the long-standing
@@ -1797,9 +1797,7 @@ class _Style:
17971797
provides some helper functions.
17981798
"""
17991799
def __new__(cls, stylename, **kw):
1800-
"""
1801-
return the instance of the subclass with the given style name.
1802-
"""
1800+
"""Return the instance of the subclass with the given style name."""
18031801

18041802
# The "class" should have the _style_list attribute, which is a mapping
18051803
# of style names to style classes.
@@ -3025,8 +3023,8 @@ def connect(self, posA, posB):
30253023

30263024
def _point_along_a_line(x0, y0, x1, y1, d):
30273025
"""
3028-
find a point along a line connecting (x0, y0) -- (x1, y1) whose
3029-
distance from (x0, y0) is d.
3026+
Return the point on the line connecting (*x0*, *y0*) -- (*x1*, *y1*) whose
3027+
distance from (*x0*, *y0*) is *d*.
30303028
"""
30313029
dx, dy = x0 - x1, y0 - y1
30323030
ff = d / (dx * dx + dy * dy) ** .5
@@ -4321,10 +4319,7 @@ def __init__(self, xyA, xyB, coordsA, coordsB=None,
43214319
self._annotation_clip = None
43224320

43234321
def _get_xy(self, x, y, s, axes=None):
4324-
"""
4325-
calculate the pixel position of given point
4326-
"""
4327-
4322+
"""Calculate the pixel position of given point."""
43284323
if axes is None:
43294324
axes = self.axes
43304325

@@ -4418,7 +4413,7 @@ def _get_xy(self, x, y, s, axes=None):
44184413
y = b + y
44194414
return x, y
44204415
elif s == 'axes fraction':
4421-
#(0,0) is lower left, (1,1) is upper right of axes
4416+
# (0,0) is lower left, (1,1) is upper right of axes
44224417
trans = axes.transAxes
44234418
return trans.transform_point((x, y))
44244419
elif isinstance(s, transforms.Transform):
@@ -4429,28 +4424,32 @@ def _get_xy(self, x, y, s, axes=None):
44294424

44304425
def set_annotation_clip(self, b):
44314426
"""
4432-
set *annotation_clip* attribute.
4427+
Set the clipping behavior.
4428+
4429+
Parameters
4430+
----------
4431+
b : bool or None
44334432
4434-
* True: the annotation will only be drawn when self.xy is inside the
4435-
axes.
4436-
* False: the annotation will always be drawn regardless of its
4437-
position.
4438-
* None: the self.xy will be checked only if *xycoords* is "data"
4433+
- *False*: The annotation will always be drawn regardless of its
4434+
position.
4435+
- *True*: The annotation will only be drawn if ``self.xy`` is
4436+
inside the axes.
4437+
- *None*: The annotation will only be drawn if ``self.xy`` is
4438+
inside the axes and ``self.xycoords == "data"``.
44394439
"""
44404440
self._annotation_clip = b
44414441
self.stale = True
44424442

44434443
def get_annotation_clip(self):
44444444
"""
4445-
Return *annotation_clip* attribute.
4446-
See :meth:`set_annotation_clip` for the meaning of return values.
4445+
Return the clipping behavior.
4446+
4447+
See `.set_annotation_clip` for the meaning of the return value.
44474448
"""
44484449
return self._annotation_clip
44494450

44504451
def get_path_in_displaycoord(self):
4451-
"""
4452-
Return the mutated path of the arrow in the display coord
4453-
"""
4452+
"""Return the mutated path of the arrow in display coordinates."""
44544453

44554454
dpi_cor = self.get_dpi_cor()
44564455

lib/matplotlib/patheffects.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ def __init__(self, offset=(0, 0), **kwargs):
185185

186186
def draw_path(self, renderer, gc, tpath, affine, rgbFace):
187187
"""
188-
draw the path with updated gc.
188+
Draw the path with updated gc.
189189
"""
190190
# Do not modify the input! Use copy instead.
191191

lib/matplotlib/projections/polar.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ def pan(self, numsteps):
236236
return self.base.pan(numsteps)
237237

238238
def refresh(self):
239+
# docstring inherited
239240
return self.base.refresh()
240241

241242
def view_limits(self, vmin, vmax):
@@ -427,6 +428,7 @@ def zoom(self, direction):
427428
return self.base.zoom(direction)
428429

429430
def refresh(self):
431+
# docstring inherited
430432
return self.base.refresh()
431433

432434
def view_limits(self, vmin, vmax):

0 commit comments

Comments
 (0)