Skip to content

Commit c9fe6fc

Browse files
committed
RF: Remove (HAVE_INDEXED_GZIP, IndexedGzipFile, DeterministicGzipFile, zstd)
from openers module - now located in _compression.
1 parent e9b87f0 commit c9fe6fc

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

nibabel/arrayproxy.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
import numpy as np
3737

3838
from . import openers
39+
from ._compression import HAVE_INDEXED_GZIP
3940
from .fileslice import canonical_slicers, fileslice
4041
from .volumeutils import apply_read_scaling, array_from_file
4142

@@ -263,7 +264,7 @@ def _should_keep_file_open(self, keep_file_open):
263264
- whether ``self.file_like`` is an an open file handle, or a path to a
264265
``'.gz'`` file, or a path to a non-gzip file.
265266
- whether ``indexed_gzip`` is present (see
266-
:attr:`.openers.HAVE_INDEXED_GZIP`).
267+
:attr:`._compression.HAVE_INDEXED_GZIP`).
267268
268269
An ``ArrayProxy`` object uses two internal flags to manage
269270
``ImageOpener`` instances and underlying file handles.
@@ -330,7 +331,7 @@ def _should_keep_file_open(self, keep_file_open):
330331
if self._has_fh():
331332
return False, False
332333
# if the file is a gzip file, and we have_indexed_gzip,
333-
have_igzip = openers.HAVE_INDEXED_GZIP and self.file_like.endswith('.gz')
334+
have_igzip = HAVE_INDEXED_GZIP and self.file_like.endswith('.gz')
334335

335336
persist_opener = keep_file_open or have_igzip
336337
return keep_file_open, persist_opener

nibabel/openers.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,15 @@
1010

1111
from __future__ import annotations
1212

13-
import gzip
1413
import io
1514
import typing as ty
1615
from bz2 import BZ2File
1716
from os.path import splitext
1817

19-
from ._compression import (HAVE_INDEXED_GZIP,
20-
IndexedGzipFile,
21-
DeterministicGzipFile,
22-
zstd,
23-
gzip_open,
24-
zstd_open)
18+
from ._compression import (
19+
gzip_open,
20+
zstd_open,
21+
)
2522

2623
if ty.TYPE_CHECKING:
2724
from types import TracebackType

0 commit comments

Comments
 (0)