Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0863d4d

Browse files
authored
Merge pull request #15543 from meeseeksmachine/auto-backport-of-pr-15539-on-v3.2.x
Backport PR #15539 on branch v3.2.x (Small cleanups to backend docs.)
2 parents 3257892 + 08b7df4 commit 0863d4d

File tree

8 files changed

+36
-45
lines changed

8 files changed

+36
-45
lines changed

lib/matplotlib/backends/backend_gtk3.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@
5151

5252

5353
class TimerGTK3(TimerBase):
54-
'''
55-
Subclass of :class:`backend_bases.TimerBase` using GTK3 for timer events.
54+
"""
55+
Subclass of `.TimerBase` using GTK3 for timer events.
5656
5757
Attributes
5858
----------
@@ -65,8 +65,8 @@ class TimerGTK3(TimerBase):
6565
Stores list of (func, args) tuples that will be called upon timer
6666
events. This list can be manipulated directly, or the functions
6767
`add_callback` and `remove_callback` can be used.
68+
"""
6869

69-
'''
7070
def _timer_start(self):
7171
# Need to stop it, otherwise we potentially leak a timer id that will
7272
# never be stopped.

lib/matplotlib/backends/backend_macosx.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919

2020

2121
class TimerMac(_macosx.Timer, TimerBase):
22-
'''
23-
Subclass of :class:`backend_bases.TimerBase` that uses CoreFoundation
24-
run loops for timer events.
22+
"""
23+
Subclass of `.TimerBase` that uses CoreFoundation run loops for timer
24+
events.
2525
2626
Attributes
2727
----------
@@ -34,8 +34,7 @@ class TimerMac(_macosx.Timer, TimerBase):
3434
Stores list of (func, args) tuples that will be called upon timer
3535
events. This list can be manipulated directly, or the functions
3636
`add_callback` and `remove_callback` can be used.
37-
38-
'''
37+
"""
3938
# completely implemented at the C-level (in _macosx.Timer)
4039

4140

lib/matplotlib/backends/backend_pdf.py

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2401,9 +2401,8 @@ class PdfPages:
24012401
24022402
Notes
24032403
-----
2404-
In reality :class:`PdfPages` is a thin wrapper around :class:`PdfFile`, in
2405-
order to avoid confusion when using :func:`~matplotlib.pyplot.savefig` and
2406-
forgetting the format argument.
2404+
In reality `PdfPages` is a thin wrapper around `PdfFile`, in order to avoid
2405+
confusion when using `~.pyplot.savefig` and forgetting the format argument.
24072406
"""
24082407
__slots__ = ('_file', 'keep_empty')
24092408

@@ -2414,9 +2413,9 @@ def __init__(self, filename, keep_empty=True, metadata=None):
24142413
Parameters
24152414
----------
24162415
filename : str or path-like or file-like
2417-
Plots using :meth:`PdfPages.savefig` will be written to a file at
2418-
this location. The file is opened at once and any older file with
2419-
the same name is overwritten.
2416+
Plots using `PdfPages.savefig` will be written to a file at this
2417+
location. The file is opened at once and any older file with the
2418+
same name is overwritten.
24202419
keep_empty : bool, optional
24212420
If set to False, then empty pdf files will be deleted automatically
24222421
when closed.
@@ -2464,18 +2463,17 @@ def infodict(self):
24642463

24652464
def savefig(self, figure=None, **kwargs):
24662465
"""
2467-
Saves a :class:`~matplotlib.figure.Figure` to this file as a new page.
2466+
Saves a `.Figure` to this file as a new page.
24682467
2469-
Any other keyword arguments are passed to
2470-
:meth:`~matplotlib.figure.Figure.savefig`.
2468+
Any other keyword arguments are passed to `~.Figure.savefig`.
24712469
24722470
Parameters
24732471
----------
2474-
figure : :class:`~matplotlib.figure.Figure` or int, optional
2472+
figure : `.Figure` or int, optional
24752473
Specifies what figure is saved to file. If not specified, the
2476-
active figure is saved. If a :class:`~matplotlib.figure.Figure`
2477-
instance is provided, this figure is saved. If an int is specified,
2478-
the figure instance to save is looked up by number.
2474+
active figure is saved. If a `.Figure` instance is provided, this
2475+
figure is saved. If an int is specified, the figure instance to
2476+
save is looked up by number.
24792477
"""
24802478
if not isinstance(figure, Figure):
24812479
if figure is None:

