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 51c79c8

Browse filesBrowse files
authored
Merge pull request #10867 from tacaswell/fix_hide_bz2
MNT: move bz2 back to function level
2 parents 7a3248f + ffe9203 commit 51c79c8
Copy full SHA for 51c79c8

File tree

Expand file treeCollapse file tree

1 file changed

+3
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+3
-1
lines changed

‎lib/matplotlib/cbook/__init__.py

Copy file name to clipboardExpand all lines: lib/matplotlib/cbook/__init__.py
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
import six
1010
from six.moves import xrange, zip
11-
import bz2
1211
import collections
1312
import contextlib
1413
import datetime
@@ -478,6 +477,9 @@ def to_filehandle(fname, flag='rU', return_opened=False, encoding=None):
478477
flag = flag.replace('U', '')
479478
fh = gzip.open(fname, flag)
480479
elif fname.endswith('.bz2'):
480+
# python may not be complied with bz2 support,
481+
# bury import until we need it
482+
import bz2
481483
# get rid of 'U' in flag for bz2 files
482484
flag = flag.replace('U', '')
483485
fh = bz2.BZ2File(fname, flag)

0 commit comments

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