@@ -472,7 +472,7 @@ def __iter__(self):
472
472
yield ChunkDimProjection (dim_chunk_ix , dim_chunk_sel , dim_out_sel )
473
473
474
474
475
- def slice_to_range (s , l ): # noqa: E741
475
+ def slice_to_range (s : slice , l : int ): # noqa: E741
476
476
return range (* s .indices (l ))
477
477
478
478
@@ -916,8 +916,9 @@ def __init__(self, selection, arr_shape):
916
916
917
917
chunk_loc_slices = []
918
918
last_dim_slice = None if selection [- 1 ].step > 1 else selection .pop ()
919
- for arr_shape_i , sl in zip (selection , arr_shape ):
919
+ for arr_shape_i , sl in zip (arr_shape , selection ):
920
920
dim_chunk_loc_slices = []
921
+ assert isinstance (sl , slice )
921
922
for x in slice_to_range (sl , arr_shape_i ):
922
923
dim_chunk_loc_slices .append (slice (x , x + 1 , 1 ))
923
924
chunk_loc_slices .append (dim_chunk_loc_slices )
@@ -928,12 +929,10 @@ def __init__(self, selection, arr_shape):
928
929
def __iter__ (self ):
929
930
chunk1 = self .chunk_loc_slices [0 ]
930
931
nitems = (chunk1 [- 1 ].stop - chunk1 [- 1 ].start ) * np .prod (
931
- self .arr_shape [len (chunk1 ) :]
932
+ self .arr_shape [len (chunk1 ) :], dtype = int
932
933
)
933
934
for chunk_selection in self .chunk_loc_slices :
934
935
start = 0
935
936
for i , sl in enumerate (chunk_selection ):
936
- start += sl .start * np .prod (self .arr_shape [i + 1 :])
937
- assert isinstance (start , int )
938
- assert isinstance (nitems , int )
937
+ start += sl .start * np .prod (self .arr_shape [i + 1 :], dtype = int )
939
938
yield start , nitems , chunk_selection
0 commit comments