Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5d86d45

Browse filesBrowse files
committed
backend_agg cleanup.
- Deprecate unused RendererAgg.debug variable. - Passing debug=False to _RendererAgg has no effect (PyRendererAgg_init actually ignores kwds, and doesn't do anything with debug if it is passed positionally either). - Moved a comment that was at the wrong line. - Wrapped lines to 79 chars; removed allowance in pep8 checker.
1 parent 6336f2d commit 5d86d45
Copy full SHA for 5d86d45

File tree

Expand file treeCollapse file tree

2 files changed

+18
-12
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+18
-12
lines changed

‎lib/matplotlib/backends/backend_agg.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_agg.py
+17-11Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
import numpy as np
2929
from collections import OrderedDict
3030
from math import radians, cos, sin
31-
from matplotlib import rcParams, __version__
31+
from matplotlib import cbook, rcParams, __version__
3232
from matplotlib.backend_bases import (
3333
_Backend, FigureCanvasBase, FigureManagerBase, RendererBase, cursors)
3434
from matplotlib.figure import Figure
@@ -68,7 +68,11 @@ class RendererAgg(RendererBase):
6868
The renderer handles all the drawing primitives using a graphics
6969
context instance that controls the colors/styles
7070
"""
71-
debug=1
71+
72+
@property
73+
@cbook.deprecated("2.2")
74+
def debug(self):
75+
return 1
7276

7377
# we want to cache the fonts at the class level so that when
7478
# multiple figures are created we can reuse them. This helps with
@@ -79,16 +83,17 @@ class RendererAgg(RendererBase):
7983
# draw, and release it when it is done. This allows multiple
8084
# renderers to share the cached fonts, but only one figure can
8185
# draw at time and so the font cache is used by only one
82-
# renderer at a time
86+
# renderer at a time.
8387

8488
lock = threading.RLock()
89+
8590
def __init__(self, width, height, dpi):
8691
RendererBase.__init__(self)
8792

8893
self.dpi = dpi
8994
self.width = width
9095
self.height = height
91-
self._renderer = _RendererAgg(int(width), int(height), dpi, debug=False)
96+
self._renderer = _RendererAgg(int(width), int(height), dpi)
9297
self._filter_renderers = []
9398

9499
self._update_methods()
@@ -158,12 +163,14 @@ def draw_path(self, gc, path, transform, rgbFace=None):
158163
try:
159164
self._renderer.draw_path(gc, p, transform, rgbFace)
160165
except OverflowError:
161-
raise OverflowError("Exceeded cell block limit (set 'agg.path.chunksize' rcparam)")
166+
raise OverflowError("Exceeded cell block limit (set "
167+
"'agg.path.chunksize' rcparam)")
162168
else:
163169
try:
164170
self._renderer.draw_path(gc, path, transform, rgbFace)
165171
except OverflowError:
166-
raise OverflowError("Exceeded cell block limit (set 'agg.path.chunksize' rcparam)")
172+
raise OverflowError("Exceeded cell block limit (set "
173+
"'agg.path.chunksize' rcparam)")
167174

168175

169176
def draw_mathtext(self, gc, x, y, s, prop, angle):
@@ -232,8 +239,8 @@ def get_text_width_height_descent(self, s, prop, ismath):
232239

233240
flags = get_hinting_flag()
234241
font = self._get_agg_font(prop)
235-
font.set_text(s, 0.0, flags=flags) # the width and height of unrotated string
236-
w, h = font.get_width_height()
242+
font.set_text(s, 0.0, flags=flags)
243+
w, h = font.get_width_height() # width and height of unrotated string
237244
d = font.get_descent()
238245
w /= 64.0 # convert from subpixels
239246
h /= 64.0
@@ -367,9 +374,8 @@ def post_processing(image, dpi):
367374
post_processing is plotted (using draw_image) on it.
368375
"""
369376

370-
# WARNING.
371-
# For agg_filter to work, the rendere's method need
372-
# to overridden in the class. See draw_markers, and draw_path_collections
377+
# WARNING: For agg_filter to work, the renderer's method need to
378+
# overridden in the class. See draw_markers and draw_path_collections.
373379

374380
width, height = int(self.width), int(self.height)
375381

‎pytest.ini

Copy file name to clipboardExpand all lines: pytest.ini
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pep8ignore =
2323
tools/subset.py E221 E231 E251 E261 E302 E501 E701 E703
2424

2525
matplotlib/backends/qt_editor/formlayout.py E301 E402 E501
26-
matplotlib/backends/backend_agg.py E225 E228 E231 E261 E301 E302 E303 E501 E701
26+
matplotlib/backends/backend_agg.py E225 E228 E231 E261 E301 E302 E303 E701
2727
matplotlib/backends/backend_cairo.py E203 E211 E221 E231 E261 E272 E302 E303 E401 E402 E501 E701 E711
2828
matplotlib/backends/backend_gdk.py E202 E203 E211 E221 E225 E231 E261 E302 E303 E402 E501 E702 E711
2929
matplotlib/backends/backend_gtk.py E201 E202 E203 E211 E221 E222 E225 E231 E251 E261 E262 E301 E302 E303 E401 E402 E501 E701 E702 E703

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.