Skip to content

Commit

Permalink
(refactor): use elem for h5 where posssble
Browse files Browse the repository at this point in the history
  • Loading branch information
ilan-gold committed Apr 12, 2024
1 parent ae5396c commit 664336a
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/anndata/_io/specs/lazy_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,9 @@ def make_index(is_csc, stride, shape, block_id):
def read_sparse_as_dask_h5(elem, _reader):
filename = elem.file.filename
elem_name = elem.name
with h5py.File(filename, "r") as f:
e = f[elem_name]
shape = e.attrs["shape"]
dtype = e["data"].dtype
is_csc = e.attrs["encoding-type"] == "csc_matrix"
shape = elem.attrs["shape"]
dtype = elem["data"].dtype
is_csc = elem.attrs["encoding-type"] == "csc_matrix"

def make_dask_chunk(block_id=None):
# We need to open the file in each task since `dask` cannot share h5py objects when using `dask.distributed`
Expand Down

0 comments on commit 664336a

Please sign in to comment.