From 3d7c92cf4ae48d29a87bed5544c56fcf333d7e33 Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Thu, 2 Sep 2021 11:20:20 +0200 Subject: [PATCH] Docstring cleanups. Mostly D401 (imperative mood) fixes, and a few other things. --- lib/matplotlib/backend_tools.py | 2 +- lib/matplotlib/backends/backend_wx.py | 4 ++-- lib/matplotlib/colors.py | 2 +- lib/matplotlib/lines.py | 4 ++-- lib/matplotlib/path.py | 2 +- lib/matplotlib/testing/widgets.py | 7 ++++--- lib/matplotlib/widgets.py | 2 +- lib/mpl_toolkits/axisartist/axisline_style.py | 8 ++------ 8 files changed, 14 insertions(+), 17 deletions(-) diff --git a/lib/matplotlib/backend_tools.py b/lib/matplotlib/backend_tools.py index cc81b1f9269b..390b90134aed 100644 --- a/lib/matplotlib/backend_tools.py +++ b/lib/matplotlib/backend_tools.py @@ -900,7 +900,7 @@ class ToolHelpBase(ToolBase): @staticmethod def format_shortcut(key_sequence): """ - Converts a shortcut string from the notation used in rc config to the + Convert a shortcut string from the notation used in rc config to the standard notation for displaying shortcuts, e.g. 'ctrl+a' -> 'Ctrl+A'. """ return (key_sequence if len(key_sequence) == 1 else diff --git a/lib/matplotlib/backends/backend_wx.py b/lib/matplotlib/backends/backend_wx.py index 16b152a51689..da78f69d9e8e 100644 --- a/lib/matplotlib/backends/backend_wx.py +++ b/lib/matplotlib/backends/backend_wx.py @@ -592,8 +592,8 @@ def _get_imagesave_wildcards(self): @_api.delete_parameter("3.4", "origin") def gui_repaint(self, drawDC=None, origin='WX'): """ - Performs update of the displayed image on the GUI canvas, using the - supplied wx.PaintDC device context. + Update the displayed image on the GUI canvas, using the supplied + wx.PaintDC device context. The 'WXAgg' backend sets origin accordingly. """ diff --git a/lib/matplotlib/colors.py b/lib/matplotlib/colors.py index f75e069d3083..91fe214f6412 100644 --- a/lib/matplotlib/colors.py +++ b/lib/matplotlib/colors.py @@ -2324,7 +2324,7 @@ def blend_soft_light(self, rgb, intensity): def blend_overlay(self, rgb, intensity): """ - Combines an rgb image with an intensity map using "overlay" blending. + Combine an rgb image with an intensity map using "overlay" blending. Parameters ---------- diff --git a/lib/matplotlib/lines.py b/lib/matplotlib/lines.py index 8f4ddaa5c6ea..9a727f9a8107 100644 --- a/lib/matplotlib/lines.py +++ b/lib/matplotlib/lines.py @@ -601,7 +601,7 @@ def get_markevery(self): def set_picker(self, p): """ - Sets the event picker details for the line. + Set the event picker details for the line. Parameters ---------- @@ -688,7 +688,7 @@ def recache(self, always=False): def _transform_path(self, subslice=None): """ - Puts a TransformedPath instance at self._transformed_path; + Put a TransformedPath instance at self._transformed_path; all invalidation of the transform is then handled by the TransformedPath instance. """ diff --git a/lib/matplotlib/path.py b/lib/matplotlib/path.py index c09250123fb9..4280d55eeacd 100644 --- a/lib/matplotlib/path.py +++ b/lib/matplotlib/path.py @@ -162,7 +162,7 @@ def __init__(self, vertices, codes=None, _interpolation_steps=1, @classmethod def _fast_from_codes_and_verts(cls, verts, codes, internals_from=None): """ - Creates a Path instance without the expense of calling the constructor. + Create a Path instance without the expense of calling the constructor. Parameters ---------- diff --git a/lib/matplotlib/testing/widgets.py b/lib/matplotlib/testing/widgets.py index 49d5cb7175f9..3c3a4b6273bc 100644 --- a/lib/matplotlib/testing/widgets.py +++ b/lib/matplotlib/testing/widgets.py @@ -2,15 +2,16 @@ ======================== Widget testing utilities ======================== -Functions that are useful for testing widgets. -See also matplotlib.tests.test_widgets + +See also :mod:`matplotlib.tests.test_widgets`. """ + import matplotlib.pyplot as plt from unittest import mock def get_ax(): - """Creates plot and returns its axes""" + """Create a plot and return its axes.""" fig, ax = plt.subplots(1, 1) ax.plot([0, 200], [0, 200]) ax.set_aspect(1.0) diff --git a/lib/matplotlib/widgets.py b/lib/matplotlib/widgets.py index 155b3b3f7b15..220fb1d280cd 100644 --- a/lib/matplotlib/widgets.py +++ b/lib/matplotlib/widgets.py @@ -2710,7 +2710,7 @@ def onselect(eclick: MouseEvent, erelease: MouseEvent) - "move": Move the existing shape, default: no modifier. - "clear": Clear the current shape, default: "escape". - - "square": Makes the shape square, default: "shift". + - "square": Make the shape square, default: "shift". - "center": Make the initial point the center of the shape, default: "ctrl". diff --git a/lib/mpl_toolkits/axisartist/axisline_style.py b/lib/mpl_toolkits/axisartist/axisline_style.py index 80f3ce58eb48..db4b0c144c5e 100644 --- a/lib/mpl_toolkits/axisartist/axisline_style.py +++ b/lib/mpl_toolkits/axisartist/axisline_style.py @@ -9,9 +9,7 @@ class _FancyAxislineStyle: class SimpleArrow(FancyArrowPatch): - """ - The artist class that will be returned for SimpleArrow style. - """ + """The artist class that will be returned for SimpleArrow style.""" _ARROW_STYLE = "->" def __init__(self, axis_artist, line_path, transform, @@ -69,9 +67,7 @@ def draw(self, renderer): FancyArrowPatch.draw(self, renderer) class FilledArrow(SimpleArrow): - """ - The artist class that will be returned for SimpleArrow style. - """ + """The artist class that will be returned for SimpleArrow style.""" _ARROW_STYLE = "-|>"