1+ from abc import ABC
2+ from abc import abstractmethod
13from typing import Generic , Optional , TypeVar
24
3- from typing_extensions import Final , Self
5+ from typing_extensions import Final
46
57from . import _mixin
68from . import base
911from . import measurement
1012from . import query
1113from . import scene
14+ from .query import ExperimentAxisQuery
1215
1316_DF = TypeVar ("_DF" , bound = data .DataFrame )
1417"""An implementation of a DataFrame."""
2023"""The root SOMA object type of the implementation."""
2124
2225
23- class Experiment (
24- collection .BaseCollection [_RootSO ], Generic [_DF , _MeasColl , _SceneColl , _RootSO ]
26+ class Experiment ( # type: ignore[misc] # __eq__ false positive
27+ collection .BaseCollection [_RootSO ],
28+ Generic [_DF , _MeasColl , _SceneColl , _RootSO ],
29+ ABC ,
2530):
2631 """A collection subtype representing an annotated 2D matrix of measurements.
2732
@@ -33,22 +38,6 @@ class Experiment(
3338 Lifecycle: maturing
3439 """
3540
36- # This class is implemented as a mixin to be used with SOMA classes.
37- # For example, a SOMA implementation would look like this:
38- #
39- # # This type-ignore comment will always be needed due to limitations
40- # # of type annotations; it is (currently) expected.
41- # class Experiment( # type: ignore[type-var]
42- # ImplBaseCollection[ImplSOMAObject],
43- # somacore.Experiment[
44- # ImplDataFrame, # _DF
45- # ImplMeasurement, # _MeasColl
46- # ImplScene, # _SceneColl
47- # ImplSOMAObject, # _RootSO
48- # ],
49- # ):
50- # ...
51-
5241 __slots__ = ()
5342 soma_type : Final = "SOMAExperiment" # type: ignore[misc]
5443
@@ -77,24 +66,18 @@ class Experiment(
7766 ``scene_id`` and ``False`` otherwise.
7867 """
7968
69+ @abstractmethod
8070 def axis_query (
8171 self ,
8272 measurement_name : str ,
8373 * ,
8474 obs_query : Optional [query .AxisQuery ] = None ,
8575 var_query : Optional [query .AxisQuery ] = None ,
86- ) -> "query. ExperimentAxisQuery[Self]" :
76+ ) -> ExperimentAxisQuery :
8777 """Creates an axis query over this experiment.
8878
8979 See :class:`query.ExperimentAxisQuery` for details on usage.
9080
9181 Lifecycle: maturing
9282 """
93- # mypy doesn't quite understand descriptors so it issues a spurious
94- # error here.
95- return query .ExperimentAxisQuery ( # type: ignore[type-var]
96- self ,
97- measurement_name ,
98- obs_query = obs_query or query .AxisQuery (),
99- var_query = var_query or query .AxisQuery (),
100- )
83+ raise NotImplementedError
0 commit comments