Skip to content

Commit e39c67b

Browse files
authored
Merge pull request #17150 from anntzer/d401
Many docstring cleanups.
2 parents 3b111ac + 6f29ccc commit e39c67b

31 files changed

+143
-146
lines changed

lib/matplotlib/__init__.py

Lines 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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def _to_bool(s):
8787

8888
def _parse_header(fh):
8989
"""
90-
Reads the font metrics header (up to the char metrics) and returns
90+
Read the font metrics header (up to the char metrics) and returns
9191
a dictionary mapping *key* to *val*. *val* will be converted to the
9292
appropriate python type as necessary; e.g.:
9393
@@ -101,7 +101,6 @@ def _parse_header(fh):
101101
ItalicAngle, IsFixedPitch, FontBBox, UnderlinePosition,
102102
UnderlineThickness, Version, Notice, EncodingScheme, CapHeight,
103103
XHeight, Ascender, Descender, StartCharMetrics
104-
105104
"""
106105
header_converters = {
107106
b'StartFontMetrics': _to_float,
@@ -130,8 +129,7 @@ def _parse_header(fh):
130129
b'StartCharMetrics': _to_int,
131130
b'CharacterSet': _to_str,
132131
b'Characters': _to_int,
133-
}
134-
132+
}
135133
d = {}
136134
first_line = True
137135
for line in fh:

lib/matplotlib/animation.py

Lines 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

Lines 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

Lines 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

Lines 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

Lines 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

Lines 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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ def pop_click(self, event, index=-1):
234234

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

lib/matplotlib/cbook/__init__.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1280,10 +1280,7 @@ def _to_unmasked_float_array(x):
12801280

12811281

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

0 commit comments

Comments
 (0)