Commit dd15a5c
committed
feat(utils): expose STANDARD_SECTIONS as the canonical section order
``iter_outer`` is currently the only way to enumerate AnnData's standard
section names, which forces consumers that only need the names
(membership checks, layout introspection, ecosystem packages mirroring
the layout) to drive the generator and pay for a full ``getattr`` per
section — reconstructing aligned mappings and, for backed AnnData,
reopening and closing the backing file.
Expose the section order as a module-level ``tuple`` and have
``iter_outer`` iterate it:
- ``STANDARD_SECTIONS: tuple[AnnDataElem, ...]`` becomes the single
source of truth.
- ``iter_outer`` now loops over ``STANDARD_SECTIONS``; the yield order
and exception behaviour for existing callers is unchanged.
- Name-only consumers read the constant directly:
``from anndata.utils import STANDARD_SECTIONS``.
This is a pure refactor behaviourally — no caller semantics change —
and a small addition to the public surface. Downstream consumers
(rich HTML repr in PR #2236, ecosystem packages) can iterate the
constant with per-section ``try/except`` to stay usable when a single
section's attribute access raises.1 parent 7861448 commit dd15a5c
2 files changed
Lines changed: 49 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
438 | 438 | | |
439 | 439 | | |
440 | 440 | | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
441 | 462 | | |
442 | 463 | | |
443 | 464 | | |
444 | 465 | | |
445 | 466 | | |
446 | | - | |
447 | | - | |
448 | | - | |
449 | | - | |
450 | | - | |
451 | | - | |
452 | | - | |
453 | | - | |
454 | | - | |
455 | | - | |
456 | | - | |
457 | | - | |
458 | | - | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
459 | 473 | | |
460 | 474 | | |
461 | 475 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
11 | | - | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
59 | 60 | | |
60 | 61 | | |
61 | 62 | | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
0 commit comments