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

Skip to content

Commit aa7a399

Browse files
committed
BUG: add fix for Python 2.6 compatibility
re.flags argument to re.sub appears to a 2.7 innovation.
1 parent ac21ebe commit aa7a399

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/matplotlib/sphinxext/plot_directive.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,8 +334,8 @@ def remove_coding(text):
334334
"""
335335
Remove the coding comment, which six.exec_ doesn't like.
336336
"""
337-
return re.sub(
338-
"^#\s*-\*-\s*coding:\s*.*-\*-$", "", text, flags=re.MULTILINE)
337+
sub_re = re.compile("^#\s*-\*-\s*coding:\s*.*-\*-$", flags=re.MULTILINE)
338+
return sub_re.sub("", text)
339339

340340
#------------------------------------------------------------------------------
341341
# Template

0 commit comments

Comments
 (0)