Skip to content

Commit eca3af5

Browse files
changed Input object typing API
1 parent 97927dd commit eca3af5

File tree

7 files changed

+12
-17
lines changed

7 files changed

+12
-17
lines changed

batchglm/api/typing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
from batchglm.models.base.estimator import EstimatorBaseTyping
2-
from batchglm.models.base.input import InputDataBaseTyping
2+
from batchglm.models.base.input import InputDataBase

batchglm/models/base/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from .input import _InputDataBase, InputDataBaseTyping
1+
from .input import InputDataBase, InputDataBase
22
from .estimator import _EstimatorBase, EstimatorBaseTyping
33
from .model import _ModelBase
44
from .simulator import _SimulatorBase

batchglm/models/base/estimator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
except ImportError:
1010
anndata = None
1111

12-
from .input import _InputDataBase
12+
from .input import InputDataBase
1313
from .model import _ModelBase
1414

1515
logger = logging.getLogger(__name__)
@@ -29,7 +29,7 @@ class TrainingStrategy(Enum):
2929
def __init__(
3030
self,
3131
model: _ModelBase,
32-
input_data: _InputDataBase
32+
input_data: InputDataBase
3333
):
3434
self.model = model
3535
self.input_data = input_data

batchglm/models/base/input.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
logger = logging.getLogger(__name__)
1212

1313

14-
class _InputDataBase:
14+
class InputDataBase:
1515
"""
1616
Base class for all input data types.
1717
"""
@@ -45,7 +45,7 @@ def __init__(
4545
self.x = data
4646
elif isinstance(data, anndata.AnnData) or isinstance(data, anndata.Raw):
4747
self.x = data.X
48-
elif isinstance(data, _InputDataBase):
48+
elif isinstance(data, InputDataBase):
4949
self.x = data.x
5050
else:
5151
raise ValueError("type of data %s not recognized" % type(data))
@@ -90,8 +90,3 @@ def fetch_x_sparse(self, idx):
9090
data_idx = np.squeeze(data_idx, axis=0)
9191

9292
return data_idx, data_val, data_shape
93-
94-
class InputDataBaseTyping:
95-
"""
96-
Input data base class used for typing in other packages.
97-
"""

batchglm/models/base/simulator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
except ImportError:
99
anndata = None
1010

11-
from .input import _InputDataBase
11+
from .input import InputDataBase
1212
from .model import _ModelBase
1313

1414
logger = logging.getLogger(__name__)
@@ -26,7 +26,7 @@ class _SimulatorBase(metaclass=abc.ABCMeta):
2626
nobs: int
2727
nfeatures: int
2828

29-
input_data: _InputDataBase
29+
input_data: InputDataBase
3030
model: _ModelBase
3131

3232
def __init__(

batchglm/models/base_glm/external.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from batchglm.models.base import _EstimatorBase
2-
from batchglm.models.base import _InputDataBase
2+
from batchglm.models.base import InputDataBase
33
from batchglm.models.base import _ModelBase
44
from batchglm.models.base import _SimulatorBase
55

batchglm/models/base_glm/input.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
from typing import Union
1111

1212
from .utils import parse_constraints, parse_design
13-
from .external import _InputDataBase
13+
from .external import InputDataBase
1414

1515

16-
class InputDataGLM(_InputDataBase):
16+
class InputDataGLM(InputDataBase):
1717
"""
1818
Input data for Generalized Linear Models (GLMs).
1919
"""
@@ -76,7 +76,7 @@ def __init__(
7676
If this option is set, all provided data will be casted to this data type.
7777
:return: InputData object
7878
"""
79-
_InputDataBase.__init__(
79+
InputDataBase.__init__(
8080
self=self,
8181
data=data,
8282
observation_names=observation_names,

0 commit comments

Comments
 (0)