Skip to content

Commit

Permalink
fix issues with ruff 0.5.7
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfikl authored and inducer committed Aug 10, 2024
1 parent 08515c8 commit 7217a90
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions boxtree/tree_of_boxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,15 @@ def _resized_array(arr: np.ndarray, new_size: int) -> np.ndarray:
old_size = arr.shape[-1]
prefix = (slice(None), ) * (arr.ndim - 1)
if old_size >= new_size:
return arr[(*prefix, slice(new_size))].copy()
key = (*prefix, slice(new_size))
return arr[key].copy()
else:
new_shape = list(arr.shape)
new_shape[-1] = new_size
new_arr = np.zeros(new_shape, arr.dtype)
new_arr[(*prefix, slice(old_size))] = arr

key = (*prefix, slice(old_size))
new_arr[key] = arr
return new_arr


Expand Down

0 comments on commit 7217a90

Please sign in to comment.