@@ -88,13 +88,15 @@ def __init__(
8888 # Slide level dimensions scale factor in each axis
8989 size_scale = tuple (
9090 int (osr .properties .get (prop , l0_lim )) / l0_lim
91- for prop , l0_lim in zip (self .BOUNDS_SIZE_PROPS , osr .dimensions )
91+ for prop , l0_lim in zip (
92+ self .BOUNDS_SIZE_PROPS , osr .dimensions , strict = True
93+ )
9294 )
9395 # Dimensions of active area
9496 self ._l_dimensions = tuple (
9597 tuple (
96- int ( math .ceil (l_lim * scale ) )
97- for l_lim , scale in zip (l_size , size_scale )
98+ math .ceil (l_lim * scale )
99+ for l_lim , scale in zip (l_size , size_scale , strict = True )
98100 )
99101 for l_size in osr .level_dimensions
100102 )
@@ -106,14 +108,14 @@ def __init__(
106108 z_size = self ._l0_dimensions
107109 z_dimensions = [z_size ]
108110 while z_size [0 ] > 1 or z_size [1 ] > 1 :
109- z_size = tuple (max (1 , int ( math .ceil (z / 2 ) )) for z in z_size )
111+ z_size = tuple (max (1 , math .ceil (z / 2 )) for z in z_size )
110112 z_dimensions .append (z_size )
111113 # Narrow the type, for self.level_dimensions
112114 self ._z_dimensions = self ._pairs_from_n_tuples (tuple (reversed (z_dimensions )))
113115
114116 # Tile
115117 def tiles (z_lim : int ) -> int :
116- return int ( math .ceil (z_lim / self ._z_t_downsample ) )
118+ return math .ceil (z_lim / self ._z_t_downsample )
117119
118120 self ._t_dimensions = tuple (
119121 (tiles (z_w ), tiles (z_h )) for z_w , z_h in self ._z_dimensions
@@ -203,7 +205,7 @@ def _get_tile_info(
203205 # Check parameters
204206 if dz_level < 0 or dz_level >= self ._dz_levels :
205207 raise ValueError ('Invalid level' )
206- for t , t_lim in zip (t_location , self ._t_dimensions [dz_level ]):
208+ for t , t_lim in zip (t_location , self ._t_dimensions [dz_level ], strict = True ):
207209 if t < 0 or t >= t_lim :
208210 raise ValueError ('Invalid address' )
209211
@@ -214,31 +216,37 @@ def _get_tile_info(
214216 z_overlap_tl = tuple (self ._z_overlap * int (t != 0 ) for t in t_location )
215217 z_overlap_br = tuple (
216218 self ._z_overlap * int (t != t_lim - 1 )
217- for t , t_lim in zip (t_location , self .level_tiles [dz_level ])
219+ for t , t_lim in zip (t_location , self .level_tiles [dz_level ], strict = True )
218220 )
219221
220222 # Get final size of the tile
221223 z_size = tuple (
222224 min (self ._z_t_downsample , z_lim - self ._z_t_downsample * t ) + z_tl + z_br
223225 for t , z_lim , z_tl , z_br in zip (
224- t_location , self ._z_dimensions [dz_level ], z_overlap_tl , z_overlap_br
226+ t_location ,
227+ self ._z_dimensions [dz_level ],
228+ z_overlap_tl ,
229+ z_overlap_br ,
230+ strict = True ,
225231 )
226232 )
227233
228234 # Obtain the region coordinates
229235 z_location = [self ._z_from_t (t ) for t in t_location ]
230236 l_location = [
231237 self ._l_from_z (dz_level , z - z_tl )
232- for z , z_tl in zip (z_location , z_overlap_tl )
238+ for z , z_tl in zip (z_location , z_overlap_tl , strict = True )
233239 ]
234240 # Round location down and size up, and add offset of active area
235241 l0_location = tuple (
236242 int (self ._l0_from_l (slide_level , l ) + l0_off )
237- for l , l0_off in zip (l_location , self ._l0_offset )
243+ for l , l0_off in zip (l_location , self ._l0_offset , strict = True )
238244 )
239245 l_size = tuple (
240246 int (min (math .ceil (self ._l_from_z (dz_level , dz )), l_lim - math .ceil (l )))
241- for l , dz , l_lim in zip (l_location , z_size , self ._l_dimensions [slide_level ])
247+ for l , dz , l_lim in zip (
248+ l_location , z_size , self ._l_dimensions [slide_level ], strict = True
249+ )
242250 )
243251
244252 # Return read_region() parameters plus tile size for final scaling
0 commit comments