Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 60d5afb

Browse files
authoredApr 29, 2025··
Widen line lengths for overload authoring (#93)
1 parent f3b1eaa commit 60d5afb

26 files changed

+99
-311
lines changed
 

‎docs/conf.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,7 @@
4949
autodoc_default_options = {
5050
"special-members": True,
5151
# everything except __call__ really, to avoid having to write autosummary templates
52-
"exclude-members": (
53-
"__setattr__,__delattr__,__repr__,__eq__,__or__,__ror__,__hash__,__weakref__,__init__,__new__"
54-
),
52+
"exclude-members": "__setattr__,__delattr__,__repr__,__eq__,__or__,__ror__,__hash__,__weakref__,__init__,__new__",
5553
}
5654
napoleon_google_docstring = False
5755
napoleon_numpy_docstring = True
@@ -115,27 +113,21 @@ def find_type_alias(name: str) -> tuple[str, str] | tuple[None, None]:
115113
return None, None
116114

117115

118-
def resolve_type_aliases(
119-
app: Sphinx, env: BuildEnvironment, node: pending_xref, contnode: TextElement
120-
) -> reference | None:
116+
def resolve_type_aliases(app: Sphinx, env: BuildEnvironment, node: pending_xref, contnode: TextElement) -> reference | None:
121117
"""Resolve :class: references to our type aliases as :attr: instead."""
122118
if (node["refdomain"], node["reftype"]) != ("py", "class"):
123119
return None
124120
typ, target = find_type_alias(node["reftarget"])
125121
if typ is None or target is None:
126122
return None
127123
if target.startswith("fast_array_utils."):
128-
ref = env.get_domain("py").resolve_xref(
129-
env, node["refdoc"], app.builder, typ, target, node, contnode
130-
)
124+
ref = env.get_domain("py").resolve_xref(env, node["refdoc"], app.builder, typ, target, node, contnode)
131125
else:
132126
from sphinx.ext.intersphinx import resolve_reference_any_inventory
133127

134128
node["reftype"] = typ
135129
node["reftarget"] = target
136-
ref = resolve_reference_any_inventory(
137-
env=env, honor_disabled_refs=False, node=node, contnode=contnode
138-
)
130+
ref = resolve_reference_any_inventory(env=env, honor_disabled_refs=False, node=node, contnode=contnode)
139131
if ref is None:
140132
msg = f"Could not resolve {typ} {target} (from {node['reftarget']})"
141133
raise AssertionError(msg)

‎pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ python = [ "3.13", "3.12", "3.11" ]
9393
extras = [ "full", "default", "min" ]
9494

9595
[tool.ruff]
96-
line-length = 100
96+
line-length = 160
9797
namespace-packages = [ "src/testing" ]
9898
format.preview = true
9999
format.docstring-code-format = true

‎src/fast_array_utils/_plugins/numba_sparse.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -124,15 +124,9 @@ def __init__(self, dmm: DataModelManager, fe_type: CSType) -> None:
124124
sparse.csr_array,
125125
sparse.csc_array,
126126
]
127-
TYPES: Sequence[type[CSType]] = [
128-
type(f"{cls.__name__}Type", (CSType,), {"cls": cls, "name": cls.__name__}) for cls in CLASSES
129-
]
130-
TYPEOF_FUNCS: Mapping[type[CSBase], Callable[[CSBase, _TypeofContext], CSType]] = {
131-
typ.cls: make_typeof_fn(typ) for typ in TYPES
132-
}
133-
MODELS: Mapping[type[CSType], type[CSModel]] = {
134-
typ: type(f"{typ.cls.__name__}Model", (CSModel,), {}) for typ in TYPES
135-
}
127+
TYPES: Sequence[type[CSType]] = [type(f"{cls.__name__}Type", (CSType,), {"cls": cls, "name": cls.__name__}) for cls in CLASSES]
128+
TYPEOF_FUNCS: Mapping[type[CSBase], Callable[[CSBase, _TypeofContext], CSType]] = {typ.cls: make_typeof_fn(typ) for typ in TYPES}
129+
MODELS: Mapping[type[CSType], type[CSModel]] = {typ: type(f"{typ.cls.__name__}Model", (CSModel,), {}) for typ in TYPES}
136130

137131

138132
def unbox_matrix(typ: CSType, obj: Value, c: UnboxContext) -> NativeValue:
@@ -253,9 +247,7 @@ def overload_sparse_copy(inst: CSType) -> None | Callable[[CSType], CSType]:
253247

254248
# nopython code:
255249
def copy(inst: CSType) -> CSType: # pragma: no cover
256-
return _sparse_copy(
257-
inst, inst.data.copy(), inst.indices.copy(), inst.indptr.copy(), inst.shape
258-
) # type: ignore[return-value]
250+
return _sparse_copy(inst, inst.data.copy(), inst.indices.copy(), inst.indptr.copy(), inst.shape) # type: ignore[return-value]
259251

260252
return copy
261253

‎src/fast_array_utils/conv/__init__.py

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -21,41 +21,23 @@
2121

2222

2323
@overload
24-
def to_dense(
25-
x: CpuArray | DiskArray | types.sparray | types.spmatrix | types.CSDataset,
26-
/,
27-
*,
28-
to_cpu_memory: bool = False,
29-
) -> NDArray[Any]: ...
24+
def to_dense(x: CpuArray | DiskArray | types.sparray | types.spmatrix | types.CSDataset, /, *, to_cpu_memory: bool = False) -> NDArray[Any]: ...
3025

3126

3227
@overload
33-
def to_dense(
34-
x: types.DaskArray, /, *, to_cpu_memory: Literal[False] = False
35-
) -> types.DaskArray: ...
28+
def to_dense(x: types.DaskArray, /, *, to_cpu_memory: Literal[False] = False) -> types.DaskArray: ...
3629
@overload
3730
def to_dense(x: types.DaskArray, /, *, to_cpu_memory: Literal[True]) -> NDArray[Any]: ...
3831

3932

