Skip to content

Commit 9e5c6aa

Browse files
ruff fixes
1 parent a9f4397 commit 9e5c6aa

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/esmf_regrid/experimental/_partial.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
import numpy as np
44

55
from esmf_regrid.schemes import (
6-
_create_cube,
7-
_ESMFRegridder,
86
GridRecord,
97
MeshRecord,
8+
_create_cube,
9+
_ESMFRegridder,
1010
)
1111

1212

@@ -109,7 +109,7 @@ def finish_regridding(self, src_cube, weights, data, extra):
109109
out_dims = 1
110110
else:
111111
msg = "Unrecognised target information."
112-
raise ValueError(msg)
112+
raise TypeError(msg)
113113

114114
result_cube = _create_cube(
115115
result_data, src_cube, old_dims, tgt_coords, out_dims

src/esmf_regrid/experimental/partition.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def _get_chunk(cube, sl):
1414
else:
1515
grid_dims = (cube.mesh_dim(),)
1616
full_slice = [np.s_[:]] * len(cube.shape)
17-
for s, d in zip(sl, grid_dims):
17+
for s, d in zip(sl, grid_dims, strict=True):
1818
full_slice[d] = np.s_[s[0] : s[1]]
1919
return cube[*full_slice]
2020

@@ -56,16 +56,16 @@ def _determine_blocks(shape, chunks, num_chunks, explicit_blocks):
5656
raise ValueError(msg)
5757
# TODO: This is currently blocked by the fact that slicing an Iris cube on its mesh dimension
5858
# does not currently yield another cube with a mesh. When this is fixed, the following
59-
# code can be uncommented.
59+
# code can be uncommented and the noqa on the following line can be removed.
6060
# explicit_blocks = [
6161
# [[int(lower), int(upper)]]
62-
# for lower, upper in zip(bounds[0][:-1], bounds[0][1:])
62+
# for lower, upper in zip(bounds[0][:-1], bounds[0][1:], strict=True)
6363
# ]
64-
elif len(bounds) == 2:
64+
elif len(bounds) == 2: # noqa: RET506
6565
explicit_blocks = [
6666
[[int(ly), int(uy)], [int(lx), int(ux)]]
67-
for ly, uy in zip(bounds[0][:-1], bounds[0][1:])
68-
for lx, ux in zip(bounds[1][:-1], bounds[1][1:])
67+
for ly, uy in zip(bounds[0][:-1], bounds[0][1:], strict=True)
68+
for lx, ux in zip(bounds[1][:-1], bounds[1][1:], strict=True)
6969
]
7070
else:
7171
msg = "Chunks must not exceed two dimensions."
@@ -170,7 +170,7 @@ def __init__(
170170
raise NotImplementedError(msg)
171171

172172
# Note: this may need to become more sophisticated when both src and tgt are large
173-
self.file_block_dict = dict(zip(self.file_names, self.src_blocks))
173+
self.file_block_dict = dict(zip(self.file_names, self.src_blocks, strict=True))
174174

175175
if saved_files is None:
176176
self.saved_files = []

0 commit comments

Comments
 (0)