8000 Misc doc style cleanup · matplotlib/matplotlib@40d0f9b · GitHub
[go: up one dir, main page]

Skip to content

Commit 40d0f9b

Browse files
committed
Misc doc style cleanup
1 parent 32c7f42 commit 40d0f9b

File tree

1 file changed

+52
-40
lines changed

1 file changed

+52
-40
lines changed

lib/matplotlib/backend_bases.py

Lines changed: 52 additions & 40 deletions
< 1241 td data-grid-cell-id="diff-c21fb96269cbb9b214edf0c22981b347d8b710abaad167da678242ce8a539bb2-3293-3305-2" data-line-anchor="diff-c21fb96269cbb9b214edf0c22981b347d8b710abaad167da678242ce8a539bb2R3305" data-selected="false" role="gridcell" style="background-color:var(--bgColor-default);padding-right:24px" tabindex="-1" valign="top" class="focusable-grid-cell diff-text-cell right-side-diff-cell left-side">
canvas = cls.FigureCanvas(figure)
Original file line numberDiff line numberDiff line change
@@ -160,25 +160,23 @@ def open_group(self, s, gid=None):
160160

161161
def close_group(self, s):
162162
"""
163-
Close a grouping element with label *s*
163+
Close a grouping element with label *s*.
164164
165165
Only used by the SVG renderer.
166166
"""
167167

168168
def draw_path(self, gc, path, transform, rgbFace=None):
169-
"""
170-
Draws a :class:`~matplotlib.path.Path` instance using the
171-
given affine transform.
172-
"""
169+
"""Draw a `~.path.Path` instance using the given affine transform."""
173170
raise NotImplementedError
174171

175172
def draw_markers(self, gc, marker_path, marker_trans, path,
176173
trans, rgbFace=None):
177174
"""
178-
Draws a marker at each of the vertices in path. This includes
179-
all vertices, including control points on curves. To avoid
180-
that behavior, those vertices should be removed before calling
181-
this function.
175+
Draw a marker at each of the vertices in path.
176+
177+
This includes all vertices, including control points on curves.
178+
To avoid that behavior, those vertices should be removed before
179+
calling this function.
182180
183181
This provides a fallback implementation of draw_markers that
184182
makes multiple calls to :meth:`draw_path`. Some backends may
@@ -188,7 +186,7 @@ def draw_markers(self, gc, marker_path, marker_trans, path,
188186
Parameters
189187
----------
190188
gc : `GraphicsContextBase`
191-
The graphics context
189+
The graphics context.
192190
193191
marker_trans : `matplotlib.transforms.Transform`
194192
An affine transform applied to the marker.
@@ -210,7 +208,7 @@ def draw_path_collection(self, gc, master_transform, paths, all_transforms,
210208
linewidths, linestyles, antialiaseds, urls,
211209
offset_position):
212210
"""
213-
Draws a collection of paths selecting drawing properties from
211+
Draw a collection of paths selecting drawing properties from
214212
the lists *facecolors*, *edgecolors*, *linewidths*,
215213
*linestyles* and *antialiaseds*. *offsets* is a list of
216214
offsets to apply to each of the paths. The offsets in
@@ -286,7 +284,7 @@ def draw_gouraud_triangle(self, gc, points, colors, transform):
286284
def draw_gouraud_triangles(self, gc, triangles_array, colors_array,
287285
transform):
288286
"""
289-
Draws a series of Gouraud triangles.
287+
Draw a series of Gouraud triangles.
290288
291289
Parameters
292290
----------
@@ -1680,15 +1678,17 @@ def draw_event(self, renderer):
16801678
self.callbacks.process(s, event)
16811679

16821680
def resize_event(self):
1683-
"""Pass a `ResizeEvent` to all functions connected to ``resize_event``.
1681+
"""
1682+
Pass a `ResizeEvent` to all functions connected to ``resize_event``.
16841683
"""
16851684
s = 'resize_event'
16861685
event = ResizeEvent(s, self)
16871686
self.callbacks.process(s, event)
16881687
self.draw_idle()
16891688

