Skip to content

Commit

Permalink
(chore): more robust size getting
Browse files Browse the repository at this point in the history
  • Loading branch information
ilan-gold committed Jan 27, 2025
1 parent cce570f commit 71c680d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/anndata/_core/anndata.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ def _infer_shape_for_axis(
for elem in [layers, xxxm, xxxp]:
if elem is not None:
elem = cast(Mapping, elem)
next_elem = next(iter(elem.values()))
if hasattr(next_elem, "shape"):
size = cast(int, next_elem.shape[0])
return size
for sub_elem in elem.values():
if hasattr(sub_elem, "shape"):
size = cast(int, sub_elem.shape[0])
return size
return None


Expand Down

0 comments on commit 71c680d

Please sign in to comment.