8000 MNT: move bz2 back to function level · matplotlib/matplotlib@ffe9203 · GitHub
[go: up one dir, main page]

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 ffe9203

Browse files
committed
MNT: move bz2 back to function level
closes #10866
1 parent 7a3248f commit ffe9203

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/matplotlib/cbook/__init__.py

Lines 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