From 09e936808f1ccb1867420f7bc97d7589ad76091a Mon Sep 17 00:00:00 2001 From: Paul McCarthy Date: Thu, 25 Jun 2020 18:02:38 +0100 Subject: [PATCH] RF: Detect IndexedGzipFile as compressed file type --- nibabel/openers.py | 3 +++ nibabel/volumeutils.py | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/nibabel/openers.py b/nibabel/openers.py index a658c65c0a..ed9568c694 100644 --- a/nibabel/openers.py +++ b/nibabel/openers.py @@ -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 diff --git a/nibabel/volumeutils.py b/nibabel/volumeutils.py index c3a82db418..5852084ecd 100644 --- a/nibabel/volumeutils.py +++ b/nibabel/volumeutils.py @@ -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 @@ -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):