diff --git a/examples/advection/surface.py b/examples/advection/surface.py index c7b96c69044df5996903b891c92a7270dec0b788..8eca7ab43755b293c2a50388b438747d17c4fb83 100644 --- a/examples/advection/surface.py +++ b/examples/advection/surface.py @@ -222,7 +222,7 @@ def main(ctx_factory, dim=2, order=4, use_quad=False, visualize=False): step = 0 event = dt_stepper.StateComputed(0.0, 0, 0, u0) - plot(event, "fld-surface-%04d" % 0) + plot(event, f"fld-surface-{0:04d}") if visualize and dim == 3: from grudge.shortcuts import make_visualizer @@ -253,7 +253,7 @@ def main(ctx_factory, dim=2, order=4, use_quad=False, visualize=False): step += 1 if step % 10 == 0: norm_u = actx.to_numpy(op.norm(dcoll, event.state_component, 2)) - plot(event, "fld-surface-%04d" % step) + plot(event, f"fld-surface-{step:04d}") logger.info("[%04d] t = %.5f |u| = %.5e", step, event.t, norm_u) diff --git a/examples/advection/var-velocity.py b/examples/advection/var-velocity.py index 7b6cebd8318868b5bff9453760422a5ff7ef8343..753bf263dc437e4c9bea332d1885fda066ab3f4e 100644 --- a/examples/advection/var-velocity.py +++ b/examples/advection/var-velocity.py @@ -211,7 +211,7 @@ def main(ctx_factory, dim=2, order=4, use_quad=False, visualize=False, if step % 10 == 0: norm_u = actx.to_numpy(op.norm(dcoll, event.state_component, 2)) - plot(event, "fld-var-velocity-%04d" % step) + plot(event, f"fld-var-velocity-{step:04d}") logger.info("[%04d] t = %.5f |u| = %.5e", step, event.t, norm_u) # NOTE: These are here to ensure the solution is bounded for the diff --git a/examples/advection/weak.py b/examples/advection/weak.py index 35ef9bf8eb4254ad2dee96d9e503b75989e0742f..72a2932d0dcdeb9fc0c48db00bc9b84c288291e2 100644 --- a/examples/advection/weak.py +++ b/examples/advection/weak.py @@ -184,7 +184,7 @@ def main(ctx_factory, dim=2, order=4, visualize=False): if step % 10 == 0: norm_u = actx.to_numpy(op.norm(dcoll, event.state_component, 2)) - plot(event, "fld-weak-%04d" % step) + plot(event, f"fld-weak-{step:04d}") step += 1 logger.info("[%04d] t = %.5f |u| = %.5e", step, event.t, norm_u) diff --git a/grudge/geometry/metrics.py b/grudge/geometry/metrics.py index e1fbe8f47092ef32601a6a13b2db39d2c1e41991..67fd19bbb008a53227a0f72af095ba13155eb247 100644 --- a/grudge/geometry/metrics.py +++ b/grudge/geometry/metrics.py @@ -837,7 +837,7 @@ def second_fundamental_form( elif dim == 2: second_ref_axes = [((0, 2),), ((0, 1), (1, 1)), ((1, 2),)] else: - raise ValueError("%dD surfaces not supported" % dim) + raise ValueError(f"{dim}D surfaces not supported") from pytools import flatten diff --git a/grudge/op.py b/grudge/op.py index f9e762f14a2af1902d8d0d1740cfdd3e8aea19b5..468024e449f4d493683163c347c5d203fcc061fb 100644 --- a/grudge/op.py +++ b/grudge/op.py @@ -217,8 +217,9 @@ def _gradient_kernel(actx, out_discr, in_discr, get_diff_mat, inv_jac_mat, vec, inv_jac_mat)] return make_obj_array([ - DOFArray( - actx, data=tuple([pgg_i[xyz_axis] for pgg_i in per_group_grads])) + DOFArray(actx, data=tuple([ # noqa: C409 + pgg_i[xyz_axis] for pgg_i in per_group_grads + ])) for xyz_axis in range(out_discr.ambient_dim)]) diff --git a/test/test_grudge.py b/test/test_grudge.py index 8a5a5a67852f35a719cceafe7b1f503ae1c5a018..b0849310b7b91c3fa359be0d67435825916e53c2 100644 --- a/test/test_grudge.py +++ b/test/test_grudge.py @@ -784,7 +784,7 @@ def test_convergence_advec(actx_factory, mesh_name, mesh_pars, op_type, flux_typ elif dim == 3: dt_factor = 2 else: - raise ValueError("dt_factor not known for %dd" % dim) + raise ValueError(f"dt_factor not known for {dim}d") elif mesh_name.startswith("warped"): dim = int(mesh_name[-1:]) mesh = mgen.generate_warped_rect_mesh(dim, order=order, @@ -795,7 +795,7 @@ def test_convergence_advec(actx_factory, mesh_name, mesh_pars, op_type, flux_typ elif dim == 3: dt_factor = 2 else: - raise ValueError("dt_factor not known for %dd" % dim) + raise ValueError(f"dt_factor not known for {dim}d") else: raise ValueError("invalid mesh name: " + mesh_name) @@ -861,7 +861,7 @@ def test_convergence_advec(actx_factory, mesh_name, mesh_pars, op_type, flux_typ if visualize: vis.write_vtk_file( - "fld-%s-%04d.vtu" % (mesh_par, step), + f"fld-{mesh_par}-{step:04d}vtu" % (mesh_par, step), [("u", u)] )