|
34 | 34 | from .volumeutils import array_from_file, apply_read_scaling
|
35 | 35 | from .fileslice import fileslice
|
36 | 36 | from .keywordonly import kw_only_meth
|
37 |
| -from .openers import ImageOpener |
| 37 | +from .openers import ImageOpener, HAVE_INDEXED_GZIP |
38 | 38 |
|
39 | 39 |
|
40 | 40 | class ArrayProxy(object):
|
@@ -195,13 +195,7 @@ def _should_keep_file_open(self, file_like, keep_file_open):
|
195 | 195 | return bool(keep_file_open)
|
196 | 196 | # Otherwise, if file_like is gzipped, and we have_indexed_gzip, we set
|
197 | 197 | # keep_file_open to True, else we set it to False
|
198 |
| - try: |
199 |
| - import indexed_gzip |
200 |
| - have_indexed_gzip = True |
201 |
| - except ImportError: |
202 |
| - have_indexed_gzip = False |
203 |
| - |
204 |
| - return have_indexed_gzip and file_like.endswith('gz') |
| 198 | + return HAVE_INDEXED_GZIP and file_like.endswith('gz') |
205 | 199 |
|
206 | 200 | @property
|
207 | 201 | @deprecate_with_version('ArrayProxy.header deprecated', '2.2', '3.0')
|
@@ -259,7 +253,7 @@ def get_unscaled(self):
|
259 | 253 |
|
260 | 254 | This is an optional part of the proxy API
|
261 | 255 | """
|
262 |
| - with self._get_fileobj() as fileobj: |
| 256 | + with self._get_fileobj() as fileobj, self._lock: |
263 | 257 | raw_data = array_from_file(self._shape,
|
264 | 258 | self._dtype,
|
265 | 259 | fileobj,
|
|
0 commit comments