Skip to content

Commit

Permalink
(chore): group updates
Browse files Browse the repository at this point in the history
  • Loading branch information
ilan-gold committed Jan 10, 2024
1 parent fd814f9 commit 45abc11
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
12 changes: 9 additions & 3 deletions anndata/_core/sparse_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,13 +299,19 @@ def __init__(self, group: h5py.Group | ZarrGroup):
"""Shape of the matrix."""

@property
def group(self):
def group(self) -> h5py.Group | ZarrGroup:
"""The group underlying the backed matrix.
Returns
-------
h5py.Group | ZarrGroup
"""
return self._group

@group.setter
def group(self, val):
raise TypeError(
f"Do not reset group on a {type(self)}. Instead use `sparse_dataset` to make a new class."
raise AttributeError(
f"Do not reset group on a {type(self)} with {val}. Instead use `sparse_dataset` to make a new class."
)

@property
Expand Down
2 changes: 1 addition & 1 deletion anndata/tests/test_backed_sparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ def test_reset_group(tmp_path: Path):

ad._io.specs.write_elem(f, "base", base)
disk_mtx = sparse_dataset(f["base"])
with pytest.raises(TypeError):
with pytest.raises(AttributeError):
disk_mtx.group = f


Expand Down

0 comments on commit 45abc11

Please sign in to comment.