4033
@overload
41-
def to_dense(
42-
x: GpuArray | types.CupySpMatrix, /, *, to_cpu_memory: Literal[False] = False
43-
) -> types.CupyArray: ...
34+
def to_dense(x: GpuArray | types.CupySpMatrix, /, *, to_cpu_memory: Literal[False] = False) -> types.CupyArray: ...
4435
@overload
45-
def to_dense(
46-
x: GpuArray | types.CupySpMatrix, /, *, to_cpu_memory: Literal[True]
47-
) -> NDArray[Any]: ...
36+
def to_dense(x: GpuArray | types.CupySpMatrix, /, *, to_cpu_memory: Literal[True]) -> NDArray[Any]: ...
4837

4938

5039
def to_dense(
51-
x: CpuArray
52-
| GpuArray
53-
| DiskArray
54-
| types.CSDataset
55-
| types.DaskArray
56-
| types.sparray
57-
| types.spmatrix
58-
| types.CupySpMatrix,
40+
x: CpuArray | GpuArray | DiskArray | types.CSDataset | types.DaskArray | types.sparray | types.spmatrix | types.CupySpMatrix,
5941
/,
6042
*,
6143
to_cpu_memory: bool = False,

‎src/fast_array_utils/conv/_to_dense.py

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,7 @@
1919
# fallback’s arg0 type has to include types of registered functions
2020
@singledispatch
2121
def to_dense_(
22-
x: CpuArray
23-
| GpuArray
24-
| DiskArray
25-
| types.DaskArray
26-
| types.sparray
27-
| types.spmatrix
28-
| types.CupySpMatrix,
22+
x: CpuArray | GpuArray | DiskArray | types.DaskArray | types.sparray | types.spmatrix | types.CupySpMatrix,
2923
/,
3024
*,
3125
to_cpu_memory: bool = False,
@@ -35,19 +29,15 @@ def to_dense_(
3529

3630

3731
@to_dense_.register(types.spmatrix | types.sparray) # type: ignore[call-overload,misc]
38-
def _to_dense_cs(
39-
x: types.spmatrix | types.sparray, /, *, to_cpu_memory: bool = False
40-
) -> NDArray[Any]:
32+
def _to_dense_cs(x: types.spmatrix | types.sparray, /, *, to_cpu_memory: bool = False) -> NDArray[Any]:
4133
from . import scipy
4234

4335
del to_cpu_memory # it already is
4436
return scipy.to_dense(x)
4537

4638

4739
@to_dense_.register(types.DaskArray)
48-
def _to_dense_dask(
49-
x: types.DaskArray, /, *, to_cpu_memory: bool = False
50-
) -> NDArray[Any] | types.DaskArray:
40+
def _to_dense_dask(x: types.DaskArray, /, *, to_cpu_memory: bool = False) -> NDArray[Any] | types.DaskArray:
5141
from . import to_dense
5242

5343
x = x.map_blocks(partial(to_dense, to_cpu_memory=to_cpu_memory))
@@ -66,8 +56,6 @@ def _to_dense_ooc(x: types.CSDataset, /, *, to_cpu_memory: bool = False) -> NDAr
6656

6757

6858
@to_dense_.register(types.CupyArray | types.CupySpMatrix) # type: ignore[call-overload,misc]
69-
def _to_dense_cupy(
70-
x: GpuArray, /, *, to_cpu_memory: bool = False
71-
) -> NDArray[Any] | types.CupyArray:
59+
def _to_dense_cupy(x: GpuArray, /, *, to_cpu_memory: bool = False) -> NDArray[Any] | types.CupyArray:
7260
x = x.toarray() if isinstance(x, types.CupySpMatrix) else x
7361
return x.get() if to_cpu_memory else x

‎src/fast_array_utils/conv/scipy/__init__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,7 @@ def to_dense(x: types.spmatrix | types.sparray, order: Literal["C", "F"] = "C")
4242
try:
4343
from ._to_dense import _to_dense_csc_numba, _to_dense_csr_numba
4444
except ImportError:
45-
warn(
46-
"numba is not installed; falling back to slow conversion", RuntimeWarning, stacklevel=2
47-
)
45+
warn("numba is not installed; falling back to slow conversion", RuntimeWarning, stacklevel=2)
4846
return x.toarray(order=order)
4947

5048
out = np.zeros(x.shape, dtype=x.dtype, order=order)

‎src/fast_array_utils/stats/__init__.py

Lines changed: 15 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@
2727

2828

2929
@overload
30-
def is_constant(
31-
x: NDArray[Any] | types.CSBase | types.CupyArray, /, *, axis: None = None
32-
) -> bool: ...
30+
def is_constant(x: NDArray[Any] | types.CSBase | types.CupyArray, /, *, axis: None = None) -> bool: ...
3331
@overload
3432
def is_constant(x: NDArray[Any] | types.CSBase, /, *, axis: Literal[0, 1]) -> NDArray[np.bool]: ...
3533
@overload
@@ -82,25 +80,13 @@ def is_constant(
8280
# TODO(flying-sheep): support CSDataset (TODO)
8381
# https://github.com/scverse/fast-array-utils/issues/52
8482
@overload
85-
def mean(
86-
x: CpuArray | GpuArray | DiskArray,
87-
/,
88-
*,
89-
axis: Literal[None] = None,
90-
dtype: DTypeLike | None = None,
91-
) -> np.number[Any]: ...
83+
def mean(x: CpuArray | GpuArray | DiskArray, /, *, axis: Literal[None] = None, dtype: DTypeLike | None = None) -> np.number[Any]: ...
9284
@overload
93-
def mean(
94-
x: CpuArray | DiskArray, /, *, axis: Literal[0, 1], dtype: DTypeLike | None = None
95-
) -> NDArray[np.number[Any]]: ...
85+
def mean(x: CpuArray | DiskArray, /, *, axis: Literal[0, 1], dtype: DTypeLike | None = None) -> NDArray[np.number[Any]]: ...
9686
@overload
97-
def mean(
98-
x: GpuArray, /, *, axis: Literal[0, 1], dtype: DTypeLike | None = None
99-
) -> types.CupyArray: ...
87+
def mean(x: GpuArray, /, *, axis: Literal[0, 1], dtype: DTypeLike | None = None) -> types.CupyArray: ...
10088
@overload
101-
def mean(
102-
x: types.DaskArray, /, *, axis: Literal[0, 1], dtype: ToDType[Any] | None = None
103-
) -> types.DaskArray: ...
89+
def mean(x: types.DaskArray, /, *, axis: Literal[0, 1], dtype: ToDType[Any] | None = None) -> types.DaskArray: ...
10490

10591

10692
def mean(
@@ -149,21 +135,13 @@ def mean(
149135

150136

151137
@overload
152-
def mean_var(
153-
x: CpuArray | GpuArray, /, *, axis: Literal[None] = None, correction: int = 0
154-
) -> tuple[np.float64, np.float64]: ...
138+
def mean_var(x: CpuArray | GpuArray, /, *, axis: Literal[None] = None, correction: int = 0) -> tuple[np.float64, np.float64]: ...
155139
@overload
156-
def mean_var(
157-
x: CpuArray, /, *, axis: Literal[0, 1], correction: int = 0
158-
) -> tuple[NDArray[np.float64], NDArray[np.float64]]: ...
140+
def mean_var(x: CpuArray, /, *, axis: Literal[0, 1], correction: int = 0) -> tuple[NDArray[np.float64], NDArray[np.float64]]: ...
159141
@overload
160-
def mean_var(
161-
x: GpuArray, /, *, axis: Literal[0, 1], correction: int = 0
162-
) -> tuple[types.CupyArray, types.CupyArray]: ...
142+
def mean_var(x: GpuArray, /, *, axis: Literal[0, 1], correction: int = 0) -> tuple[types.CupyArray, types.CupyArray]: ...
163143
@overload
164-
def mean_var(
165-
x: types.DaskArray, /, *, axis: Literal[0, 1, None] = None, correction: int = 0
166-
) -> tuple[types.DaskArray, types.DaskArray]: ...
144+
def mean_var(x: types.DaskArray, /, *, axis: Literal[0, 1, None] = None, correction: int = 0) -> tuple[types.DaskArray, types.DaskArray]: ...
167145

168146

169147
def mean_var(
@@ -226,58 +204,21 @@ def mean_var(
226204
# TODO(flying-sheep): support CSDataset (TODO)
227205
# https://github.com/scverse/fast-array-utils/issues/52
228206
@overload
229-
def sum(
230-
x: CpuArray | DiskArray,
231-
/,
232-
*,
233-
axis: None = None,
234-
dtype: DTypeLike | None = None,
235-
keep_cupy_as_array: bool = False,
236-
) -> np.number[Any]: ...
207+
def sum(x: CpuArray | DiskArray, /, *, axis: None = None, dtype: DTypeLike | None = None, keep_cupy_as_array: bool = False) -> np.number[Any]: ...
237208
@overload
238-
def sum(
239-
x: CpuArray | DiskArray,
240-
/,
241-
*,
242-
axis: Literal[0, 1],
243-
dtype: DTypeLike | None = None,
244-
keep_cupy_as_array: bool = False,
245-
) -> NDArray[Any]: ...
209+
def sum(x: CpuArray | DiskArray, /, *, axis: Literal[0, 1], dtype: DTypeLike | None = None, keep_cupy_as_array: bool = False) -> NDArray[Any]: ...
246210

247211

248212
@overload
249-
def sum(
250-
x: GpuArray,
251-
/,
252-
*,
253-
axis: None = None,
254-
dtype: DTypeLike | None = None,
255-
keep_cupy_as_array: Literal[False] = False,
256-
) -> np.number[Any]: ...
213+
def sum(x: GpuArray, /, *, axis: None = None, dtype: DTypeLike | None = None, keep_cupy_as_array: Literal[False] = False) -> np.number[Any]: ...
257214
@overload
258-
def sum(
259-
x: GpuArray, /, *, axis: None, dtype: DTypeLike | None = None, keep_cupy_as_array: Literal[True]
260-
) -> types.CupyArray: ...
215+
def sum(x: GpuArray, /, *, axis: None, dtype: DTypeLike | None = None, keep_cupy_as_array: Literal[True]) -> types.CupyArray: ...
261216
@overload
262-
def sum(
263-
x: GpuArray,
264-
/,
265-
*,
266-
axis: Literal[0, 1],
267-
dtype: DTypeLike | None = None,
268-
keep_cupy_as_array: bool = False,
269-
) -> types.CupyArray: ...
217+
def sum(x: GpuArray, /, *, axis: Literal[0, 1], dtype: DTypeLike | None = None, keep_cupy_as_array: bool = False) -> types.CupyArray: ...
270218

271219

272220
@overload
273-
def sum(
274-
x: types.DaskArray,
275-
/,
276-
*,
277-
axis: Literal[0, 1, None] = None,
278-
dtype: DTypeLike | None = None,
279-
keep_cupy_as_array: bool = False,
280-
) -> types.DaskArray: ...
221+
def sum(x: types.DaskArray, /, *, axis: Literal[0, 1, None] = None, dtype: DTypeLike | None = None, keep_cupy_as_array: bool = False) -> types.DaskArray: ...
281222

282223

283224
def sum(

‎src/fast_array_utils/stats/_is_constant.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@ def is_constant_(
3030

3131

3232
@is_constant_.register(np.ndarray | types.CupyArray) # type: ignore[call-overload,misc]
33-
def _is_constant_ndarray(
34-
a: NDArray[Any] | types.CupyArray, /, *, axis: Literal[0, 1, None] = None
35-
) -> bool | NDArray[np.bool] | types.CupyArray:
33+
def _is_constant_ndarray(a: NDArray[Any] | types.CupyArray, /, *, axis: Literal[0, 1, None] = None) -> bool | NDArray[np.bool] | types.CupyArray:
3634
# Should eventually support nd, not now.
3735
match axis:
3836
case None:
@@ -49,9 +47,7 @@ def _is_constant_rows(a: NDArray[Any] | types.CupyArray) -> NDArray[np.bool] | t
4947

5048

5149
@is_constant_.register(types.CSBase) # type: ignore[call-overload,misc]
52-
def _is_constant_cs(
53-
a: types.CSBase, /, *, axis: Literal[0, 1, None] = None
54-
) -> bool | NDArray[np.bool]:
50+
def _is_constant_cs(a: types.CSBase, /, *, axis: Literal[0, 1, None] = None) -> bool | NDArray[np.bool]:
5551
from . import is_constant
5652

5753
if len(a.shape) == 1: # pragma: no cover
@@ -87,17 +83,13 @@ def _is_constant_cs_major(a: types.CSBase, shape: tuple[int, int]) -> NDArray[np
8783

8884

8985
@is_constant_.register(types.DaskArray)
90-
def _is_constant_dask(
91-
a: types.DaskArray, /, *, axis: Literal[0, 1, None] = None
92-
) -> types.DaskArray:
86+
def _is_constant_dask(a: types.DaskArray, /, *, axis: Literal[0, 1, None] = None) -> types.DaskArray:
9387
import dask.array as da
9488

9589
from . import is_constant
9690

9791
if axis is not None:
98-
return da.map_blocks(
99-
partial(is_constant, axis=axis), a, drop_axis=axis, meta=np.array([], dtype=np.bool)
100-
)
92+
return da.map_blocks(partial(is_constant, axis=axis), a, drop_axis=axis, meta=np.array([], dtype=np.bool))
10193

10294
rv = (
10395
(a == a[0, 0].compute()).all()

‎src/fast_array_utils/stats/_mean_var.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,7 @@ def mean_var_(
4646
return mean_, var
4747

4848

49-
def _sparse_mean_var(
50-
mtx: types.CSBase, /, *, axis: Literal[0, 1]
51-
) -> tuple[NDArray[np.float64], NDArray[np.float64]]:
49+
def _sparse_mean_var(mtx: types.CSBase, /, *, axis: Literal[0, 1]) -> tuple[NDArray[np.float64], NDArray[np.float64]]:
5250
"""Calculate means and variances for each row or column of a sparse matrix.
5351
5452
This code and internal functions are based on sklearns `sparsefuncs.mean_variance_axis`.

‎src/fast_array_utils/stats/_power.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@ def _power(x: Array, n: int, /) -> Array:
3232

3333

3434
@_power.register(types.CSMatrix | types.CupyCSMatrix) # type: ignore[call-overload,misc]
35-
def _power_cs(
36-
x: types.CSMatrix | types.CupyCSMatrix, n: int, /
37-
) -> types.CSMatrix | types.CupyCSMatrix:
35+
def _power_cs(x: types.CSMatrix | types.CupyCSMatrix, n: int, /) -> types.CSMatrix | types.CupyCSMatrix:
3836
return x.power(n)
3937

4038

‎src/fast_array_utils/stats/_sum.py

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@
1717

1818
from ..typing import CpuArray, DiskArray, GpuArray
1919

20-
ComplexAxis: TypeAlias = (
21-
tuple[Literal[0], Literal[1]] | tuple[Literal[0, 1]] | Literal[0, 1, None]
22-
)
20+
ComplexAxis: TypeAlias = tuple[Literal[0], Literal[1]] | tuple[Literal[0, 1]] | Literal[0, 1, None]
2321

2422

2523
@singledispatch
@@ -34,9 +32,7 @@ def sum_(
3432
del keep_cupy_as_array
3533
if TYPE_CHECKING:
3634
# these are never passed to this fallback function, but `singledispatch` wants them
37-
assert not isinstance(
38-
x, types.CSBase | types.DaskArray | types.CupyArray | types.CupyCSMatrix
39-
)
35+
assert not isinstance(x, types.CSBase | types.DaskArray | types.CupyArray | types.CupyCSMatrix)
4036
# np.sum supports these, but doesn’t know it. (TODO: test cupy)
4137
assert not isinstance(x, types.ZarrArray | types.H5Dataset)
4238
return cast("NDArray[Any] | np.number[Any]", np.sum(x, axis=axis, dtype=dtype))
@@ -52,11 +48,7 @@ def _sum_cupy(
5248
keep_cupy_as_array: bool = False,
5349
) -> types.CupyArray | np.number[Any]:
5450
arr = cast("types.CupyArray", np.sum(x, axis=axis, dtype=dtype))
55-
return (
56-
cast("np.number[Any]", arr.get()[()])
57-
if not keep_cupy_as_array and axis is None
58-
else arr.squeeze()
59-
)
51+
return cast("np.number[Any]", arr.get()[()]) if not keep_cupy_as_array and axis is None else arr.squeeze()
6052

6153

6254
@sum_.register(types.CSBase) # type: ignore[call-overload,misc]
@@ -153,9 +145,7 @@ def normalize_axis(axis: ComplexAxis, ndim: int) -> Literal[0, 1, None]:
153145
return axis
154146

155147

156-
def get_shape(
157-
a: NDArray[Any] | np.number[Any] | types.CupyArray, *, axis: Literal[0, 1, None], keepdims: bool
158-
) -> tuple[int] | tuple[int, int]:
148+
def get_shape(a: NDArray[Any] | np.number[Any] | types.CupyArray, *, axis: Literal[0, 1, None], keepdims: bool) -> tuple[int] | tuple[int, int]:
159149
"""Get the output shape of an axis-flattening operation."""
160150
match keepdims, a.ndim:
161151
case False, 0:

‎src/fast_array_utils/types.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,7 @@
6363
CupyCSCMatrix = type("csc_matrix", (), {})
6464
CupyCSRMatrix = type("csr_matrix", (), {})
6565
CupySpMatrix = type("spmatrix", (), {})
66-
CupyCSCMatrix.__module__ = CupyCSRMatrix.__module__ = CupySpMatrix.__module__ = (
67-
"cupyx.scipy.sparse"
68-
)
66+
CupyCSCMatrix.__module__ = CupyCSRMatrix.__module__ = CupySpMatrix.__module__ = "cupyx.scipy.sparse"
6967
CupyCSMatrix = CupyCSRMatrix | CupyCSCMatrix
7068

7169

‎src/testing/fast_array_utils/__init__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,7 @@
4242
ArrayType("dask.array", "Array", Flags.Dask | t.flags, inner=t) # type: ignore[type-var]
4343
for t in cast("tuple[ArrayType[CpuArray | GpuArray, None], ...]", _TP_MEM)
4444
)
45-
_TP_DISK_DENSE = tuple(
46-
ArrayType(m, n, Flags.Any | Flags.Disk) for m, n in [("h5py", "Dataset"), ("zarr", "Array")]
47-
)
45+
_TP_DISK_DENSE = tuple(ArrayType(m, n, Flags.Any | Flags.Disk) for m, n in [("h5py", "Dataset"), ("zarr", "Array")])
4846
_TP_DISK_SPARSE = tuple(
4947
ArrayType("anndata.abc", n, Flags.Any | Flags.Disk | Flags.Sparse, inner=t) # type: ignore[type-var]
5048
for t in cast("tuple[ArrayType[DiskArray, None], ...]", _TP_DISK_DENSE)

‎src/testing/fast_array_utils/_array_type.py

Lines changed: 25 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,10 @@
3636
class ToArray(Protocol, Generic[Arr_co]):
3737
"""Convert to a supported array."""
3838

39-
def __call__(
40-
self, data: ArrayLike | Array, /, *, dtype: DTypeLike | None = None
41-
) -> Arr_co: ...
39+
def __call__(self, data: ArrayLike | Array, /, *, dtype: DTypeLike | None = None) -> Arr_co: ...
40+
41+
class MkArray(Protocol):
42+
def __call__(self, shape: tuple[int, int], /, *, dtype: DTypeLike | None = None) -> Array: ...
4243

4344
_DTypeLikeFloat32 = np.dtype[np.float32] | type[np.float32]
4445
_DTypeLikeFloat64 = np.dtype[np.float64] | type[np.float64]
@@ -118,19 +119,15 @@ def cls(self) -> type[Arr]: # noqa: PLR0911
118119
match self.mod, self.name, self.inner:
119120
case "numpy", "ndarray", None:
120121
return cast("type[Arr]", np.ndarray)
121-
case "scipy.sparse", (
122-
"csr_array" | "csc_array" | "coo_array" | "csr_matrix" | "csc_matrix" | "coo_matrix"
123-
) as cls_name, None:
122+
case "scipy.sparse", ("csr_array" | "csc_array" | "coo_array" | "csr_matrix" | "csc_matrix" | "coo_matrix") as cls_name, None:
124123
import scipy.sparse
125124

126125
return cast("type[Arr]", getattr(scipy.sparse, cls_name))
127126
case "cupy", "ndarray", None:
128127
import cupy as cp
129128

130129
return cast("type[Arr]", cp.ndarray)
131-
case "cupyx.scipy.sparse", (
132-
"csr_matrix" | "csc_matrix" | "coo_matrix"
133-
) as cls_name, None:
130+
case "cupyx.scipy.sparse", ("csr_matrix" | "csc_matrix" | "coo_matrix") as cls_name, None:
134131
import cupyx.scipy.sparse as cu_sparse
135132

136133
return cast("type[Arr]", getattr(cu_sparse, cls_name))
@@ -169,17 +166,11 @@ def random(
169166
match self.mod, self.name, self.inner:
170167
case "numpy", "ndarray", None:
171168
return cast("Arr", random_array(shape, dtype=dtype, rng=gen))
172-
case "scipy.sparse", (
173-
"csr_array" | "csc_array" | "csr_matrix" | "csc_matrix"
174-
) as cls_name, None:
175-
fmt, container = cast(
176-
'tuple[Literal["csr", "csc"], Literal["array", "matrix"]]', cls_name.split("_")
177-
)
169+
case "scipy.sparse", ("csr_array" | "csc_array" | "csr_matrix" | "csc_matrix") as cls_name, None:
170+
fmt, container = cast('tuple[Literal["csr", "csc"], Literal["array", "matrix"]]', cls_name.split("_"))
178171
return cast(
179172
"Arr",
180-
random_mat(
181-
shape, density=density, format=fmt, container=container, dtype=dtype
182-
),
173+
random_mat(shape, density=density, format=fmt, container=container, dtype=dtype),
183174
)
184175
case "cupy", "ndarray", None:
185176
return self(random_array(shape, dtype=dtype, rng=gen))
@@ -240,16 +231,12 @@ def __call__(self, x: ArrayLike | Array, /, *, dtype: DTypeLike | None = None) -
240231
return fn(x, dtype=dtype)
241232

242233
@staticmethod
243-
def _to_numpy_array(
244-
x: ArrayLike | Array, /, *, dtype: DTypeLike | None = None
245-
) -> NDArray[np.number[Any]]:
234+
def _to_numpy_array(x: ArrayLike | Array, /, *, dtype: DTypeLike | None = None) -> NDArray[np.number[Any]]:
246235
"""Convert to a numpy array."""
247236
x = to_dense(x, to_cpu_memory=True)
248237
return x if dtype is None else x.astype(dtype)
249238

250-
def _to_dask_array(
251-
self, x: ArrayLike | Array, /, *, dtype: DTypeLike | None = None
252-
) -> types.DaskArray:
239+
def _to_dask_array(self, x: ArrayLike | Array, /, *, dtype: DTypeLike | None = None) -> types.DaskArray:
253240
"""Convert to a dask array."""
254241
import dask.array as da
255242

@@ -260,16 +247,12 @@ def _to_dask_array(
260247
if isinstance(x, types.DaskArray):
261248
if isinstance(x._meta, self.inner.cls): # noqa: SLF001
262249
return x
263-
return x.map_blocks(
264-
self.inner, dtype=dtype, meta=self.inner([[1]], dtype=dtype or x.dtype)
265-
)
250+
return x.map_blocks(self.inner, dtype=dtype, meta=self.inner([[1]], dtype=dtype or x.dtype))
266251

267252
arr = self.inner(x, dtype=dtype)
268253
return da.from_array(arr, _half_chunk_size(arr.shape))
269254

270-
def _to_h5py_dataset(
271-
self, x: ArrayLike | Array, /, *, dtype: DTypeLike | None = None
272-
) -> types.H5Dataset:
255+
def _to_h5py_dataset(self, x: ArrayLike | Array, /, *, dtype: DTypeLike | None = None) -> types.H5Dataset:
273256
"""Convert to a h5py dataset."""
274257
if (ctx := self.conversion_context) is None:
275258
msg = "`conversion_context` must be set for h5py"
@@ -279,9 +262,7 @@ def _to_h5py_dataset(
279262
return ctx.hdf5_file.create_dataset("data", arr.shape, arr.dtype, data=arr)
280263

281264
@classmethod
282-
def _to_zarr_array(
283-
cls, x: ArrayLike | Array, /, *, dtype: DTypeLike | None = None
284-
) -> types.ZarrArray:
265+
def _to_zarr_array(cls, x: ArrayLike | Array, /, *, dtype: DTypeLike | None = None) -> types.ZarrArray:
285266
"""Convert to a zarr array."""
286267
import zarr
287268

@@ -293,9 +274,7 @@ def _to_zarr_array(
293274
za[...] = arr
294275
return za
295276

296-
def _to_cs_dataset(
297-
self, x: ArrayLike | Array, /, *, dtype: DTypeLike | None = None
298-
) -> types.CSDataset:
277+
def _to_cs_dataset(self, x: ArrayLike | Array, /, *, dtype: DTypeLike | None = None) -> types.CSDataset:
299278
"""Convert to a scipy sparse dataset."""
300279
import anndata.io # type: ignore[import-untyped]
301280
from scipy.sparse import csc_array, csr_array
@@ -339,9 +318,7 @@ def _to_scipy_sparse(
339318
cls = cast("type[types.CSBase]", cls or self.cls)
340319
return cls(x, dtype=dtype) # type: ignore[arg-type]
341320

342-
def _to_cupy_array(
343-
self, x: ArrayLike | Array, /, *, dtype: DTypeLike | None = None
344-
) -> types.CupyArray:
321+
def _to_cupy_array(self, x: ArrayLike | Array, /, *, dtype: DTypeLike | None = None) -> types.CupyArray:
345322
import cupy as cu
346323

347324
if isinstance(x, types.DaskArray):
@@ -374,12 +351,15 @@ def random_array(
374351
) -> Array:
375352
"""Create a random array."""
376353
rng = np.random.default_rng(rng)
377-
f = (
378-
partial(rng.integers, 0, 10_000)
379-
if dtype is not None and np.dtype(dtype).kind in "iu"
380-
else rng.random
381-
)
382-
return f(shape, dtype=dtype) # type: ignore[arg-type]
354+
f: MkArray
355+
match np.dtype(dtype or "f").kind:
356+
case "f":
357+
f = rng.random # type: ignore[assignment]
358+
case "i" | "u":
359+
f = partial(rng.integers, 0, 10_000)
360+
case _:
361+
raise NotImplementedError
362+
return f(shape, dtype=dtype)
383363

384364

385365
def random_mat(

‎src/testing/fast_array_utils/pytest.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@
2929

3030

3131
def pytest_configure(config: pytest.Config) -> None:
32-
config.addinivalue_line(
33-
"markers", "array_type: filter tests using `testing.fast_array_utils.Flags`"
34-
)
32+
config.addinivalue_line("markers", "array_type: filter tests using `testing.fast_array_utils.Flags`")
3533

3634

3735
def _selected(
@@ -66,9 +64,7 @@ def pytest_collection_modifyitems(
6664
"""Filter tests using `pytest.mark.array_type` based on `testing.fast_array_utils.Flags`."""
6765
# reverse so we can .pop() items from the back without changing others’ index
6866
for i, item in reversed(list(enumerate(items))):
69-
if not (
70-
isinstance(item, pytest.Function) and (mark := item.get_closest_marker("array_type"))
71-
):
67+
if not (isinstance(item, pytest.Function) and (mark := item.get_closest_marker("array_type"))):
7268
continue
7369

7470
msg = "Test function marked with `pytest.mark.array_type` must have `array_type` parameter"
@@ -90,9 +86,7 @@ def _skip_if_unimportable(array_type: ArrayType) -> pytest.MarkDecorator:
9086
return pytest.mark.skipif(skip, reason=f"{dist} not installed")
9187

9288

93-
SUPPORTED_TYPE_PARAMS = [
94-
pytest.param(t, id=str(t), marks=_skip_if_unimportable(t)) for t in SUPPORTED_TYPES
95-
]
89+
SUPPORTED_TYPE_PARAMS = [pytest.param(t, id=str(t), marks=_skip_if_unimportable(t)) for t in SUPPORTED_TYPES]
9690

9791

9892
@pytest.fixture(scope="session", params=SUPPORTED_TYPE_PARAMS)
@@ -157,9 +151,7 @@ def hdf5_file(self) -> h5py.File: # type: ignore[override]
157151
try: # If we’re being called in a test or function-scoped fixture, use the test `tmp_path`
158152
return cast("h5py.File", self._request.getfixturevalue("tmp_hdf5_file"))
159153
except Failed: # We’re being called from a session-scoped fixture or so
160-
factory = cast(
161-
"pytest.TempPathFactory", self._request.getfixturevalue("tmp_path_factory")
162-
)
154+
factory = cast("pytest.TempPathFactory", self._request.getfixturevalue("tmp_path_factory"))
163155
name = re.sub(r"[^\w_. -()\[\]{}]", "_", os.environ["PYTEST_CURRENT_TEST"])
164156
f = h5py.File(factory.mktemp(name) / "test.h5", "w")
165157
self._request.addfinalizer(f.close)

‎tests/test_sparse.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@
2525
pytestmark = [pytest.mark.skipif(not find_spec("scipy"), reason="scipy not installed")]
2626

2727

28-
WARNS_NUMBA = pytest.warns(
29-
RuntimeWarning, match="numba is not installed; falling back to slow conversion"
30-
)
28+
WARNS_NUMBA = pytest.warns(RuntimeWarning, match="numba is not installed; falling back to slow conversion")
3129

3230

3331
@pytest.fixture(scope="session", params=["csr", "csc"])
@@ -47,9 +45,7 @@ def dtype(request: pytest.FixtureRequest) -> type[np.float32 | np.float64]:
4745

4846
@pytest.mark.array_type(select=Flags.Sparse, skip=Flags.Dask | Flags.Disk | Flags.Gpu)
4947
@pytest.mark.parametrize("order", ["C", "F"])
50-
def test_to_dense(
51-
array_type: ArrayType[CSBase, None], order: Literal["C", "F"], dtype: _DTypeLikeNum
52-
) -> None:
48+
def test_to_dense(array_type: ArrayType[CSBase, None], order: Literal["C", "F"], dtype: _DTypeLikeNum) -> None:
5349
mat = array_type.random((10, 10), density=0.1, dtype=dtype)
5450
with WARNS_NUMBA if not find_spec("numba") else nullcontext():
5551
arr = to_dense(mat, order=order)

‎tests/test_stats.py

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,8 @@ def np_arr(dtype_in: type[DTypeIn], ndim: Literal[1, 2]) -> NDArray[DTypeIn]:
106106

107107
@pytest.mark.array_type(skip={*ATS_SPARSE_DS, Flags.Matrix})
108108
@pytest.mark.parametrize("func", STAT_FUNCS)
109-
@pytest.mark.parametrize(
110-
("ndim", "axis"), [(1, 0), (2, 3), (2, -1)], ids=["1d-ax0", "2d-ax3", "2d-axneg"]
111-
)
112-
def test_ndim_error(
113-
array_type: ArrayType[Array], func: StatFun, ndim: Literal[1, 2], axis: Literal[0, 1, None]
114-
) -> None:
109+
@pytest.mark.parametrize(("ndim", "axis"), [(1, 0), (2, 3), (2, -1)], ids=["1d-ax0", "2d-ax3", "2d-axneg"])
110+
def test_ndim_error(array_type: ArrayType[Array], func: StatFun, ndim: Literal[1, 2], axis: Literal[0, 1, None]) -> None:
115111
check_ndim(array_type, ndim)
116112
# not using the fixture because we don’t need to test multiple dtypes
117113
np_arr = np.array([[1, 2, 3], [4, 5, 6]], dtype=np.float32)
@@ -175,9 +171,7 @@ def test_sum(
175171
)
176172
@pytest.mark.parametrize("axis", [0, 1])
177173
@pytest.mark.array_type(Flags.Dask)
178-
def test_sum_dask_shapes(
179-
array_type: ArrayType[types.DaskArray], axis: Literal[0, 1], data: list[list[int]]
180-
) -> None:
174+
def test_sum_dask_shapes(array_type: ArrayType[types.DaskArray], axis: Literal[0, 1], data: list[list[int]]) -> None:
181175
np_arr = np.array(data, dtype=np.float32)
182176
arr = array_type(np_arr)
183177
assert 1 in arr.chunksize, "This test is supposed to test 1×n and n×1 chunk sizes"
@@ -188,9 +182,7 @@ def test_sum_dask_shapes(
188182

189183

190184
@pytest.mark.array_type(skip=ATS_SPARSE_DS)
191-
def test_mean(
192-
array_type: ArrayType[Array], axis: Literal[0, 1, None], np_arr: NDArray[DTypeIn]
193-
) -> None:
185+
def test_mean(array_type: ArrayType[Array], axis: Literal[0, 1, None], np_arr: NDArray[DTypeIn]) -> None:
194186
arr = array_type(np_arr)
195187

196188
result = stats.mean(arr, axis=axis) # type: ignore[arg-type] # https://github.com/python/mypy/issues/16777
@@ -294,9 +286,7 @@ def test_is_constant(
294286

295287

296288
@pytest.mark.array_type(Flags.Dask, skip=ATS_CUPY_SPARSE)
297-
def test_dask_constant_blocks(
298-
dask_viz: Callable[[object], None], array_type: ArrayType[types.DaskArray, Any]
299-
) -> None:
289+
def test_dask_constant_blocks(dask_viz: Callable[[object], None], array_type: ArrayType[types.DaskArray, Any]) -> None:
300290
"""Tests if is_constant works if each chunk is individually constant."""
301291
x_np = np.repeat(np.repeat(np.arange(4, dtype=np.float64).reshape(2, 2), 2, axis=0), 2, axis=1)
302292
x = array_type(x_np)

‎tests/test_test_utils.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,7 @@ def test_conv(array_type: ArrayType, dtype: DTypeLike) -> None:
4040
def test_conv_other(array_type: ArrayType, other_array_type: ArrayType) -> None:
4141
src_arr = array_type(np.arange(12).reshape(3, 4), dtype=np.float32)
4242
with catch_warnings():
43-
filterwarnings(
44-
"ignore", r"numba is not installed; falling back to slow conversion", RuntimeWarning
45-
)
43+
filterwarnings("ignore", r"numba is not installed; falling back to slow conversion", RuntimeWarning)
4644
arr = other_array_type(src_arr)
4745
assert isinstance(arr, other_array_type.cls)
4846
if isinstance(arr, types.DaskArray):
@@ -70,14 +68,12 @@ def test_array_types(array_type: ArrayType) -> None:
7068
assert array_type.flags & Flags.Any
7169
assert array_type.flags & ~Flags(0)
7270
assert not (array_type.flags & Flags(0))
73-
assert ("sparse" in str(array_type) or array_type.name in {"CSCDataset", "CSRDataset"}) == bool(
74-
array_type.flags & Flags.Sparse
75-
)
71+
is_sparse = "sparse" in str(array_type) or array_type.name in {"CSCDataset", "CSRDataset"}
72+
assert is_sparse == bool(array_type.flags & Flags.Sparse)
7673
assert ("cupy" in str(array_type)) == bool(array_type.flags & Flags.Gpu)
7774
assert ("dask" in str(array_type)) == bool(array_type.flags & Flags.Dask)
78-
assert any(
79-
getattr(t, "mod", None) in {"zarr", "h5py"} for t in (array_type, array_type.inner)
80-
) == bool(array_type.flags & Flags.Disk)
75+
is_disk = any(getattr(t, "mod", None) in {"zarr", "h5py"} for t in (array_type, array_type.inner))
76+
assert is_disk == bool(array_type.flags & Flags.Disk)
8177

8278

8379
@pytest.fixture(scope="session")

‎tests/test_to_dense.py

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,26 +21,18 @@
2121
Array: TypeAlias = CpuArray | GpuArray | DiskArray | types.CSDataset | types.DaskArray
2222

2323

24-
WARNS_NUMBA = pytest.warns(
25-
RuntimeWarning, match="numba is not installed; falling back to slow conversion"
26-
)
24+
WARNS_NUMBA = pytest.warns(RuntimeWarning, match="numba is not installed; falling back to slow conversion")
2725

2826

2927
@pytest.mark.parametrize("to_cpu_memory", [True, False], ids=["to_cpu_memory", "not_to_cpu_memory"])
3028
def test_to_dense(array_type: ArrayType[Array], *, to_cpu_memory: bool) -> None:
3129
x = array_type([[1, 2, 3], [4, 5, 6]], dtype=np.float32)
3230
if not to_cpu_memory and array_type.cls in {types.CSCDataset, types.CSRDataset}:
33-
with pytest.raises(
34-
ValueError, match="to_cpu_memory must be True if x is an CS{R,C}Dataset"
35-
):
31+
with pytest.raises(ValueError, match="to_cpu_memory must be True if x is an CS{R,C}Dataset"):
3632
to_dense(x, to_cpu_memory=to_cpu_memory)
3733
return
3834

39-
with (
40-
WARNS_NUMBA
41-
if issubclass(array_type.cls, types.CSBase) and not find_spec("numba")
42-
else nullcontext()
43-
):
35+
with WARNS_NUMBA if issubclass(array_type.cls, types.CSBase) and not find_spec("numba") else nullcontext():
4436
arr = to_dense(x, to_cpu_memory=to_cpu_memory)
4537
assert_expected_cls(x, arr, to_cpu_memory=to_cpu_memory)
4638
assert arr.shape == (2, 3)

‎typings/cupyx/scipy/sparse/_compressed.pyi

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ class _compressed_sparse_matrix(spmatrix):
1616
@overload
1717
def __init__(self, arg1: tuple[ndarray, tuple[ndarray, ndarray]]) -> None: ...
1818
@overload
19-
def __init__(
20-
self, arg1: tuple[ndarray, ndarray, ndarray], shape: tuple[int, int] | None = None
21-
) -> None: ...
19+
def __init__(self, arg1: tuple[ndarray, ndarray, ndarray], shape: tuple[int, int] | None = None) -> None: ...
2220

2321
# methods
2422
def power(self, n: int, dtype: DTypeLike | None = None) -> Self: ...

‎typings/dask/array/core.pyi

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,7 @@ class Array:
5656
*,
5757
traverse: bool = True,
5858
maxval: float | None = None,
59-
color: Literal[
60-
"order", "ages", "freed", "memoryincreases", "memorydecreases", "memorypressure", None
61-
] = None,
59+
color: Literal["order", "ages", "freed", "memoryincreases", "memorydecreases", "memorypressure", None] = None,
6260
collapse_outputs: bool = False,
6361
verbose: bool = False,
6462
engine: str = "ipycytoscape",

‎typings/dask/array/reductions.pyi

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,12 @@ from .core import Array, _Array
99

1010
class _Chunk(Protocol):
1111
@overload
12-
def __call__(
13-
self,
14-
x_chunk: _Array,
15-
/,
16-
*,
17-
weights_chunk: NDArray[Any] | None = None,
18-
axis: tuple[int, ...],
19-
keepdims: bool,
20-
**kwargs: object,
21-
) -> _Array: ...
12+
def __call__(self, x_chunk: _Array, /, *, weights_chunk: NDArray[Any] | None = None, axis: tuple[int, ...], keepdims: bool, **kwargs: object) -> _Array: ...
2213
@overload
23-
def __call__(
24-
self, x_chunk: _Array, /, *, axis: tuple[int, ...], keepdims: bool, **kwargs: object
25-
) -> _Array: ...
14+
def __call__(self, x_chunk: _Array, /, *, axis: tuple[int, ...], keepdims: bool, **kwargs: object) -> _Array: ...
2615

2716
class _CB(Protocol):
28-
def __call__(
29-
self, x_chunk: _Array, /, *, axis: tuple[int, ...], keepdims: bool, **kwargs: object
30-
) -> _Array: ...
17+
def __call__(self, x_chunk: _Array, /, *, axis: tuple[int, ...], keepdims: bool, **kwargs: object) -> _Array: ...
3118

3219
def reduction(
3320
x: Array,

‎typings/numba/__init__.pyi

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,5 @@ def njit(
2828
@overload
2929
def prange(stop: SupportsIndex, /) -> Iterable[int]: ...
3030
@overload
31-
def prange(
32-
start: SupportsIndex, stop: SupportsIndex, step: SupportsIndex = ..., /
33-
) -> Iterable[int]: ...
31+
def prange(start: SupportsIndex, stop: SupportsIndex, step: SupportsIndex = ..., /) -> Iterable[int]: ...
3432
def get_num_threads() -> int: ...

‎typings/numba/core/cgutils.pyi

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,4 @@ class _StructProxy:
2222
def __getattr__(self, name: str) -> Value: ...
2323

2424
def create_struct_proxy(typ: Type) -> type[_StructProxy]: ...
25-
def alloca_once_value(
26-
builder: IRBuilder, value: Value, name: str = ..., zfill: bool = ...
27-
) -> Value: ...
25+
def alloca_once_value(builder: IRBuilder, value: Value, name: str = ..., zfill: bool = ...) -> Value: ...

‎typings/numba/core/datamodel/new_models.pyi

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,4 @@ class DataModel(Generic[_T]): ...
1111
class CompositeModel(DataModel[_T], Generic[_T]): ...
1212

1313
class StructModel(CompositeModel[_T], Generic[_T]):
14-
def __init__(
15-
self, dmm: DataModelManager, fe_type: _T, members: Iterable[tuple[str, Type]]
16-
) -> None: ...
14+
def __init__(self, dmm: DataModelManager, fe_type: _T, members: Iterable[tuple[str, Type]]) -> None: ...

‎typings/numba/core/imputils.pyi

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,4 @@ from numba.core.base import BaseContext
44
from numba.core.extending import NativeValue
55
from numba.core.types import Type
66

7-
def impl_ret_borrowed(
8-
context: BaseContext, builder: IRBuilder, typ: Type, value: Value
9-
) -> NativeValue: ...
7+
def impl_ret_borrowed(context: BaseContext, builder: IRBuilder, typ: Type, value: Value) -> NativeValue: ...

0 commit comments

Comments
 (0)
Please sign in to comment.