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

Skip to content

Commit 80ef99a

Browse files
committed
Small cleanups to backend docs.
Remove unnecessary rst roles. Use """ for triple quotes. Inherit some docstrings.
1 parent 1c6ee08 commit 80ef99a

8 files changed

Lines changed: 36 additions & 45 deletions

File tree

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
@@ -2399,9 +2399,8 @@ class PdfPages:
23992399
24002400
Notes
24012401
-----
2402-
In reality :class:`PdfPages` is a thin wrapper around :class:`PdfFile`, in
2403-
order to avoid confusion when using :func:`~matplotlib.pyplot.savefig` and
2404-
forgetting the format argument.
2402+
In reality `PdfPages` is a thin wrapper around `PdfFile`, in order to avoid
2403+
confusion when using `~.pyplot.savefig` and forgetting the format argument.
24052404
"""
24062405
__slots__ = ('_file', 'keep_empty')
24072406

@@ -2412,9 +2411,9 @@ def __init__(self, filename, keep_empty=True, metadata=None):
24122411
Parameters
24132412
----------
24142413
filename : str or path-like or file-like
2415-
Plots using :meth:`PdfPages.savefig` will be written to a file at
2416-
this location. The file is opened at once and any older file with
2417-
the same name is overwritten.
2414+
Plots using `PdfPages.savefig` will be written to a file at this
2415+
location. The file is opened at once and any older file with the
2416+
same name is overwritten.
24182417
keep_empty : bool, optional
24192418
If set to False, then empty pdf files will be deleted automatically
24202419
when closed.
@@ -2462,18 +2461,17 @@ def infodict(self):
24622461

24632462
def savefig(self, figure=None, **kwargs):
24642463
"""
2465-
Saves a :class:`~matplotlib.figure.Figure` to this file as a new page.
2464+
Saves a `.Figure` to this file as a new page.
24662465
2467-
Any other keyword arguments are passed to
2468-
:meth:`~matplotlib.figure.Figure.savefig`.
2466+
Any other keyword arguments are passed to `~.Figure.savefig`.
24692467
24702468
Parameters
24712469
----------
2472-
figure : :class:`~matplotlib.figure.Figure` or int, optional
2470+
figure : `.Figure` or int, optional
24732471
Specifies what figure is saved to file. If not specified, the
2474-
active figure is saved. If a :class:`~matplotlib.figure.Figure`
2475-
instance is provided, this figure is saved. If an int is specified,
2476-
the figure instance to save is looked up by number.
2472+
active figure is saved. If a `.Figure` instance is provided, this
2473+
figure is saved. If an int is specified, the figure instance to
2474+
save is looked up by number.
24772475
"""
24782476
if not isinstance(figure, Figure):
24792477
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
@@ -100,8 +100,8 @@ def raise_msg_to_str(msg):
100100

101101

102102
class TimerWx(TimerBase):
103-
'''
104-
Subclass of :class:`backend_bases.TimerBase` that uses WxTimer events.
103+
"""
104+
Subclass of `.TimerBase` that uses WxTimer events.
105105
106106
Attributes
107107
----------
@@ -114,8 +114,7 @@ class TimerWx(TimerBase):
114114
Stores list of (func, args) tuples that will be called upon timer
115115
events. This list can be manipulated directly, or the functions
116116
`add_callback` and `remove_callback` can be used.
117-
118-
'''
117+
"""
119118

120119
def __init__(self, *args, **kwargs):
121120
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)