16901689
def close_event(self, guiEvent=None):
1691-
"""Pass a `CloseEvent` to all functions connected to ``close_event``.
1690+
"""
1691+
Pass a `CloseEvent` to all functions connected to ``close_event``.
16921692
"""
16931693
s = 'close_event'
16941694
try:
@@ -1703,7 +1703,8 @@ def close_event(self, guiEvent=None):
17031703
# with an open window; 'callbacks' attribute no longer exists.
17041704

17051705
def key_press_event(self, key, guiEvent=None):
1706-
"""Pass a `KeyEvent` to all functions connected to ``key_press_event``.
1706+
"""
1707+
Pass a `KeyEvent` to all functions connected to ``key_press_event``.
17071708
"""
17081709
self._key = key
17091710
s = 'key_press_event'
@@ -1942,15 +1943,17 @@ def get_width_height(self):
19421943

19431944
@classmethod
19441945
def get_supported_filetypes(cls):
1945-
"""Return dict of savefig file formats supported by this backend"""
1946+
"""Return dict of savefig file formats supported by this backend."""
19461947
return cls.filetypes
19471948

19481949
@classmethod
19491950
def get_supported_filetypes_grouped(cls):
1950-
"""Return a dict of savefig file formats supported by this backend,
1951+
"""
1952+
Return a dict of savefig file formats supported by this backend,
19511953
where the keys are a file type name, such as 'Joint Photographic
19521954
Experts Group', and the values are a list of filename extensions used
1953-
for that filetype, such as ['jpg', 'jpeg']."""
1955+
for that filetype, such as ['jpg', 'jpeg'].
1956+
"""
19541957
groupings = {}
19551958
for ext, name in cls.filetypes.items():
19561959
groupings.setdefault(name, []).append(ext)
@@ -2248,7 +2251,8 @@ def flush_events(self):
22482251
"""
22492252

22502253
def start_event_loop(self, timeout=0):
2251-
"""Start a blocking event loop.
2254+
"""
2255+
Start a blocking event loop.
22522256
22532257
Such an event loop is used by interactive functions, such as `ginput`
22542258
and `waitforbuttonpress`, to wait for events.
@@ -2274,7 +2278,8 @@ def start_event_loop(self, timeout=0):
22742278
counter += 1
22752279

22762280
def stop_event_loop(self):
2277-
"""Stop the current blocking event loop.
2281+
"""
2282+
Stop the current blocking event loop.
22782283
22792284
Interactive backends need to reimplement this to match
22802285
`start_event_loop`
@@ -2550,14 +2555,16 @@ def button_press(self, event):
25502555
button_press_handler(event, self.canvas, self.canvas.toolbar)
25512556

25522557
def get_window_title(self):
2553-
"""Get the title text of the window containing the figure.
2558+
"""
2559+
Get the title text of the window containing the figure.
25542560
25552561
Return None for non-GUI (e.g., PS) backends.
25562562
"""
25572563
return 'image'
25582564

25592565
def set_window_title(self, title):
2560-
"""Set the title text of the window containing the figure.
2566+
"""
2567+
Set the title text of the window containing the figure.
25612568
25622569
This has no effect for non-GUI (e.g., PS) backends.
25632570
"""
@@ -2652,13 +2659,14 @@ def set_message(self, s):
26522659
"""Display a message on toolbar or in status bar."""
26532660

26542661
def back(self, *args):
2655-
"""move back up the view lim stack"""
2662+
"""Move back up the view lim stack."""
26562663
self._nav_stack.back()
26572664
self.set_history_buttons()
26582665
self._update_view()
26592666

26602667
def draw_rubberband(self, event, x0, y0, x1, y1):
2661-
"""Draw a rectangle rubberband to indicate zoom limits.
2668+
"""
2669+
Draw a rectangle rubberband to indicate zoom limits.
26622670
26632671
Note that it is not guaranteed that ``x0 <= x1`` and ``y0 <= y1``.
26642672
"""
@@ -2770,7 +2778,11 @@ def mouse_move(self, event):
27702778
self.set_message(self.mode)
27712779

