Skip to content

Commit

Permalink
Merge pull request #925 from pauldmccarthy/rf/detect_igzip_as_compres…
Browse files Browse the repository at this point in the history
…sed_file_type

FIX: Detect IndexedGzipFile as compressed file type
  • Loading branch information
effigies authored Jun 26, 2020
2 parents 23de925 + 09e9368 commit 42c5bd8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions nibabel/openers.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
del igzip, version

except ImportError:
# nibabel.openers.IndexedGzipFile is imported by nibabel.volumeutils
# to detect compressed file types, so we give a fallback value here.
IndexedGzipFile = gzip.GzipFile
HAVE_INDEXED_GZIP = False


Expand Down
4 changes: 2 additions & 2 deletions nibabel/volumeutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import numpy as np

from .casting import (shared_range, type_info, OK_FLOATS)
from .openers import Opener, BZ2File
from .openers import Opener, BZ2File, IndexedGzipFile
from .deprecated import deprecate_with_version
from .externals.oset import OrderedSet

Expand All @@ -38,7 +38,7 @@
default_compresslevel = 1

#: file-like classes known to hold compressed data
COMPRESSED_FILE_LIKES = (gzip.GzipFile, BZ2File)
COMPRESSED_FILE_LIKES = (gzip.GzipFile, BZ2File, IndexedGzipFile)


class Recoder(object):
Expand Down

0 comments on commit 42c5bd8

Please sign in to comment.