lib/matplotlib/backends/backend_pgf.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,8 +1017,8 @@ def __init__(self, filename, *, keep_empty=True, metadata=None):
10171017
Parameters
10181018
----------
10191019
filename : str or path-like
1020-
Plots using :meth:`PdfPages.savefig` will be written to a file at
1021-
this location. Any older file with the same name is overwritten.
1020+
Plots using `PdfPages.savefig` will be written to a file at this
1021+
location. Any older file with the same name is overwritten.
10221022
keep_empty : bool, optional
10231023
If set to False, then empty pdf files will be deleted automatically
10241024
when closed.
@@ -1127,18 +1127,17 @@ def _run_latex(self):
11271127

11281128
def savefig(self, figure=None, **kwargs):
11291129
"""
1130-
Saves a :class:`~matplotlib.figure.Figure` to this file as a new page.
1130+
Saves a `.Figure` to this file as a new page.
11311131
1132-
Any other keyword arguments are passed to
1133-
:meth:`~matplotlib.figure.Figure.savefig`.
1132+
Any other keyword arguments are passed to `~.Figure.savefig`.
11341133
11351134
Parameters
11361135
----------
1137-
figure : :class:`~matplotlib.figure.Figure` or int, optional
1136+
figure : `.Figure` or int, optional
11381137
Specifies what figure is saved to file. If not specified, the
1139-
active figure is saved. If a :class:`~matplotlib.figure.Figure`
1140-
instance is provided, this figure is saved. If an int is specified,
1141-
the figure instance to save is looked up by number.
1138+
active figure is saved. If a `.Figure` instance is provided, this
1139+
figure is saved. If an int is specified, the figure instance to
1140+
save is looked up by number.
11421141
"""
11431142
if not isinstance(figure, Figure):
11441143
if figure is None:

lib/matplotlib/backends/backend_qt5.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,8 @@ def wrapper(self, *args, **kwargs):
175175

176176

177177
class TimerQT(TimerBase):
178-
'''
179-
Subclass of :class:`backend_bases.TimerBase` that uses Qt timer events.
178+
"""
179+
Subclass of `.TimerBase` that uses Qt timer events.
180180
181181
Attributes
182182
----------
@@ -189,8 +189,7 @@ class TimerQT(TimerBase):
189189
Stores list of (func, args) tuples that will be called upon timer
190190
events. This list can be manipulated directly, or the functions
191191
`add_callback` and `remove_callback` can be used.
192-
193-
'''
192+
"""
194193

195194
def __init__(self, *args, **kwargs):
196195
TimerBase.__init__(self, *args, **kwargs)

lib/matplotlib/backends/backend_qt5agg.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ def __init__(self, figure):
2121
super().__init__(figure=figure)
2222

2323
def paintEvent(self, event):
24-
"""Copy the image from the Agg canvas to the qt.drawable.
24+
"""
25+
Copy the image from the Agg canvas to the qt.drawable.
2526
2627
In Qt, all drawing should be done inside of here when a widget is
2728
shown onscreen.
@@ -78,8 +79,7 @@ def paintEvent(self, event):
7879
painter.end()
7980

8081
def blit(self, bbox=None):
81-
"""Blit the region in bbox.
82-
"""
82+
# docstring inherited
8383
# If bbox is None, blit the entire canvas. Otherwise
8484
# blit only the area defined by the bbox.
8585
if bbox is None and self.figure:

lib/matplotlib/backends/backend_wx.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ def raise_msg_to_str(msg):
9999

100100

101101
class TimerWx(TimerBase):
102-
'''
103-
Subclass of :class:`backend_bases.TimerBase` that uses WxTimer events.
102+
"""
103+
Subclass of `.TimerBase` that uses WxTimer events.
104104
105105
Attributes
106106
----------
@@ -113,8 +113,7 @@ class TimerWx(TimerBase):
113113
Stores list of (func, args) tuples that will be called upon timer
114114
events. This list can be manipulated directly, or the functions
115115
`add_callback` and `remove_callback` can be used.
116-
117-
'''
116+
"""
118117

119118
def __init__(self, *args, **kwargs):
120119
if args and isinstance(args[0], wx.EvtHandler):

lib/matplotlib/backends/backend_wxagg.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,7 @@ def draw(self, drawDC=None):
3333
self.gui_repaint(drawDC=drawDC, origin='WXAgg')
3434

3535
def blit(self, bbox=None):
36-
"""
37-
Transfer the region of the agg buffer defined by bbox to the display.
38-
If bbox is None, the entire buffer is transferred.
39-
"""
36+
# docstring inherited
4037
if bbox is None:
4138
self.bitmap = _convert_agg_to_wx_bitmap(self.get_renderer(), None)
4239
self.gui_repaint()

0 commit comments

Comments
 (0)