27722780
def pan(self, *args):
2773-
"""Activate the pan/zoom tool. pan with left button, zoom with right"""
2781+
"""
2782+
Activate the pan/zoom tool.
2783+
2784+
Pan with left button, zoom with right.
2785+
"""
27742786
# set the pointer icon and button press funcs to the
27752787
# appropriate callbacks
27762788

@@ -3010,8 +3022,9 @@ def draw(self):
30103022
self.canvas.draw_idle()
30113023

30123024
def _update_view(self):
3013-
"""Update the viewlim and position from the view and
3014-
position stack for each axes.
3025+
"""
3026+
Update the viewlim and position from the view and position stack for
3027+
each axes.
30153028
"""
30163029
nav_info = self._nav_stack()
30173030
if nav_info is None:
@@ -3031,7 +3044,8 @@ def save_figure(self, *args):
30313044
raise NotImplementedError
30323045

30333046
def set_cursor(self, cursor):
3034-
"""Set the current cursor to one of the :class:`Cursors` enums values.
3047+
"""
3048+
Set the current cursor to one of the :class:`Cursors` enums values.
30353049
30363050
If required by the backend, this method should trigger an update in
30373051
the backend event loop after the cursor is set, as this method may be
@@ -3208,39 +3222,39 @@ def toggle_toolitem(self, name, toggled):
32083222

32093223
def remove_toolitem(self, name):
32103224
"""
3211-
Remove a toolitem from the `ToolContainer`
3225+
Remove a toolitem from the `ToolContainer`.
32123226
3213-
This method must get implemented per backend
3227+
This method must get implemented per backend.
32143228
3215-
Called when `ToolManager` emits a `tool_removed_event`
3229+
Called when `ToolManager` emits a `tool_removed_event`.
32163230
32173231
Parameters
32183232
----------
32193233
name : string
3220-
Name of the tool to remove
3234+
Name of the tool to remove.
32213235
"""
32223236
raise NotImplementedError
32233237

32243238

32253239
class StatusbarBase:
3226-
"""Base class for the statusbar"""
3240+
"""Base class for the statusbar."""
32273241
def __init__(self, toolmanager):
32283242
self.toolmanager = toolmanager
32293243
self.toolmanager.toolmanager_connect('tool_message_event',
32303244
self._message_cbk)
32313245

32323246
def _message_cbk(self, event):
3233-
"""Captures the 'tool_message_event' and set the message"""
3247+
"""Capture the 'tool_message_event' and set the message."""
32343248
self.set_message(event.message)
32353249

32363250
def set_message(self, s):
32373251
"""
3238-
Display a message on toolbar or in status bar
3252+
Display a message on toolbar or in status bar.
32393253
32403254
Parameters
32413255
----------
32423256
s : str
3243-
Message text
3257+
Message text.
32443258
"""
32453259
pass
32463260

@@ -3278,8 +3292,7 @@ class _Backend:
32783292

32793293
@classmethod
32803294
def new_figure_manager(cls, num, *args, **kwargs):
3281-
"""Create a new figure manager instance.
3282-
"""
3295+
"""Create a new figure manager instance."""
32833296
# This import needs to happen here due to circular imports.
32843297
from matplotlib.figure import Figure
32853298
fig_cls = kwargs.pop('FigureClass', Figure)
@@ -3288,8 +3301,7 @@ def new_figure_manager(cls, num, *args, **kwargs):
32883301

32893302
@classmethod
32903303
def new_figure_manager_given_figure(cls, num, figure):
3291-
"""Create a new figure manager instance for the given figure.
3292-
"""
3304+
"""Create a new figure manager instance for the given figure."""
32933305
32943306
manager = cls.FigureManager(canvas, num)
32953307
return manager

0 commit comments

Comments
 (0)
0