Skip to content

Commit c080a55

Browse files
style: pre-commit fixes
1 parent 20d859b commit c080a55

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

src/magpylib_material_response/demag.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ def demag_tensor(
173173
else:
174174
H_unit_pol = H_unique[unique_inv_inds]
175175
else:
176-
for src, pol in zip(src_list, pol_all):
176+
for src, pol in zip(src_list, pol_all, strict=False):
177177
src.polarization = pol
178178
if split > 1:
179179
src_list_split = np.array_split(src_list, split)
@@ -439,7 +439,7 @@ def apply_demag(
439439
pol_new = np.reshape(pol_new, (n, 3), order="F")
440440
# pol_new *= .4*np.pi
441441

442-
for s, pol in zip(collection.sources_all, pol_new):
442+
for s, pol in zip(collection.sources_all, pol_new, strict=False):
443443
s.polarization = s.orientation.inv().apply(pol) # ROTATION CHECK
444444

445445
if not inplace:

src/magpylib_material_response/meshing.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def mesh_Cuboid(cuboid, target_elems, verbose=False, **kwargs):
8080
# inside position grid
8181
xs, ys, zs = (
8282
np.linspace(d / 2 * (1 / n - 1), d / 2 * (1 - 1 / n), n)
83-
for d, n in zip(dim0, nnn)
83+
for d, n in zip(dim0, nnn, strict=False)
8484
)
8585
grid = np.array([(x, y, z) for x in xs for y in ys for z in zs])
8686

@@ -243,7 +243,7 @@ def mesh_thin_CylinderSegment_with_cuboids(
243243
rots = R.from_euler("z", phi_vec)
244244
cells = []
245245
for z in np.linspace(-h / 2 + dh / 2, h / 2 - dh / 2, nh):
246-
for pos, orient in zip(poss, rots):
246+
for pos, orient in zip(poss, rots, strict=False):
247247
child = magpy.magnet.Cuboid(
248248
polarization=orient.inv().apply(pol0),
249249
dimension=dim,
@@ -297,7 +297,7 @@ def slice_Cuboid(cuboid, shift=0.5, axis="z", **kwargs):
297297
dims_k = dim_k * (1 - shift), dim_k * (shift)
298298
shift_k = (dim_k - dims_k[0]) / 2, -(dim_k - dims_k[1]) / 2
299299
cells = []
300-
for d, s in zip(dims_k, shift_k):
300+
for d, s in zip(dims_k, shift_k, strict=False):
301301
dimension = dim0.copy()
302302
dimension[ind] = d
303303
position = np.array([0, 0, 0], dtype=float)
@@ -337,7 +337,9 @@ def voxelize(obj, target_elems, strict_inside=True, **kwargs):
337337
grid_elems = [int((vol_ratio * target_elems) ** (1 / 3))] * 3
338338
grid_dim = [containing_cube_edge] * 3
339339

340-
slices = [slice(-d / 2, d / 2, N * 1j) for d, N in zip(grid_dim, grid_elems)]
340+
slices = [
341+
slice(-d / 2, d / 2, N * 1j) for d, N in zip(grid_dim, grid_elems, strict=False)
342+
]
341343
grid = np.mgrid[slices].reshape(len(slices), -1).T
342344
grid = grid[mask_inside(obj, grid, tolerance=1e-14)]
343345
cube_cell_dim = np.array([containing_cube_edge / (grid_elems[0] - 1)] * 3)
@@ -427,7 +429,7 @@ def mesh_all(
427429
f"\nSupported: {[s.__name__ for s in supported]}."
428430
)
429431
raise TypeError(msg)
430-
for child, targ_elems in zip(supported_objs, target_elems_by_child):
432+
for child, targ_elems in zip(supported_objs, target_elems_by_child, strict=False):
431433
parent = child.parent
432434
kw = kwargs if parent is None else {}
433435
child_meshed = None

src/magpylib_material_response/meshing_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def cells_from_dimension(
9898
# closest triple with the target_elems constrain
9999
result = [funcs[0](k) for k in (a, b, c)] # first guess
100100
for fns in product(*[funcs] * 3):
101-
res = [f(k) for f, k in zip(fns, (a, b, c))]
101+
res = [f(k) for f, k in zip(fns, (a, b, c), strict=False)]
102102
epsilon_new = elems - np.prod(res)
103103
if (
104104
np.abs(epsilon_new) <= epsilon

0 commit comments

Comments
 (0)