Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 6f29ccc

Browse filesBrowse files
committed
Many docstring cleanups.
Mostly D401 ("imperative mood"), and a few others.
1 parent 291d5d7 commit 6f29ccc
Copy full SHA for 6f29ccc
Expand file treeCollapse file tree

31 files changed

+143
-146
lines changed

‎lib/matplotlib/__init__.py

Copy file name to clipboardExpand all lines: lib/matplotlib/__init__.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ def _ensure_handler():
192192

193193
def set_loglevel(level):
194194
"""
195-
Sets the Matplotlib's root logger and root logger handler level, creating
195+
Set Matplotlib's root logger and root logger handler level, creating
196196
the handler if it does not exist yet.
197197
198198
Typically, one should call ``set_loglevel("info")`` or

‎lib/matplotlib/afm.py

Copy file name to clipboardExpand all lines: lib/matplotlib/afm.py
+2-4Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def _to_bool(s):
8585

8686
def _parse_header(fh):
8787
"""
88-
Reads the font metrics header (up to the char metrics) and returns
88+
Read the font metrics header (up to the char metrics) and returns
8989
a dictionary mapping *key* to *val*. *val* will be converted to the
9090
appropriate python type as necessary; e.g.:
9191
@@ -99,7 +99,6 @@ def _parse_header(fh):
9999
ItalicAngle, IsFixedPitch, FontBBox, UnderlinePosition,
100100
UnderlineThickness, Version, Notice, EncodingScheme, CapHeight,
101101
XHeight, Ascender, Descender, StartCharMetrics
102-
103102
"""
104103
header_converters = {
105104
b'StartFontMetrics': _to_float,
@@ -128,8 +127,7 @@ def _parse_header(fh):
128127
b'StartCharMetrics': _to_int,
129128
b'CharacterSet': _to_str,
130129
b'Characters': _to_int,
131-
}
132-
130+
}
133131
d = {}
134132
first_line = True
135133
for line in fh:

‎lib/matplotlib/animation.py

Copy file name to clipboardExpand all lines: lib/matplotlib/animation.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ def __init__(self, fps=5, metadata=None, codec=None, bitrate=None):
201201
@abc.abstractmethod
202202
def setup(self, fig, outfile, dpi=None):
203203
"""
204-
Perform setup for writing the movie file.
204+
Setup for writing the movie file.
205205
206206
Parameters
207207
----------
@@ -425,7 +425,7 @@ def __init__(self, *args, **kwargs):
425425
def setup(self, fig, outfile, dpi=None, frame_prefix=None,
426426
clear_temp=True):
427427
"""
428-
Perform setup for writing the movie file.
428+
Setup for writing the movie file.
429429
430430
Parameters
431431
----------

‎lib/matplotlib/axes/_axes.py

Copy file name to clipboardExpand all lines: lib/matplotlib/axes/_axes.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5390,7 +5390,7 @@ def imshow(self, X, cmap=None, norm=None, aspect=None,
53905390
53915391
If *interpolation* is 'none', then no interpolation is performed
53925392
on the Agg, ps, pdf and svg backends. Other backends will fall back
5393-
to 'nearest'. Note that most SVG renders perform interpolation at
5393+
to 'nearest'. Note that most SVG renderers perform interpolation at
53945394
rendering and that the default interpolation method they implement
53955395
may differ.
53965396

‎lib/matplotlib/backends/backend_pdf.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_pdf.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1725,7 +1725,7 @@ def check_gc(self, gc, fillcolor=None):
17251725

17261726
@cbook.deprecated("3.3")
17271727
def track_characters(self, *args, **kwargs):
1728-
"""Keeps track of which characters are required from each font."""
1728+
"""Keep track of which characters are required from each font."""
17291729
self.file._character_tracker.track(*args, **kwargs)
17301730

17311731
@cbook.deprecated("3.3")
@@ -2460,7 +2460,7 @@ def infodict(self):
24602460

24612461
def savefig(self, figure=None, **kwargs):
24622462
"""
2463-
Saves a `.Figure` to this file as a new page.
2463+
Save a `.Figure` to this file as a new page.
24642464
24652465
Any other keyword arguments are passed to `~.Figure.savefig`.
24662466

‎lib/matplotlib/backends/backend_pgf.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_pgf.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ class RendererPgf(RendererBase):
395395
@cbook._delete_parameter("3.3", "dummy")
396396
def __init__(self, figure, fh, dummy=False):
397397
"""
398-
Creates a new PGF renderer that translates any drawing instruction
398+
Create a new PGF renderer that translates any drawing instruction
399399
into text commands to be interpreted in a latex pgfpicture environment.
400400
401401
Attributes
@@ -1111,7 +1111,7 @@ def _run_latex(self):
11111111

11121112
def savefig(self, figure=None, **kwargs):
11131113
"""
1114-
Saves a `.Figure` to this file as a new page.
1114+
Save a `.Figure` to this file as a new page.
11151115
11161116
Any other keyword arguments are passed to `~.Figure.savefig`.
11171117

