|
1 | | -from collections.abc import Mapping |
| 1 | +from __future__ import annotations |
| 2 | + |
2 | 3 | from typing import TYPE_CHECKING |
3 | 4 |
|
4 | 5 | if TYPE_CHECKING: |
| 6 | + from collections.abc import Mapping |
| 7 | + |
5 | 8 | from anndata import AnnData |
| 9 | + from anndata._core.raw import Raw |
6 | 10 |
|
7 | 11 | try: |
8 | 12 | from anndata._core.aligned_mapping import AlignedView, AxisArrays, PairwiseArrays |
9 | 13 | except ImportError: |
10 | 14 | # anndata < 0.10.9 |
11 | 15 | from anndata._core.aligned_mapping import ( |
12 | | - AlignedActualMixin, |
| 16 | + AlignedViewMixin as AlignedView, |
| 17 | + ) |
| 18 | + from anndata._core.aligned_mapping import ( |
| 19 | + AxisArrays as AxisArraysLegacy, |
| 20 | + ) |
| 21 | + from anndata._core.aligned_mapping import ( |
13 | 22 | AxisArraysBase, |
14 | | - PairwiseArraysBase, |
15 | 23 | ) |
16 | 24 | from anndata._core.aligned_mapping import ( |
17 | | - AlignedViewMixin as AlignedView, |
| 25 | + PairwiseArrays as PairwiseArraysLegacy, |
18 | 26 | ) |
19 | 27 |
|
20 | | - class AxisArrays(AlignedActualMixin, AxisArraysBase): |
| 28 | + class AxisArrays(AxisArraysLegacy): |
21 | 29 | def __init__( |
22 | 30 | self, |
23 | | - parent: "AnnData", |
| 31 | + parent: AnnData | Raw, |
24 | 32 | axis: int, |
25 | 33 | store: Mapping | AxisArraysBase | None = None, |
26 | 34 | ): |
27 | | - self._parent = parent |
28 | | - if axis not in {0, 1}: |
29 | | - raise ValueError() |
30 | | - self._axis = axis |
31 | | - self._data = dict() |
32 | | - if store is not None: |
33 | | - self.update(store) |
34 | | - |
35 | | - class PairwiseArrays(AlignedActualMixin, PairwiseArraysBase): |
| 35 | + super().__init__(parent, axis=axis, vals=store) |
| 36 | + |
| 37 | + class PairwiseArrays(PairwiseArraysLegacy): |
36 | 38 | def __init__( |
37 | 39 | self, |
38 | | - parent: "AnnData", |
| 40 | + parent: AnnData, |
39 | 41 | axis: int, |
40 | 42 | store: Mapping | None = None, |
41 | 43 | ): |
42 | | - self._parent = parent |
43 | | - if axis not in {0, 1}: |
44 | | - raise ValueError() |
45 | | - self._axis = axis |
46 | | - self._data = dict() |
47 | | - if store is not None: |
48 | | - self.update(store) |
| 44 | + super().__init__(parent, axis=axis, vals=store) |
49 | 45 |
|
50 | 46 |
|
51 | 47 | __all__ = ["AlignedView", "AxisArrays", "PairwiseArrays"] |
0 commit comments