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 e6ebf8e

Browse filesBrowse files
committed
Merge remote-tracking branch 'matplotlib/v2.x'
2 parents 6bac790 + e63dff6 commit e6ebf8e
Copy full SHA for e6ebf8e

File tree

Expand file treeCollapse file tree

5 files changed

+31
-21
lines changed
Filter options
Expand file treeCollapse file tree

5 files changed

+31
-21
lines changed

‎.travis.yml

Copy file name to clipboardExpand all lines: .travis.yml
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,8 @@ script:
139139
deactivate
140140
source ~/virtualenv/python2.7/bin/activate
141141
pip install pip --upgrade
142-
pip install linkchecker
142+
# linkchecker is currently broken with requests 2.10.0 so force an earlier version
143+
pip install $PRE requests==2.9.2 linkchecker
143144
linkchecker build/html/index.html
144145
fi
145146
- rm -rf $HOME/.cache/matplotlib/tex.cache

‎lib/matplotlib/animation.py

Copy file name to clipboardExpand all lines: lib/matplotlib/animation.py
+8-2Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1217,8 +1217,8 @@ class FuncAnimation(TimedAnimation):
12171217
results of drawing from the first item in the frames sequence will be
12181218
used. This function will be called once before the first frame.
12191219
1220-
If blit=True, *func* and *init_func* should return an iterable of
1221-
drawables to clear.
1220+
If blit=True, *func* and *init_func* must return an iterable of
1221+
artists to be re-drawn.
12221222
12231223
*kwargs* include *repeat*, *repeat_delay*, and *interval*:
12241224
*interval* draws a new frame every *interval* milliseconds.
@@ -1299,6 +1299,9 @@ def _init_draw(self):
12991299
else:
13001300
self._drawn_artists = self._init_func()
13011301
if self._blit:
1302+
if self._drawn_artists is None:
1303+
raise RuntimeError('The init_func must return a '
1304+
'sequence of Artist objects.')
13021305
for a in self._drawn_artists:
13031306
a.set_animated(self._blit)
13041307
self._save_seq = []
@@ -1315,5 +1318,8 @@ def _draw_frame(self, framedata):
13151318
# func needs to return a sequence of any artists that were modified.
13161319
self._drawn_artists = self._func(framedata, *self._args)
13171320
if self._blit:
1321+
if self._drawn_artists is None:
1322+
raise RuntimeError('The animation function must return a '
1323+
'sequence of Artist objects.')
13181324
for a in self._drawn_artists:
13191325
a.set_animated(self._blit)

‎lib/matplotlib/backends/backend_ps.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_ps.py
+8-7Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -165,15 +165,16 @@ def _num_to_str(val):
165165
def _nums_to_str(*args):
166166
return ' '.join(map(_num_to_str,args))
167167

168+
168169
def quote_ps_string(s):
169170
"Quote dangerous characters of S for use in a PostScript string constant."
170-
s=s.replace("\\", "\\\\")
171-
s=s.replace("(", "\\(")
172-
s=s.replace(")", "\\)")
173-
s=s.replace("'", "\\251")
174-
s=s.replace("`", "\\301")
175-
s=re.sub(r"[^ -~\n]", lambda x: r"\%03o"%ord(x.group()), s)
176-
return s
171+
s = s.replace(b"\\", b"\\\\")
172+
s = s.replace(b"(", b"\\(")
173+
s = s.replace(b")", b"\\)")
174+
s = s.replace(b"'", b"\\251")
175+
s = s.replace(b"`", b"\\301")
176+
s = re.sub(br"[^ -~\n]", lambda x: br"\%03o" % ord(x.group()), s)
177+
return s.decode('ascii')
177178

178179

179180
def seq_allequal(seq1, seq2):

‎lib/matplotlib/rcsetup.py

Copy file name to clipboardExpand all lines: lib/matplotlib/rcsetup.py
+10-11Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -760,17 +760,16 @@ def validate_cycler(s):
760760
# might come from the internet (future plans), this
761761
# could be downright dangerous.
762762
# I locked it down by only having the 'cycler()' function
763-
# available. Imports and defs should not
764-
# be possible. However, it is entirely possible that
765-
# a security hole could open up via attributes to the
766-
# function (this is why I decided against allowing the
767-
# Cycler class object just to reduce the number of
768-
# degrees of freedom (but maybe it is safer to use?).
769-
# One possible hole I can think of (in theory) is if
770-
# someone managed to hack the cycler module. But, if
771-
# someone does that, this wouldn't make anything
772-
# worse because we have to import the module anyway.
773-
s = eval(s, {'cycler': cycler})
763+
# available.
764+
# UPDATE: Partly plugging a security hole.
765+
# I really should have read this:
766+
# http://nedbatchelder.com/blog/201206/eval_really_is_dangerous.html
767+
# We should replace this eval with a combo of PyParsing and
768+
# ast.literal_eval()
769+
if '.__' in s.replace(' ', ''):
770+
raise ValueError("'%s' seems to have dunder methods. Raising"
771+
" an exception for your safety")
772+
s = eval(s, {'cycler': cycler, '__builtins__': {}})
774773
except BaseException as e:
775774
raise ValueError("'%s' is not a valid cycler construction: %s" %
776775
(s, e))

‎lib/matplotlib/ticker.py

Copy file name to clipboardExpand all lines: lib/matplotlib/ticker.py
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,9 @@
135135
:class:`EngFormatter`
136136
Format labels in engineering notation
137137
138+
:class:`EngFormatter`
139+
Format labels in engineering notation
140+
138141
:class:`PercentFormatter`
139142
Format labels as a percentage
140143

0 commit comments

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