|
42 | 42 | from fast_array_utils.types import CSBase |
43 | 43 |
|
44 | 44 |
|
45 | | -# define numba base type representing compressed sparse matrix classes |
46 | 45 | class CSType(nbtypes.Type): |
47 | 46 | """A Numba `Type` modeled after the base class `scipy.sparse.compressed._cs_matrix`. |
48 | 47 |
|
49 | 48 | This is an abstract base class for the actually used, registered types in `TYPES` below. |
| 49 | + It collects information about the type (e.g. field dtypes) for later use in the data model. |
50 | 50 | """ |
51 | 51 |
|
52 | 52 | name: ClassVar[Literal["csr_matrix", "csc_matrix", "csr_array", "csc_array"]] |
@@ -96,12 +96,12 @@ def typeof(val: CSBase, c: _TypeofContext) -> CSType: |
96 | 96 |
|
97 | 97 |
|
98 | 98 | if TYPE_CHECKING: |
99 | | - _Base = models.StructModel[CSType] |
| 99 | + _CSModelBase = models.StructModel[CSType] |
100 | 100 | else: |
101 | | - _Base = models.StructModel |
| 101 | + _CSModelBase = models.StructModel |
102 | 102 |
|
103 | 103 |
|
104 | | -class CSModel(_Base): |
| 104 | +class CSModel(_CSModelBase): |
105 | 105 | """Numba data model for compressed sparse matrices. |
106 | 106 |
|
107 | 107 | This is the class that is used by numba to lower the array types. |
@@ -261,6 +261,7 @@ def copy(inst: CSType) -> CSType: # pragma: no cover |
261 | 261 |
|
262 | 262 |
|
263 | 263 | def register() -> None: |
| 264 | + """Register the numba types, data models, and mappings between them and the Python types.""" |
264 | 265 | for cls, func in TYPEOF_FUNCS.items(): |
265 | 266 | typeof_impl.register(cls, func) |
266 | 267 | for typ, model in MODELS.items(): |
|
0 commit comments