‎lib/matplotlib/backends/backend_ps.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_ps.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ def used_characters(self):
176176

177177
@cbook.deprecated("3.3")
178178
def track_characters(self, *args, **kwargs):
179-
"""Keeps track of which characters are required from each font."""
179+
"""Keep track of which characters are required from each font."""
180180
self._character_tracker.track(*args, **kwargs)
181181

182182
@cbook.deprecated("3.3")

‎lib/matplotlib/backends/backend_svg.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_svg.py
+7-7Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def __flush(self, indent=True):
129129

130130
def start(self, tag, attrib={}, **extra):
131131
"""
132-
Opens a new element. Attributes can be given as keyword
132+
Open a new element. Attributes can be given as keyword
133133
arguments, or as a string/string dictionary. The method returns
134134
an opaque identifier that can be passed to the :meth:`close`
135135
method, to close all open elements up to and including this one.
@@ -162,7 +162,7 @@ def start(self, tag, attrib={}, **extra):
162162

163163
def comment(self, comment):
164164
"""
165-
Adds a comment to the output stream.
165+
Add a comment to the output stream.
166166
167167
Parameters
168168
----------
@@ -175,7 +175,7 @@ def comment(self, comment):
175175

176176
def data(self, text):
177177
"""
178-
Adds character data to the output stream.
178+
Add character data to the output stream.
179179
180180
Parameters
181181
----------
@@ -186,7 +186,7 @@ def data(self, text):
186186

187187
def end(self, tag=None, indent=True):
188188
"""
189-
Closes the current element (opened by the most recent call to
189+
Close the current element (opened by the most recent call to
190190
:meth:`start`).
191191
192192
Parameters
@@ -214,7 +214,7 @@ def end(self, tag=None, indent=True):
214214

215215
def close(self, id):
216216
"""
217-
Closes open elements, up to (and including) the element identified
217+
Close open elements, up to (and including) the element identified
218218
by the given identifier.
219219
220220
Parameters
@@ -227,7 +227,7 @@ def close(self, id):
227227

228228
def element(self, tag, text=None, attrib={}, **extra):
229229
"""
230-
Adds an entire element. This is the same as calling :meth:`start`,
230+
Add an entire element. This is the same as calling :meth:`start`,
231231
:meth:`data`, and :meth:`end` in sequence. The *text* argument can be
232232
omitted.
233233
"""
@@ -237,7 +237,7 @@ def element(self, tag, text=None, attrib={}, **extra):
237237
self.end(indent=False)
238238

239239
def flush(self):
240-
"""Flushes the output stream."""
240+
"""Flush the output stream."""
241241
pass # replaced by the constructor
242242

243243

‎lib/matplotlib/blocking_input.py

Copy file name to clipboardExpand all lines: lib/matplotlib/blocking_input.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ def pop_click(self, event, index=-1):
235235

236236
def pop(self, event, index=-1):
237237
"""
238-
Removes a click and the associated event from the list of clicks.
238+
Remove a click and the associated event from the list of clicks.
239239
240240
Defaults to the last click.
241241
"""

‎lib/matplotlib/cbook/__init__.py

Copy file name to clipboardExpand all lines: lib/matplotlib/cbook/__init__.py
+1-4Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1282,10 +1282,7 @@ def _to_unmasked_float_array(x):
12821282

12831283

12841284
def _check_1d(x):
1285-
"""
1286-
Converts a sequence of less than 1 dimension, to an array of 1
1287-
dimension; leaves everything else untouched.
1288-
"""
1285+
"""Convert scalars to 1d arrays; pass-through arrays as is."""
12891286
if not hasattr(x, 'shape') or len(x.shape) < 1:
12901287
return np.atleast_1d(x)
12911288
else:

‎lib/matplotlib/collections.py

Copy file name to clipboardExpand all lines: lib/matplotlib/collections.py
+7-5Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -917,8 +917,10 @@ def get_paths(self):
917917
def legend_elements(self, prop="colors", num="auto",
918918
fmt=None, func=lambda x: x, **kwargs):
919919
"""
920-
Creates legend handles and labels for a PathCollection. This is useful
921-
for obtaining a legend for a `~.Axes.scatter` plot. E.g.::
920+
Create legend handles and labels for a PathCollection.
921+
922+
This is useful for obtaining a legend for a `~.Axes.scatter` plot;
923+
e.g.::
922924
923925
scatter = plt.scatter([1, 2, 3], [4, 5, 6], c=[7, 2, 3])
924926
plt.legend(*scatter.legend_elements())
@@ -1849,7 +1851,7 @@ def set_paths(self):
18491851
@staticmethod
18501852
def convert_mesh_to_paths(tri):
18511853
"""
1852-
Converts a given mesh into a sequence of `~.Path` objects.
1854+
Convert a given mesh into a sequence of `~.Path` objects.
18531855
18541856
This function is primarily of use to implementers of backends that do
18551857
not directly support meshes.
@@ -1942,7 +1944,7 @@ def get_datalim(self, transData):
19421944
@staticmethod
19431945
def convert_mesh_to_paths(meshWidth, meshHeight, coordinates):
19441946
"""
1945-
Converts a given mesh into a sequence of `~.Path` objects.
1947+
Convert a given mesh into a sequence of `~.Path` objects.
19461948
19471949
This function is primarily of use to implementers of backends that do
19481950
not directly support quadmeshes.
@@ -1963,7 +1965,7 @@ def convert_mesh_to_paths(meshWidth, meshHeight, coordinates):
19631965

19641966
def convert_mesh_to_triangles(self, meshWidth, meshHeight, coordinates):
19651967
"""
1966-
Converts a given mesh into a sequence of triangles, each point
1968+
Convert a given mesh into a sequence of triangles, each point
19671969
with its own color. This is useful for experiments using
19681970
`~.RendererBase.draw_gouraud_triangle`.
19691971
"""

‎lib/matplotlib/colors.py

Copy file name to clipboardExpand all lines: lib/matplotlib/colors.py
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1316,7 +1316,7 @@ def _inv_transform(self, a):
13161316
return a
13171317

13181318
def _transform_vmin_vmax(self):
1319-
"""Calculates vmin and vmax in the transformed system."""
1319+
"""Calculate vmin and vmax in the transformed system."""
13201320
vmin, vmax = self.vmin, self.vmax
13211321
arr = np.array([vmax, vmin]).astype(float)
13221322
self._upper, self._lower = self._transform(arr)
@@ -1687,7 +1687,7 @@ def direction(self):
16871687

16881688
def hillshade(self, elevation, vert_exag=1, dx=1, dy=1, fraction=1.):
16891689
"""
1690-
Calculates the illumination intensity for a surface using the defined
1690+
Calculate the illumination intensity for a surface using the defined
16911691
azimuth and elevation for the light source.
16921692
16931693
This computes the normal vectors for the surface, and then passes them
@@ -1741,7 +1741,7 @@ def hillshade(self, elevation, vert_exag=1, dx=1, dy=1, fraction=1.):
17411741

17421742
def shade_normals(self, normals, fraction=1.):
17431743
"""
1744-
Calculates the illumination intensity for the normal vectors of a
1744+
Calculate the illumination intensity for the normal vectors of a
17451745
surface using the defined azimuth and elevation for the light source.
17461746
17471747
Imagine an artificial sun placed at infinity in some azimuth and
@@ -2008,8 +2008,8 @@ def blend_hsv(self, rgb, intensity, hsv_max_sat=None, hsv_max_val=None,
20082008

20092009
def blend_soft_light(self, rgb, intensity):
20102010
"""
2011-
Combines an rgb image with an intensity map using "soft light"
2012-
blending. Uses the "pegtop" formula.
2011+
Combine an rgb image with an intensity map using "soft light" blending,
2012+
using the "pegtop" formula.
20132013
20142014
Parameters
20152015
----------

‎lib/matplotlib/dates.py

Copy file name to clipboardExpand all lines: lib/matplotlib/dates.py
+2-6Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -991,9 +991,7 @@ def set_tzinfo(self, tz):
991991
self.tz = tz
992992

993993
def datalim_to_dt(self):
994-
"""
995-
Convert axis data interval to datetime objects.
996-
"""
994+
"""Convert axis data interval to datetime objects."""
997995
dmin, dmax = self.axis.get_data_interval()
998996
if dmin > dmax:
999997
dmin, dmax = dmax, dmin
@@ -1006,9 +1004,7 @@ def datalim_to_dt(self):
10061004
return num2date(dmin, self.tz), num2date(dmax, self.tz)
10071005

10081006
def viewlim_to_dt(self):
1009-
"""
1010-
Converts the view interval to datetime objects.
1011-
"""
1007+
"""Convert the view interval to datetime objects."""
10121008
vmin, vmax = self.axis.get_view_interval()
10131009
if vmin > vmax:
10141010
vmin, vmax = vmax, vmin

‎lib/matplotlib/dviread.py

Copy file name to clipboardExpand all lines: lib/matplotlib/dviread.py
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -954,9 +954,9 @@ def _parse(self, file):
954954
@cbook.deprecated("3.3")
955955
class Encoding:
956956
r"""
957-
Parses a \*.enc file referenced from a psfonts.map style file.
958-
The format this class understands is a very limited subset of
959-
PostScript.
957+
Parse a \*.enc file referenced from a psfonts.map style file.
958+
959+
The format this class understands is a very limited subset of PostScript.
960960
961961
Usage (subject to change)::
962962

‎lib/matplotlib/font_manager.py

Copy file name to clipboardExpand all lines: lib/matplotlib/font_manager.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ def win32FontDirectory():
176176

177177
def _win32RegistryFonts(reg_domain, base_dir):
178178
r"""
179-
Searches for fonts in the Windows registry.
179+
Search for fonts in the Windows registry.
180180
181181
Parameters
182182
----------
@@ -498,7 +498,7 @@ def afmFontProperty(fontpath, font):
498498
@cbook.deprecated("3.2", alternative="FontManager.addfont")
499499
def createFontList(fontfiles, fontext='ttf'):
500500
"""
501-
A function to create a font lookup list. The default is to create
501+
Create a font lookup list. The default is to create
502502
a list of TrueType fonts. An AFM font list can optionally be
503503
created.
504504
"""

‎lib/matplotlib/legend_handler.py

Copy file name to clipboardExpand all lines: lib/matplotlib/legend_handler.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -628,8 +628,8 @@ def create_artists(self, legend, orig_handle,
628628

629629
def _copy_collection_props(self, legend_handle, orig_handle):
630630
"""
631-
Method to copy properties from a LineCollection (orig_handle) to a
632-
Line2D (legend_handle).
631+
Copy properties from the `.LineCollection` *orig_handle* to the
632+
`.Line2D` *legend_handle*.
633633
"""
634634
legend_handle.set_color(orig_handle.get_color()[0])
635635
legend_handle.set_linestyle(orig_handle.get_linestyle()[0])

‎lib/matplotlib/patches.py

Copy file name to clipboardExpand all lines: lib/matplotlib/patches.py
+2-5Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2464,15 +2464,12 @@ def _shrink(self, path, shrinkA, shrinkB):
24642464
def __call__(self, posA, posB,
24652465
shrinkA=2., shrinkB=2., patchA=None, patchB=None):
24662466
"""
2467-
Calls the *connect* method to create a path between *posA*
2468-
and *posB*. The path is clipped and shrunken.
2467+
Call the *connect* method to create a path between *posA* and
2468+
*posB*; then clip and shrink the path.
24692469
"""
2470-
24712470
path = self.connect(posA, posB)
2472-
24732471
clipped_path = self._clip(path, patchA, patchB)
24742472
shrunk_path = self._shrink(clipped_path, shrinkA, shrinkB)
2475-
24762473
return shrunk_path
24772474

24782475
@_register_style(_style_list)

‎lib/matplotlib/path.py

Copy file name to clipboardExpand all lines: lib/matplotlib/path.py
+6-5Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -359,9 +359,10 @@ def iter_segments(self, transform=None, remove_nans=True, clip=None,
359359
snap=False, stroke_width=1.0, simplify=None,
360360
curves=True, sketch=None):
361361
"""
362-
Iterates over all of the curve segments in the path. Each iteration
363-
returns a 2-tuple ``(vertices, code)``, where ``vertices`` is a
364-
sequence of 1-3 coordinate pairs, and ``code`` is a `Path` code.
362+
Iterate over all curve segments in the path.
363+
364+
Each iteration returns a pair ``(vertices, code)``, where ``vertices``
365+
is a sequence of 1-3 coordinate pairs, and ``code`` is a `Path` code.
365366
366367
Additionally, this method can provide a number of standard cleanups and
367368
conversions to the path.
@@ -379,7 +380,7 @@ def iter_segments(self, transform=None, remove_nans=True, clip=None,
379380
defining a rectangle in which to clip the path.
380381
snap : None or bool, optional
381382
If True, snap all nodes to pixels; if False, don't snap them.
382-
If None, perform snapping if the path contains only segments
383+
If None, snap if the path contains only segments
383384
parallel to the x or y axes, and no more than 1024 of them.
384385
stroke_width : float, optional
385386
The width of the stroke being drawn (used for path snapping).
@@ -522,7 +523,7 @@ def contains_path(self, path, transform=None):
522523
Return whether this (closed) path completely contains the given path.
523524
524525
If *transform* is not ``None``, the path will be transformed before
525-
performing the test.
526+
checking for containment.
526527
"""
527528
if transform is not None:
528529
transform = transform.frozen()

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.