@@ -122,7 +122,7 @@ def _get_optimal_chunks_for_groups(chunks, labels):
122
122
firstidx = first_indexes [labels_at_chunk_bounds ]
123
123
124
124
newchunkidx = [0 ]
125
- for c , f , l in zip (chunkidx , firstidx , lastidx ):
125
+ for c , f , l in zip (chunkidx , firstidx , lastidx ): # noqa
126
126
Δf = abs (c - f )
127
127
Δl = abs (c - l )
128
128
if c == 0 or newchunkidx [- 1 ] > l :
@@ -362,7 +362,6 @@ def rechunk_for_blockwise(array: DaskArray, axis: T_Axis, labels: np.ndarray):
362
362
def reindex_ (
363
363
array : np .ndarray , from_ , to , fill_value = None , axis : T_Axis = - 1 , promote : bool = False
364
364
) -> np .ndarray :
365
-
366
365
if not isinstance (to , pd .Index ):
367
366
if promote :
368
367
to = pd .Index (to )
@@ -389,7 +388,7 @@ def reindex_(
389
388
)
390
389
idx = from_ .get_indexer (to )
391
390
indexer = [slice (None , None )] * array .ndim
392
- indexer [axis ] = idx # type: ignore
391
+ indexer [axis ] = idx
393
392
reindexed = array [tuple (indexer )]
394
393
if any (idx == - 1 ):
395
394
if fill_value is None :
@@ -417,7 +416,7 @@ def offset_labels(labels: np.ndarray, ngroups: int) -> tuple[np.ndarray, int]:
417
416
)
418
417
# -1 indicates NaNs. preserve these otherwise we aggregate in the wrong groups!
419
418
offset [labels == - 1 ] = - 1
420
- size : int = math .prod (labels .shape [:- 1 ]) * ngroups # type: ignore
419
+ size : int = math .prod (labels .shape [:- 1 ]) * ngroups
421
420
return offset , size
422
421
423
422
@@ -1213,7 +1212,6 @@ def dask_groupby_agg(
1213
1212
sort : bool = True ,
1214
1213
chunks_cohorts = None ,
1215
1214
) -> tuple [DaskArray , tuple [np .ndarray | DaskArray ]]:
1216
-
1217
1215
import dask .array
1218
1216
from dask .array .core import slices_from_chunks
1219
1217
@@ -1556,7 +1554,6 @@ def _factorize_multiple(by, expected_groups, any_by_dask, reindex):
1556
1554
1557
1555
1558
1556
def _validate_expected_groups (nby : int , expected_groups : T_ExpectedGroupsOpt ) -> T_ExpectTuple :
1559
-
1560
1557
if expected_groups is None :
1561
1558
return (None ,) * nby
1562
1559
0 commit comments