Skip to content

Commit

Permalink
Merge pull request galaxyproject#17828 from mvdbeek/fix_large_memory_…
Browse files Browse the repository at this point in the history
…usage_qza

[23.0] Fix excessive memory usage for npz files
  • Loading branch information
mvdbeek authored Mar 25, 2024
2 parents d483675 + 28c19eb commit 77fc849
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions lib/galaxy/datatypes/binary.py
Original file line number Diff line number Diff line change
Expand Up @@ -4135,11 +4135,9 @@ def __init__(self, **kwd):

def sniff(self, filename: str) -> bool:
try:
npz = np.load(filename)
if isinstance(npz, np.lib.npyio.NpzFile):
for f in npz.files:
if isinstance(npz[f], np.ndarray):
return True
with np.load(filename) as npz:
if isinstance(npz, np.lib.npyio.NpzFile) and any(f.filename.endswith(".npy") for f in npz.zip.filelist):
return True
except Exception:
return False
return False
Expand Down

0 comments on commit 77fc849

Please sign in to comment.