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 2164417

Browse filesBrowse files
authored
Merge pull request #10708 from anntzer/py3webagg
Py3fy webagg/nbagg.
2 parents b6acd04 + 0405eba commit 2164417
Copy full SHA for 2164417

File tree

Expand file treeCollapse file tree

2 files changed

+4
-20
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+4
-20
lines changed

‎lib/matplotlib/backends/backend_nbagg.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_nbagg.py
+1-5Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
# lib/matplotlib/backends/web_backend/nbagg_uat.ipynb to help verify
44
# that changes made maintain expected behaviour.
55

6-
import six
7-
86
from base64 import b64encode
97
import io
108
import json
@@ -204,9 +202,7 @@ def send_json(self, content):
204202
def send_binary(self, blob):
205203
# The comm is ascii, so we always send the image in base64
206204
# encoded data URL form.
207-
data = b64encode(blob)
208-
if six.PY3:
209-
data = data.decode('ascii')
205+
data = b64encode(blob).decode('ascii')
210206
data_uri = "data:image/png;base64,{0}".format(data)
211207
self.comm.send({'data': data_uri})
212208

‎lib/matplotlib/backends/backend_webagg_core.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_webagg_core.py
+3-15Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,6 @@
1010
# - `backend_webagg.py` contains a concrete implementation of a basic
1111
# application, implemented with tornado.
1212

13-
from __future__ import (absolute_import, division, print_function,
14-
unicode_literals)
15-
16-
import six
17-
1813
import datetime
1914
import io
2015
import json
@@ -26,8 +21,7 @@
2621

2722
from matplotlib.backends import backend_agg
2823
from matplotlib.backend_bases import _Backend
29-
from matplotlib import backend_bases
30-
from matplotlib import _png
24+
from matplotlib import backend_bases, _png
3125

3226

3327
# http://www.cambiaresearch.com/articles/15/javascript-char-codes-key-codes
@@ -150,17 +144,11 @@ def show(self):
150144
show()
151145

152146
def draw(self):
153-
renderer = self.get_renderer(cleared=True)
154-
155147
self._png_is_old = True
156-
157-
backend_agg.RendererAgg.lock.acquire()
158148
try:
159-
self.figure.draw(renderer)
149+
super().draw()
160150
finally:
161-
backend_agg.RendererAgg.lock.release()
162-
# Swap the frames
163-
self.manager.refresh_all()
151+
self.manager.refresh_all() # Swap the frames.
164152

165153
def draw_idle(self):
166154
self.send_event("draw")

0 commit comments

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