Skip to content

Commit 7dd74e2

Browse files
committed
Fix most instances of D404 ("docstring should not start with 'this').
... and associated rewordings.
1 parent 291d5d7 commit 7dd74e2

37 files changed

+184
-207
lines changed

lib/matplotlib/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
This is an object-oriented plotting library.
2+
An object-oriented plotting library.
33
44
A procedural interface is provided by the companion pyplot module,
55
which may be imported directly, e.g.::

lib/matplotlib/_constrained_layout.py

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
"""
2-
This module provides the routine to adjust subplot layouts so that there are
3-
no overlapping axes or axes decorations. All axes decorations are dealt with
4-
(labels, ticks, titles, ticklabels) and some dependent artists are also dealt
5-
with (colorbar, suptitle, legend).
6-
7-
Layout is done via :meth:`~matplotlib.gridspec`, with one constraint per
8-
gridspec, so it is possible to have overlapping axes if the gridspecs
9-
overlap (i.e. using :meth:`~matplotlib.gridspec.GridSpecFromSubplotSpec`).
10-
Axes placed using ``figure.subplots()`` or ``figure.add_subplots()`` will
11-
participate in the layout. Axes manually placed via ``figure.add_axes()``
12-
will not.
2+
Adjust subplot layouts so that there are no overlapping axes or axes
3+
decorations. All axes decorations are dealt with (labels, ticks, titles,
4+
ticklabels) and some dependent artists are also dealt with (colorbar, suptitle,
5+
legend).
136
14-
See Tutorial: :doc:`/tutorials/intermediate/constrainedlayout_guide`
7+
Layout is done via `~matplotlib.gridspec`, with one constraint per gridspec,
8+
so it is possible to have overlapping axes if the gridspecs overlap (i.e.
9+
using `~matplotlib.gridspec.GridSpecFromSubplotSpec`). Axes placed using
10+
``figure.subplots()`` or ``figure.add_subplots()`` will participate in the
11+
layout. Axes manually placed via ``figure.add_axes()`` will not.
1512
13+
See Tutorial: :doc:`/tutorials/intermediate/constrainedlayout_guide`
1614
"""
1715

1816
# Development Notes:

lib/matplotlib/afm.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
"""
2-
This is a python interface to Adobe Font Metrics Files. Although a
3-
number of other python implementations exist, and may be more complete
4-
than this, it was decided not to go with them because they were either:
2+
A python interface to Adobe Font Metrics Files.
3+
4+
Although a number of other python implementations exist, and may be more
5+
complete than this, it was decided not to go with them because they were
6+
either:
57
68
1) copyrighted or used a non-BSD compatible license
79
2) had too many dependencies and a free standing lib was needed
810
3) did more than needed and it was easier to write afresh rather than
911
figure out how to get just what was needed.
1012
11-
It is pretty easy to use, and requires only built-in python libs:
13+
It is pretty easy to use, and has no external depedencies:
1214
1315
>>> import matplotlib as mpl
1416
>>> from pathlib import Path

lib/matplotlib/animation.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -890,12 +890,10 @@ def finish(self):
890890

891891
class Animation:
892892
"""
893-
This class wraps the creation of an animation using matplotlib.
893+
A base class for Animations.
894894
895-
It is only a base class which should be subclassed to provide
896-
needed behavior.
897-
898-
This class is not typically used directly.
895+
This class is not usable as is, and should be subclassed to provide needed
896+
behavior.
899897
900898
Parameters
901899
----------

lib/matplotlib/axes/_base.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2763,9 +2763,10 @@ def draw(self, renderer=None, inframe=False):
27632763

27642764
def draw_artist(self, a):
27652765
"""
2766-
This method can only be used after an initial draw which
2767-
caches the renderer. It is used to efficiently update Axes
2768-
data (axis ticks, labels, etc are not updated).
2766+
Efficiently redraw a single artist.
2767+
2768+
This method can only be used after an initial draw which caches the
2769+
renderer.
27692770
"""
27702771
if self.figure._cachedRenderer is None:
27712772
raise AttributeError("draw_artist can only be used after an "
@@ -2774,9 +2775,11 @@ def draw_artist(self, a):
27742775

27752776
def redraw_in_frame(self):
27762777
"""
2777-
This method can only be used after an initial draw which
2778-
caches the renderer. It is used to efficiently update Axes
2779-
data (axis ticks, labels, etc are not updated).
2778+
It is used to efficiently redraw Axes data (axis ticks, labels, etc.,
2779+
are not redrawn).
2780+
2781+
This method can only be used after an initial draw which caches the
2782+
renderer.
27802783
"""
27812784
if self.figure._cachedRenderer is None:
27822785
raise AttributeError("redraw_in_frame can only be used after an "

lib/matplotlib/axes/_subplots.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ def _make_twin_axes(self, *args, **kwargs):
179179
@functools.lru_cache(None)
180180
def subplot_class_factory(axes_class=None):
181181
"""
182-
This makes a new class that inherits from `.SubplotBase` and the
182+
Make a new class that inherits from `.SubplotBase` and the
183183
given axes_class (which is assumed to be a subclass of `.axes.Axes`).
184184
This is perhaps a little bit roundabout to make a new class on
185185
the fly like this, but it means that a new Subplot class does
@@ -207,8 +207,9 @@ def subplot_class_factory(axes_class=None):
207207

208208
def _picklable_subplot_class_constructor(axes_class):
209209
"""
210-
This stub class exists to return the appropriate subplot class when called
211-
with an axes class. This is purely to allow pickling of Axes and Subplots.
210+
Stub factory that returns an empty instance of the appropriate subplot
211+
class when called with an axes class. This is purely to allow pickling of
212+
Axes and Subplots.
212213
"""
213214
subplot_class = subplot_class_factory(axes_class)
214215
return subplot_class.__new__(subplot_class)

lib/matplotlib/backend_bases.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -237,9 +237,8 @@ def draw_quad_mesh(self, gc, master_transform, meshWidth, meshHeight,
237237
coordinates, offsets, offsetTrans, facecolors,
238238
antialiased, edgecolors):
239239
"""
240-
This provides a fallback implementation of
241-
:meth:`draw_quad_mesh` that generates paths and then calls
242-
:meth:`draw_path_collection`.
240+
Fallback implementation of :meth:`draw_quad_mesh` that generates paths
241+
and then calls :meth:`draw_path_collection`.
243242
"""
244243

245244
from matplotlib.collections import QuadMesh
@@ -298,9 +297,8 @@ def draw_gouraud_triangles(self, gc, triangles_array, colors_array,
298297
def _iter_collection_raw_paths(self, master_transform, paths,
299298
all_transforms):
300299
"""
301-
This is a helper method (along with :meth:`_iter_collection`) to make
302-
it easier to write a space-efficient :meth:`draw_path_collection`
303-
implementation in a backend.
300+
Helper method (along with :meth:`_iter_collection`) to implement
301+
:meth:`draw_path_collection` in a space-efficient manner.
304302
305303
This method yields all of the base path/transform
306304
combinations, given a master transform, a list of paths and
@@ -348,10 +346,8 @@ def _iter_collection(self, gc, master_transform, all_transforms,
348346
edgecolors, linewidths, linestyles,
349347
antialiaseds, urls, offset_position):
350348
"""
351-
This is a helper method (along with
352-
:meth:`_iter_collection_raw_paths`) to make it easier to write
353-
a space-efficient :meth:`draw_path_collection` implementation in a
354-
backend.
349+
Helper method (along with :meth:`_iter_collection_raw_paths`) to
350+
implement :meth:`draw_path_collection` in a space-efficient manner.
355351
356352
This method yields all of the path, offset and graphics
357353
context combinations to draw the path collection. The caller

lib/matplotlib/backends/backend_template.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
This is a fully functional do nothing backend to provide a template to backend
2+
A fully functional, do-nothing backend intended as a template for backend
33
writers. It is fully functional in that you can select it as a backend e.g.
44
with ::
55

lib/matplotlib/backends/backend_wx.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,9 +1026,9 @@ def Destroy(self, *args, **kwargs):
10261026

10271027
class FigureManagerWx(FigureManagerBase):
10281028
"""
1029-
This class contains the FigureCanvas and GUI frame
1029+
A class contains the FigureCanvas and GUI frame.
10301030
1031-
It is instantiated by GcfWx whenever a new figure is created. GcfWx is
1031+
It is instantiated by Gcf whenever a new figure is created. Gcf is
10321032
responsible for managing multiple instances of FigureManagerWx.
10331033
10341034
Attributes

lib/matplotlib/backends/qt_editor/figureoptions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ def prepare_data(d, init):
170170
datalist.append((mappables, "Images, etc.", ""))
171171

172172
def apply_callback(data):
173-
"""This function will be called to apply changes"""
173+
"""A callback to apply changes."""
174174
orig_xlim = axes.get_xlim()
175175
orig_ylim = axes.get_ylim()
176176

0 commit comments

Comments
 (0)