Skip to content

⚠️ Update pre-commit hooks [review required] - #317

Draft
github-actions[bot] wants to merge 1 commit into
mainfrom
_bot/update-precommit
Draft

github-actions[bot] wants to merge 1 commit into
mainfrom
_bot/update-precommit

Conversation

@github-actions

@github-actions github-actions Bot commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

Pre-commit is unable to automatically update the hooks due to unresolvable conflicts.
Please review the changes and merge manually.

Log:

check for added large files..........................(no files to check)Skipped
check json...........................................(no files to check)Skipped
check toml...............................................................Passed
check yaml...............................................................Passed
detect private key.......................................................Passed
fix end of files.........................................................Passed
trim trailing whitespace.................................................Passed
Validate pyproject.toml..................................................Passed
uv-lock..................................................................Passed
ruff (legacy alias)......................................................Failed
- hook id: ruff
- exit code: 1

C408 Unnecessary `dict()` call (rewrite as a literal)
  --> adept/_base_.py:41:22
   |
39 |         del solver_state, made_jump
40 |         y1 = terms.vf(t0, y0, args)
41 |         dense_info = dict(y0=y0, y1=y1)
   |                      ^^^^^^^^^^^^^^^^^^
42 |         return y1, None, dense_info, None, RESULTS.successful
   |
help: Rewrite as a literal
   |
40 |         y1 = terms.vf(t0, y0, args)
   -         dense_info = dict(y0=y0, y1=y1)
41 +         dense_info = {"y0": y0, "y1": y1}
42 |         return y1, None, dense_info, None, RESULTS.successful
   |
note: This is an unsafe fix and may change runtime behavior

SIM102 Use a single `if` statement instead of nested `if` statements
   --> adept/_base_.py:287:9
    |
285 |           """
286 |           # Enforce float64 for kinetic solvers (density conservation requires it)
287 | /         if cfg["solver"] != "envelope-2d":
288 | |             if not jax.config.jax_enable_x64:
    | |_____________________________________________^
289 |                   raise RuntimeError(
290 |                       f"Solver '{cfg['solver']}' requires float64 for numerical precision. "
    |
help: Combine `if` statements using `and`
    |
286 |         # Enforce float64 for kinetic solvers (density conservation requires it)
    -         if cfg["solver"] != "envelope-2d":
    -             if not jax.config.jax_enable_x64:
    -                 raise RuntimeError(
    -                     f"Solver '{cfg['solver']}' requires float64 for numerical precision. "
    -                     "Set jax.config.update('jax_enable_x64', True) before importing adept."
    -                 )
287 +         if cfg["solver"] != "envelope-2d" and not jax.config.jax_enable_x64:
288 +             raise RuntimeError(
289 +                 f"Solver '{cfg['solver']}' requires float64 for numerical precision. "
290 +                 "Set jax.config.update('jax_enable_x64', True) before importing adept."
291 +             )
292 |
    |
note: This is an unsafe fix and may change runtime behavior

SIM118 Use `key in dict` instead of `key in dict.keys()`
   --> adept/_hermite_legendre_1d/modules.py:539:13
    |
537 |         coeff_data = {}
538 |
539 |         for k in sol.ys.keys():
    |             ^^^^^^^^^^^^^^^^^^
540 |             t_arr = np.asarray(sol.ts[k])
541 |             data = sol.ys[k]
    |
help: Remove `.keys()`
    |
538 |
    -         for k in sol.ys.keys():
539 +         for k in sol.ys:
540 |             t_arr = np.asarray(sol.ts[k])
    |
note: This is an unsafe fix and may change runtime behavior

BLE001 Do not catch blind exception: `Exception`
   --> adept/_hermite_legendre_1d/modules.py:557:32
    |
555 |                             ax.set_title(field_name)
556 |                             fig.savefig(os.path.join(plots_dir, f"spacetime-{field_name}.png"), bbox_inches="tight")
557 |                         except Exception as e:
    |                                ^^^^^^^^^
558 |                             print(f"post_process: spacetime plot for {field_name} failed: {e}")
559 |                         finally:
    |

BLE001 Do not catch blind exception: `Exception`
   --> adept/_hermite_legendre_1d/modules.py:589:32
    |
587 |                             axes[1].grid(alpha=0.3)
588 |                             fig.savefig(os.path.join(plots_dir, f"scalar-{name}.png"), bbox_inches="tight")
589 |                         except Exception as e:
    |                                ^^^^^^^^^
590 |                             print(f"post_process: scalar plot for {name} failed: {e}")
591 |                         finally:
    |

BLE001 Do not catch blind exception: `Exception`
   --> adept/_hermite_legendre_1d/modules.py:597:20
    |
595 |             try:
596 |                 datasets["distribution"] = _distribution_diagnostics(self.cfg, coeff_data, plots_dir, binary_dir)
597 |             except Exception as e:
    |                    ^^^^^^^^^
598 |                 print(f"post_process: distribution diagnostics failed: {e}")
    |

SIM118 Use `key in dict` instead of `key in dict.keys()`
   --> adept/_hermite_poisson_1d/modules.py:495:13
    |
493 |                     metrics[stat_key] = int(sol.stats[stat_key])
494 |
495 |         for k in sol.ys.keys():
    |             ^^^^^^^^^^^^^^^^^^
496 |             t_arr = np.asarray(sol.ts[k])
497 |             data = sol.ys[k]
    |
help: Remove `.keys()`
    |
494 |
    -         for k in sol.ys.keys():
495 +         for k in sol.ys:
496 |             t_arr = np.asarray(sol.ts[k])
    |
note: This is an unsafe fix and may change runtime behavior

BLE001 Do not catch blind exception: `Exception`
   --> adept/_hermite_poisson_1d/modules.py:519:32
    |
517 |                             ax.set_title(field_name)
518 |                             fig.savefig(os.path.join(plots_dir, f"spacetime-{field_name}.png"), bbox_inches="tight")
519 |                         except Exception as e:
    |                                ^^^^^^^^^
520 |                             print(f"post_process: spacetime plot for {field_name} failed: {e}")
521 |                         finally:
    |

BLE001 Do not catch blind exception: `Exception`
   --> adept/_hermite_poisson_1d/modules.py:550:32
    |
548 |                             axes[1].grid(alpha=0.3)
549 |                             fig.savefig(os.path.join(plots_dir, f"scalar-{name}.png"), bbox_inches="tight")
550 |                         except Exception as e:
    |                                ^^^^^^^^^
551 |                             print(f"post_process: scalar plot for {name} failed: {e}")
552 |                         finally:
    |

PLC0206 Extracting value from dictionary without calling `.items()`
  --> adept/_lpse2d/core/vector_field.py:67:13
   |
65 |     def _unpack_y_(self, y: dict[str, Array]) -> dict[str, Array]:
66 |         new_y = {}
67 |         for k in y:
   |             ^^^^^^
68 |             if k in self.complex_state_vars:
69 |                 new_y[k] = y[k].view(jnp.complex128)
   |                            ----
70 |             else:
71 |                 new_y[k] = y[k].view(jnp.float64)
   |                            ----
72 |         return new_y
   |
help: Use `for k, value in y.items()` instead

PLC0206 Extracting value from dictionary without calling `.items()`
  --> adept/_lpse2d/core/vector_field.py:75:13
   |
74 |     def _pack_y_(self, y: dict[str, Array], new_y: dict[str, Array]) -> tuple[dict[str, Array], dict[str, Array]]:
75 |         for k in y:
   |             ^^^^^^
76 |             y[k] = y[k].view(jnp.float64)
   |                    ----
77 |             new_y[k] = new_y[k].view(jnp.float64)
   |
help: Use `for k, value in y.items()` instead

C408 Unnecessary `dict()` call (rewrite as a literal)
   --> adept/_lpse2d/diagnostics.py:114:16
    |
112 |           resid = lnW - np.polyval(p, ts)
113 |           ss_tot = float(np.sum((lnW - lnW.mean()) ** 2))
114 |           return dict(
    |  ________________^
115 | |             epw_growth_rate=float(p[0] / 2.0),
116 | |             epw_growth_rate_r2=1.0 - float(np.sum(resid**2)) / ss_tot if ss_tot > 0 else 0.0,
117 | |             epw_growth_fit_tstart=float(ts[0]),
118 | |             epw_growth_fit_tend=float(ts[-1]),
119 | |             epw_growth_efolds=float((lnW[-1] - lnW[0]) / 2.0),
120 | |         )
    | |_________^
121 |
122 |       best = _lin_fit(i0, i1)
    |
help: Rewrite as a literal
    |
113 |         ss_tot = float(np.sum((lnW - lnW.mean()) ** 2))
    -         return dict(
    -             epw_growth_rate=float(p[0] / 2.0),
    -             epw_growth_rate_r2=1.0 - float(np.sum(resid**2)) / ss_tot if ss_tot > 0 else 0.0,
    -             epw_growth_fit_tstart=float(ts[0]),
    -             epw_growth_fit_tend=float(ts[-1]),
    -             epw_growth_efolds=float((lnW[-1] - lnW[0]) / 2.0),
    -         )
114 +         return {
115 +             "epw_growth_rate": float(p[0] / 2.0),
116 +             "epw_growth_rate_r2": 1.0 - float(np.sum(resid**2)) / ss_tot if ss_tot > 0 else 0.0,
117 +             "epw_growth_fit_tstart": float(ts[0]),
118 +             "epw_growth_fit_tend": float(ts[-1]),
119 +             "epw_growth_efolds": float((lnW[-1] - lnW[0]) / 2.0),
120 +         }
121 |
    |
note: This is an unsafe fix and may change runtime behavior

BLE001 Do not catch blind exception: `Exception`
   --> adept/_lpse2d/diagnostics.py:319:16
    |
318 |             f_tail = float(special.erfc(float(hpe["v_min"]) / np.sqrt(2.0)))
319 |         except Exception:
    |                ^^^^^^^^^
320 |             f_tail = 1.0
321 |         min_frac = 3.0 * f_tail / float(hpe["n_particles"])
    |

SIM118 Use `key in dict` instead of `key in dict.keys()`
   --> adept/_lpse2d/helpers.py:240:9
    |
239 |     # Default save.*.t.tmin/tmax to grid values (preserves unit strings)
240 |     for save_type in cfg.get("save", {}).keys():
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
241 |         if "t" in cfg["save"][save_type]:
242 |             t_cfg = cfg["save"][save_type]["t"]
    |
help: Remove `.keys()`
    |
239 |     # Default save.*.t.tmin/tmax to grid values (preserves unit strings)
    -     for save_type in cfg.get("save", {}).keys():
240 +     for save_type in cfg.get("save", {}):
241 |         if "t" in cfg["save"][save_type]:
    |
note: This is an unsafe fix and may change runtime behavior

SIM118 Use `key in dict` instead of `key in dict.keys()`
   --> adept/_lpse2d/helpers.py:468:9
    |
467 |     # change driver parameters to the right units
468 |     for k in cfg["drivers"].keys():
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^
469 |         cfg["drivers"][k]["derived"] = {}
470 |         if k == "E1":
    |
help: Remove `.keys()`
    |
467 |     # change driver parameters to the right units
    -     for k in cfg["drivers"].keys():
468 +     for k in cfg["drivers"]:
469 |         cfg["drivers"][k]["derived"] = {}
    |
note: This is an unsafe fix and may change runtime behavior

SIM118 Use `key in dict` instead of `key in dict.keys()`
    --> adept/_lpse2d/helpers.py:1003:9
     |
1002 | def plot_series(series, td):
1003 |     for k in series.keys():
     |         ^^^^^^^^^^^^^^^^^^
1004 |         if series[k].ndim != 1:
1005 |             continue
     |
help: Remove `.keys()`
     |
1002 | def plot_series(series, td):
     -     for k in series.keys():
1003 +     for k in series:
1004 |         if series[k].ndim != 1:
     |
note: This is an unsafe fix and may change runtime behavior

C408 Unnecessary `dict()` call (rewrite as a literal)
  --> adept/_lpse2d/modules/base.py:67:35
   |
65 |           }
66 |
67 |           self.diffeqsolve_quants = dict(
   |  ___________________________________^
68 | |             terms=ODETerm(SplitStep(self.cfg)),
69 | |             solver=Stepper(),
70 | |             saveat=dict(
71 | |                 subs={
72 | |                     k: SubSaveAt(ts=subsave["t"]["ax"], fn=subsave["func"]) for k, subsave in self.cfg["save"].items()
73 | |                 }
74 | |             ),
75 | |         )
   | |_________^
76 |
77 |       def init_state_and_args(self) -> dict:
   |
help: Rewrite as a literal
   |
66 |
   -         self.diffeqsolve_quants = dict(
   -             terms=ODETerm(SplitStep(self.cfg)),
   -             solver=Stepper(),
   -             saveat=dict(
67 +         self.diffeqsolve_quants = {
68 +             "terms": ODETerm(SplitStep(self.cfg)),
69 +             "solver": Stepper(),
70 +             "saveat": dict(
71 |                 subs={
72 |                     k: SubSaveAt(ts=subsave["t"]["ax"], fn=subsave["func"]) for k, subsave in self.cfg["save"].items()
73 |                 }
74 |             ),
   -         )
75 +         }
76 |
   |
note: This is an unsafe fix and may change runtime behavior

C408 Unnecessary `dict()` call (rewrite as a literal)
  --> adept/_lpse2d/modules/base.py:70:20
   |
68 |               terms=ODETerm(SplitStep(self.cfg)),
69 |               solver=Stepper(),
70 |               saveat=dict(
   |  ____________________^
71 | |                 subs={
72 | |                     k: SubSaveAt(ts=subsave["t"]["ax"], fn=subsave["func"]) for k, subsave in self.cfg["save"].items()
73 | |                 }
74 | |             ),
   | |_____________^
75 |           )
   |
help: Rewrite as a literal
   |
69 |             solver=Stepper(),
   -             saveat=dict(
   -                 subs={
70 +             saveat={
71 +                 "subs": {
72 |                     k: SubSaveAt(ts=subsave["t"]["ax"], fn=subsave["func"]) for k, subsave in self.cfg["save"].items()
73 |                 }
   -             ),
74 +             },
75 |         )
   |
note: This is an unsafe fix and may change runtime behavior

PERF102 When using only the values of a dict use the `values()` method
   --> adept/_lpse2d/modules/base.py:113:29
    |
111 |             args = self.args
112 |
113 |         for name, module in trainable_modules.items():
    |                             ^^^^^^^^^^^^^^^^^^^^^^^
114 |             state, args = module(state, args)
    |
help: Replace `.items()` with `.values()`
    |
112 |
    -         for name, module in trainable_modules.items():
113 +         for module in trainable_modules.values():
114 |             state, args = module(state, args)
    |
note: This is an unsafe fix and may change runtime behavior

C408 Unnecessary `dict()` call (rewrite as a literal)
   --> adept/_pic1d/modules.py:151:35
    |
149 |           grid = self.simulation.grid
150 |           self.time_quantities = {"t0": 0.0, "t1": grid.tmax, "max_steps": grid.max_steps}
151 |           self.diffeqsolve_quants = dict(
    |  ___________________________________^
152 | |             terms=ODETerm(PIC1DVectorField(self.cfg, grid, self.simulation.drivers)),
153 | |             solver=Stepper(),
154 | |             saveat=dict(subs={k: SubSaveAt(ts=v["t"]["ax"], fn=v["func"]) for k, v in self.cfg["save"].items()}),
155 | |         )
    | |_________^
156 |
157 |       def __call__(self, trainable_modules: dict, args: dict | None = None):
    |
help: Rewrite as a literal
    |
150 |         self.time_quantities = {"t0": 0.0, "t1": grid.tmax, "max_steps": grid.max_steps}
    -         self.diffeqsolve_quants = dict(
    -             terms=ODETerm(PIC1DVectorField(self.cfg, grid, self.simulation.drivers)),
    -             solver=Stepper(),
    -             saveat=dict(subs={k: SubSaveAt(ts=v["t"]["ax"], fn=v["func"]) for k, v in self.cfg["save"].items()}),
    -         )
151 +         self.diffeqsolve_quants = {
152 +             "terms": ODETerm(PIC1DVectorField(self.cfg, grid, self.simulation.drivers)),
153 +             "solver": Stepper(),
154 +             "saveat": dict(subs={k: SubSaveAt(ts=v["t"]["ax"], fn=v["func"]) for k, v in self.cfg["save"].items()}),
155 +         }
156 |
    |
note: This is an unsafe fix and may change runtime behavior

C408 Unnecessary `dict()` call (rewrite as a literal)
   --> adept/_pic1d/modules.py:154:20
    |
152 |             terms=ODETerm(PIC1DVectorField(self.cfg, grid, self.simulation.drivers)),
153 |             solver=Stepper(),
154 |             saveat=dict(subs={k: SubSaveAt(ts=v["t"]["ax"], fn=v["func"]) for k, v in self.cfg["save"].items()}),
    |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
155 |         )
    |
help: Rewrite as a literal
    |
153 |             solver=Stepper(),
    -             saveat=dict(subs={k: SubSaveAt(ts=v["t"]["ax"], fn=v["func"]) for k, v in self.cfg["save"].items()}),
154 +             saveat={"subs": {k: SubSaveAt(ts=v["t"]["ax"], fn=v["func"]) for k, v in self.cfg["save"].items()}},
155 |         )
    |
note: This is an unsafe fix and may change runtime behavior

SIM118 Use `key in dict` instead of `key in dict.keys()`
  --> adept/_pic1d/simulation.py:74:22
   |
73 | def _density_component_names(cfg: PIC1DConfig) -> list[str]:
74 |     return [name for name in cfg.density.model_extra.keys() if name.startswith("species-")]
   |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: Remove `.keys()`
   |
73 | def _density_component_names(cfg: PIC1DConfig) -> list[str]:
   -     return [name for name in cfg.density.model_extra.keys() if name.startswith("species-")]
74 +     return [name for name in cfg.density.model_extra if name.startswith("species-")]
75 |
   |
note: This is an unsafe fix and may change runtime behavior

SIM118 Use `key in dict` instead of `key in dict.keys()`
   --> adept/_spectrax1d/base_module.py:214:13
    |
213 |         # Default save.*.t.tmin/tmax to grid values
214 |         for save_type in self.cfg.get("save", {}).keys():
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
215 |             if "t" in self.cfg["save"][save_type]:
216 |                 t_cfg = self.cfg["save"][save_type]["t"]
    |
help: Remove `.keys()`
    |
213 |         # Default save.*.t.tmin/tmax to grid values
    -         for save_type in self.cfg.get("save", {}).keys():
214 +         for save_type in self.cfg.get("save", {}):
215 |             if "t" in self.cfg["save"][save_type]:
    |
note: This is an unsafe fix and may change runtime behavior

SIM118 Use `key in dict` instead of `key in dict.keys()`
    --> adept/_spectrax1d/base_module.py:1022:13
     |
1020 |         saved_datasets = {}
1021 |         has_fields_data = False
1022 |         for k in sol.ys.keys():
     |             ^^^^^^^^^^^^^^^^^^
1023 |             if k == "default":
1024 |                 # Default scalar diagnostics
     |
help: Remove `.keys()`
     |
1021 |         has_fields_data = False
     -         for k in sol.ys.keys():
1022 +         for k in sol.ys:
1023 |             if k == "default":
     |
note: This is an unsafe fix and may change runtime behavior

PERF102 When using only the values of a dict use the `values()` method
  --> adept/_spectrax1d/driver.py:62:41
   |
60 |         # so Ex remains real in real space and nonlinear E*C coupling stays local in k.
61 |         total_field = jnp.zeros(self.Nx, dtype=jnp.float64)
62 |         for pulse_name, pulse_params in pulse_configs.items():
   |                                         ^^^^^^^^^^^^^^^^^^^
63 |             total_field = total_field + self._get_single_pulse(pulse_params, t)
   |
help: Replace `.items()` with `.values()`
   |
61 |         total_field = jnp.zeros(self.Nx, dtype=jnp.float64)
   -         for pulse_name, pulse_params in pulse_configs.items():
62 +         for pulse_params in pulse_configs.values():
63 |             total_field = total_field + self._get_single_pulse(pulse_params, t)
   |
note: This is an unsafe fix and may change runtime behavior

PLC0206 Extracting value from dictionary without calling `.items()`
   --> adept/_spectrax1d/exponential_operators.py:348:13
    |
346 |         }
347 |         # Forward any extra state keys (e.g. SSM hidden state) unchanged
348 |         for k in y:
    |             ^^^^^^
349 |             if k not in out:
350 |                 out[k] = y[k]
    |                          ----
351 |         return out
    |
help: Use `for k, value in y.items()` instead

PLC0206 Extracting value from dictionary without calling `.items()`
   --> adept/_spectrax1d/integrators.py:272:13
    |
271 |         # Forward any extra state keys (e.g. SSM hidden state) unchanged
272 |         for k in y:
    |             ^^^^^^
273 |             if k not in y_damped:
274 |                 y_damped[k] = y[k]
    |                               ----
275 |
276 |         return y_damped
    |
help: Use `for k, value in y.items()` instead

C408 Unnecessary `dict()` call (rewrite as a literal)
   --> adept/_spectrax1d/integrators.py:407:22
    |
406 |         # Dense info for interpolation (linear between endpoints)
407 |         dense_info = dict(y0=y0, y1=y1)
    |                      ^^^^^^^^^^^^^^^^^^
408 |
409 |         return y1, y_error, dense_info, solver_state, RESULTS.successful
    |
help: Rewrite as a literal
    |
406 |         # Dense info for interpolation (linear between endpoints)
    -         dense_info = dict(y0=y0, y1=y1)
407 +         dense_info = {"y0": y0, "y1": y1}
408 |
    |
note: This is an unsafe fix and may change runtime behavior

PLC0206 Extracting value from dictionary without calling `.items()`
   --> adept/_spectrax1d/nonlinear_vector_field.py:308:13
    |
306 |         """Unpack state from float64 views to complex128."""
307 |         new_y = {}
308 |         for k in y:
    |             ^^^^^^
309 |             if k in self.complex_state_vars:
310 |                 new_y[k] = y[k].view(jnp.complex128)
    |                            ----
311 |             else:
312 |                 new_y[k] = y[k].view(jnp.float64)
    |                            ----
313 |         return new_y
    |
help: Use `for k, value in y.items()` instead

PLC0206 Extracting value from dictionary without calling `.items()`
   --> adept/_spectrax1d/nonlinear_vector_field.py:434:13
    |
432 |         # Zero derivatives for extra state keys (e.g. SSM hidden state,
433 |         # which is updated discretely by the closure solver, not the ODE RHS)
434 |         for k in y:
    |             ^^^^^^
435 |             if k not in out:
436 |                 out[k] = jnp.zeros_like(y[k])
    |                                         ----
437 |         return out
    |
help: Use `for k, value in y.items()` instead

SIM118 Use `key in dict` instead of `key in dict.keys()`
  --> adept/_tf1d/modules.py:35:16
   |
33 |         datasets = {}
34 |         if any(x in ["x", "kx"] for x in self.cfg["save"]):
35 |             if "x" in self.cfg["save"].keys():
   |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
36 |                 datasets["x"] = save_arrays(solver_result["solver result"], td, self.cfg, label="x")
37 |                 plot_xrs("x", td, datasets["x"])
   |
help: Remove `.keys()`
   |
34 |         if any(x in ["x", "kx"] for x in self.cfg["save"]):
   -             if "x" in self.cfg["save"].keys():
35 +             if "x" in self.cfg["save"]:
36 |                 datasets["x"] = save_arrays(solver_result["solver result"], td, self.cfg, label="x")
   |
note: This is an unsafe fix and may change runtime behavior

SIM118 Use `key in dict` instead of `key in dict.keys()`
  --> adept/_tf1d/modules.py:38:16
   |
36 |                 datasets["x"] = save_arrays(solver_result["solver result"], td, self.cfg, label="x")
37 |                 plot_xrs("x", td, datasets["x"])
38 |             if "kx" in self.cfg["save"].keys():
   |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
39 |                 datasets["kx"] = save_arrays(solver_result["solver result"], td, self.cfg, label="kx")
40 |                 plot_xrs("kx", td, datasets["kx"])
   |
help: Remove `.keys()`
   |
37 |                 plot_xrs("x", td, datasets["x"])
   -             if "kx" in self.cfg["save"].keys():
38 +             if "kx" in self.cfg["save"]:
39 |                 datasets["kx"] = save_arrays(solver_result["solver result"], td, self.cfg, label="kx")
   |
note: This is an unsafe fix and may change runtime behavior

SIM118 Use `key in dict` instead of `key in dict.keys()`
  --> adept/_tf1d/modules.py:68:12
   |
67 |         box_length = ((self.cfg["grid"]["xmax"] - self.cfg["grid"]["xmin"]) * x0).to("microns")
68 |         if "ymax" in self.cfg["grid"].keys():
   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
69 |             box_width = ((self.cfg["grid"]["ymax"] - self.cfg["grid"]["ymin"]) * x0).to("microns")
70 |         else:
   |
help: Remove `.keys()`
   |
67 |         box_length = ((self.cfg["grid"]["xmax"] - self.cfg["grid"]["xmin"]) * x0).to("microns")
   -         if "ymax" in self.cfg["grid"].keys():
68 +         if "ymax" in self.cfg["grid"]:
69 |             box_width = ((self.cfg["grid"]["ymax"] - self.cfg["grid"]["ymin"]) * x0).to("microns")
   |
note: This is an unsafe fix and may change runtime behavior

SIM118 Use `key in dict` instead of `key in dict.keys()`
   --> adept/_tf1d/modules.py:118:13
    |
117 |         # Default save.*.t.tmin/tmax to grid values
118 |         for save_type in self.cfg.get("save", {}).keys():
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
119 |             if "t" in self.cfg["save"][save_type]:
120 |                 t_cfg = self.cfg["save"][save_type]["t"]
    |
help: Remove `.keys()`
    |
117 |         # Default save.*.t.tmin/tmax to grid values
    -         for save_type in self.cfg.get("save", {}).keys():
118 +         for save_type in self.cfg.get("save", {}):
119 |             if "t" in self.cfg["save"][save_type]:
    |
note: This is an unsafe fix and may change runtime behavior

C408 Unnecessary `dict()` call (rewrite as a literal)
   --> adept/_tf1d/modules.py:184:35
    |
183 |           for species in ["ion", "electron"]:
184 |               self.state[species] = dict(
    |  ___________________________________^
185 | |                 n=jnp.ones(self.cfg["grid"]["nx"]),
186 | |                 p=jnp.full(self.cfg["grid"]["nx"], self.cfg["physics"][species]["T0"]),
187 | |                 u=jnp.zeros(self.cfg["grid"]["nx"]),
188 | |                 delta=jnp.zeros(self.cfg["grid"]["nx"]),
189 | |             )
    | |_____________^
190 |
191 |       def get_save_func(self) -> Callable:
    |
help: Rewrite as a literal
    |
183 |         for species in ["ion", "electron"]:
    -             self.state[species] = dict(
    -                 n=jnp.ones(self.cfg["grid"]["nx"]),
    -                 p=jnp.full(self.cfg["grid"]["nx"], self.cfg["physics"][species]["T0"]),
    -                 u=jnp.zeros(self.cfg["grid"]["nx"]),
    -                 delta=jnp.zeros(self.cfg["grid"]["nx"]),
    -             )
184 +             self.state[species] = {
185 +                 "n": jnp.ones(self.cfg["grid"]["nx"]),
186 +                 "p": jnp.full(self.cfg["grid"]["nx"], self.cfg["physics"][species]["T0"]),
187 +                 "u": jnp.zeros(self.cfg["grid"]["nx"]),
188 +                 "delta": jnp.zeros(self.cfg["grid"]["nx"]),
189 +             }
190 |
    |
note: This is an unsafe fix and may change runtime behavior

SIM118 Use `key in dict` instead of `key in dict.keys()`
   --> adept/_tf1d/modules.py:197:16
    |
195 |         """
196 |         if any(x in ["x", "kx"] for x in self.cfg["save"]):
197 |             if "x" in self.cfg["save"].keys():
    |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
198 |                 dx = (self.cfg["save"]["x"]["xmax"] - self.cfg["save"]["x"]["xmin"]) / self.cfg["save"]["x"]["nx"]
199 |                 self.cfg["save"]["x"]["ax"] = jnp.linspace(
    |
help: Remove `.keys()`
    |
196 |         if any(x in ["x", "kx"] for x in self.cfg["save"]):
    -             if "x" in self.cfg["save"].keys():
197 +             if "x" in self.cfg["save"]:
198 |                 dx = (self.cfg["save"]["x"]["xmax"] - self.cfg["save"]["x"]["xmin"]) / self.cfg["save"]["x"]["nx"]
    |
note: This is an unsafe fix and may change runtime behavior

SIM118 Use `key in dict` instead of `key in dict.keys()`
   --> adept/_tf1d/modules.py:207:16
    |
205 |                 save_x = partial(jnp.interp, self.cfg["save"]["x"]["ax"], self.cfg["grid"]["x"])
206 |
207 |             if "kx" in self.cfg["save"].keys():
    |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
208 |                 self.cfg["save"]["kx"]["ax"] = jnp.linspace(
209 |                     self.cfg["save"]["kx"]["kxmin"], self.cfg["save"]["kx"]["kxmax"], self.cfg["save"]["kx"]["nkx"]
    |
help: Remove `.keys()`
    |
206 |
    -             if "kx" in self.cfg["save"].keys():
207 +             if "kx" in self.cfg["save"]:
208 |                 self.cfg["save"]["kx"]["ax"] = jnp.linspace(
    |
note: This is an unsafe fix and may change runtime behavior

SIM118 Use `key in dict` instead of `key in dict.keys()`
   --> adept/_tf1d/modules.py:219:20
    |
217 |             def save_func(t, y, args):
218 |                 save_dict = {}
219 |                 if "x" in self.cfg["save"].keys():
    |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
220 |                     save_dict["x"] = jtu.tree_map(save_x, y)
221 |                 if "kx" in self.cfg["save"].keys():
    |
help: Remove `.keys()`
    |
218 |                 save_dict = {}
    -                 if "x" in self.cfg["save"].keys():
219 +                 if "x" in self.cfg["save"]:
220 |                     save_dict["x"] = jtu.tree_map(save_x, y)
    |
note: This is an unsafe fix and may change runtime behavior

SIM118 Use `key in dict` instead of `key in dict.keys()`
   --> adept/_tf1d/modules.py:221:20
    |
219 |                 if "x" in self.cfg["save"].keys():
220 |                     save_dict["x"] = jtu.tree_map(save_x, y)
221 |                 if "kx" in self.cfg["save"].keys():
    |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
222 |                     save_dict["kx"] = jtu.tree_map(save_kx, y)
    |
help: Remove `.keys()`
    |
220 |                     save_dict["x"] = jtu.tree_map(save_x, y)
    -                 if "kx" in self.cfg["save"].keys():
221 +                 if "kx" in self.cfg["save"]:
222 |                     save_dict["kx"] = jtu.tree_map(save_kx, y)
    |
note: This is an unsafe fix and may change runtime behavior

C408 Unnecessary `dict()` call (rewrite as a literal)
   --> adept/_tf1d/modules.py:248:35
    |
246 |               self.cfg["save"]["t"]["tmin"], self.cfg["save"]["t"]["tmax"], self.cfg["save"]["t"]["nt"]
247 |           )
248 |           self.diffeqsolve_quants = dict(
    |  ___________________________________^
249 | |             terms=ODETerm(VF(self.cfg)), solver=Tsit5(), saveat=dict(ts=self.cfg["save"]["t"]["ax"], fn=save_f)
250 | |         )
    | |_________^
251 |
252 |       def __call__(self, trainable_modules: dict, args: dict) -> dict:
    |
help: Rewrite as a literal
    |
247 |         )
    -         self.diffeqsolve_quants = dict(
    -             terms=ODETerm(VF(self.cfg)), solver=Tsit5(), saveat=dict(ts=self.cfg["save"]["t"]["ax"], fn=save_f)
    -         )
248 +         self.diffeqsolve_quants = {
249 +             "terms": ODETerm(VF(self.cfg)), "solver": Tsit5(), "saveat": dict(ts=self.cfg["save"]["t"]["ax"], fn=save_f)
250 +         }
251 |
    |
note: This is an unsafe fix and may change runtime behavior

C408 Unnecessary `dict()` call (rewrite as a literal)
   --> adept/_tf1d/modules.py:249:65
    |
247 |         )
248 |         self.diffeqsolve_quants = dict(
249 |             terms=ODETerm(VF(self.cfg)), solver=Tsit5(), saveat=dict(ts=self.cfg["save"]["t"]["ax"], fn=save_f)
    |                                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
250 |         )
    |
help: Rewrite as a literal
    |
248 |         self.diffeqsolve_quants = dict(
    -             terms=ODETerm(VF(self.cfg)), solver=Tsit5(), saveat=dict(ts=self.cfg["save"]["t"]["ax"], fn=save_f)
249 +             terms=ODETerm(VF(self.cfg)), solver=Tsit5(), saveat={"ts": self.cfg["save"]["t"]["ax"], "fn": save_f}
250 |         )
    |
note: This is an unsafe fix and may change runtime behavior

SIM210 Remove unnecessary `True if ... else False`
   --> adept/_tf1d/solvers/pushers.py:179:60
    |
178 |         table_wrs, table_wis, table_klds = get_complex_frequency_table(1024, kinetic_real_epw)
179 |         wrs, wis, klds = get_complex_frequency_table(1024, True if physics["gamma"] == "kinetic" else False)
    |                                                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
180 |         wrs = jnp.interp(kxr, table_klds, table_wrs, left=1.0, right=table_wrs[-1])
181 |         self.wis = jnp.interp(kxr, table_klds, table_wis, left=0.0, right=0.0)
    |
help: Remove unnecessary `True if ... else False`
    |
178 |         table_wrs, table_wis, table_klds = get_complex_frequency_table(1024, kinetic_real_epw)
    -         wrs, wis, klds = get_complex_frequency_table(1024, True if physics["gamma"] == "kinetic" else False)
179 +         wrs, wis, klds = get_complex_frequency_table(1024, physics["gamma"] == "kinetic")
180 |         wrs = jnp.interp(kxr, table_klds, table_wrs, left=1.0, right=table_wrs[-1])
    |
note: This is an unsafe fix and may change runtime behavior

SIM118 Use `key in dict` instead of `key in dict.keys()`
   --> adept/_vlasov1d/helpers.py:206:9
    |
204 |     fields_base_dir = os.path.join(td, "plots", "fields")
205 |
206 |     for k in result.ys.keys():
    |         ^^^^^^^^^^^^^^^^^^^^^
207 |         if k.startswith("field"):
208 |             # store_fields now returns dict with species names and "fields" keys
    |
help: Remove `.keys()`
    |
205 |
    -     for k in result.ys.keys():
206 +     for k in result.ys:
207 |         if k.startswith("field"):
    |
note: This is an unsafe fix and may change runtime behavior

PLC0414 Import alias does not rename original package
  --> adept/_vlasov1d/modules.py:13:41
   |
11 | from adept._vlasov1d.helpers import post_process
12 | from adept._vlasov1d.preparation import Vlasov1DSetup
13 | from adept._vlasov1d.preparation import sim_from_config as sim_from_config
   |                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
14 | from adept._vlasov1d.preparation import species_set_from_config as species_set_from_config
   |
help: Remove import alias
   |
12 | from adept._vlasov1d.preparation import Vlasov1DSetup
   - from adept._vlasov1d.preparation import sim_from_config as sim_from_config
13 + from adept._vlasov1d.preparation import sim_from_config
14 | from adept._vlasov1d.preparation import species_set_from_config as species_set_from_config
   |
note: This is an unsafe fix and may change runtime behavior

PLC0414 Import alias does not rename original package
  --> adept/_vlasov1d/modules.py:14:41
   |
12 | from adept._vlasov1d.preparation import Vlasov1DSetup
13 | from adept._vlasov1d.preparation import sim_from_config as sim_from_config
14 | from adept._vlasov1d.preparation import species_set_from_config as species_set_from_config
   |                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: Remove import alias
   |
13 | from adept._vlasov1d.preparation import sim_from_config as sim_from_config
   - from adept._vlasov1d.preparation import species_set_from_config as species_set_from_config
14 + from adept._vlasov1d.preparation import species_set_from_config
15 |
   |
note: This is an unsafe fix and may change runtime behavior

C408 Unnecessary `dict()` call (rewrite as a literal)
  --> adept/_vlasov1d/modules.py:40:35
   |
38 |           grid = self.simulation.grid
39 |           self.time_quantities = {"t0": 0.0, "t1": grid.tmax, "max_steps": grid.max_steps}
40 |           self.diffeqsolve_quants = dict(
   |  ___________________________________^
41 | |             terms=ODETerm(self.prepare_step()),
42 | |             solver=Stepper(),
43 | |             saveat=dict(subs={k: SubSaveAt(ts=v["t"]["ax"], fn=v["func"]) for k, v in saves.items()}),
44 | |         )
   | |_________^
45 |
46 |       def __call__(self, trainable_modules: dict, args: dict | None = None):
   |
help: Rewrite as a literal
   |
39 |         self.time_quantities = {"t0": 0.0, "t1": grid.tmax, "max_steps": grid.max_steps}
   -         self.diffeqsolve_quants = dict(
   -             terms=ODETerm(self.prepare_step()),
   -             solver=Stepper(),
   -             saveat=dict(subs={k: SubSaveAt(ts=v["t"]["ax"], fn=v["func"]) for k, v in saves.items()}),
   -         )
40 +         self.diffeqsolve_quants = {
41 +             "terms": ODETerm(self.prepare_step()),
42 +             "solver": Stepper(),
43 +             "saveat": dict(subs={k: SubSaveAt(ts=v["t"]["ax"], fn=v["func"]) for k, v in saves.items()}),
44 +         }
45 |
   |
note: This is an unsafe fix and may change runtime behavior

C408 Unnecessary `dict()` call (rewrite as a literal)
  --> adept/_vlasov1d/modules.py:43:20
   |
41 |             terms=ODETerm(self.prepare_step()),
42 |             solver=Stepper(),
43 |             saveat=dict(subs={k: SubSaveAt(ts=v["t"]["ax"], fn=v["func"]) for k, v in saves.items()}),
   |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
44 |         )
   |
help: Rewrite as a literal
   |
42 |             solver=Stepper(),
   -             saveat=dict(subs={k: SubSaveAt(ts=v["t"]["ax"], fn=v["func"]) for k, v in saves.items()}),
43 +             saveat={"subs": {k: SubSaveAt(ts=v["t"]["ax"], fn=v["func"]) for k, v in saves.items()}},
44 |         )
   |
note: This is an unsafe fix and may change runtime behavior

SIM118 Use `key in dict` instead of `key in dict.keys()`
  --> adept/_vlasov1d/preparation.py:23:40
   |
21 |     else:
22 |         # Collect all density components (keys starting with "species-")
23 |         density_components = [name for name in cfg.density.model_extra.keys() if name.startswith("species-")]
   |                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
24 |         if not density_components:
25 |             raise ValueError("No density components found (expected keys starting with 'species-')")
   |
help: Remove `.keys()`
   |
22 |         # Collect all density components (keys starting with "species-")
   -         density_components = [name for name in cfg.density.model_extra.keys() if name.startswith("species-")]
23 +         density_components = [name for name in cfg.density.model_extra if name.startswith("species-")]
24 |         if not density_components:
   |
note: This is an unsafe fix and may change runtime behavior

SIM118 Use `key in dict` instead of `key in dict.keys()`
   --> adept/_vlasov1d/preparation.py:102:12
    |
101 |         box_length = ((grid.xmax - grid.xmin) * norm.L0).to("microns")
102 |         if "ymax" in self.cfg["grid"].keys():
    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
103 |             box_width = ((self.cfg["grid"]["ymax"] - self.cfg["grid"]["ymin"]) * norm.L0).to("microns")
104 |         else:
    |
help: Remove `.keys()`
    |
101 |         box_length = ((grid.xmax - grid.xmin) * norm.L0).to("microns")
    -         if "ymax" in self.cfg["grid"].keys():
102 +         if "ymax" in self.cfg["grid"]:
103 |             box_width = ((self.cfg["grid"]["ymax"] - self.cfg["grid"]["ymin"]) * norm.L0).to("microns")
    |
note: This is an unsafe fix and may change runtime behavior

SIM118 Use `key in dict` instead of `key in dict.keys()`
   --> adept/_vlasov2d/helpers.py:251:9
    |
250 |     fields_result = {}
251 |     for k in result.ys.keys():
    |         ^^^^^^^^^^^^^^^^^^^^^
252 |         if k.startswith("field"):
253 |             fields_dict = store_fields(cfg, binary_dir, result.ys[k], result.ts[k], k)
    |
help: Remove `.keys()`
    |
250 |     fields_result = {}
    -     for k in result.ys.keys():
251 +     for k in result.ys:
252 |         if k.startswith("field"):
    |
note: This is an unsafe fix and may change runtime behavior

SIM118 Use `key in dict` instead of `key in dict.keys()`
  --> adept/_vlasov2d/modules.py:32:28
   |
30 |     if cfg.terms.species:
31 |         return [Species.from_config(s) for s in cfg.terms.species]
32 |     components = [name for name in cfg.density.model_extra.keys() if name.startswith("species-")]
   |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
33 |     if not components:
34 |         raise ValueError("No density components found (expected keys starting with 'species-').")
   |
help: Remove `.keys()`
   |
31 |         return [Species.from_config(s) for s in cfg.terms.species]
   -     components = [name for name in cfg.density.model_extra.keys() if name.startswith("species-")]
32 +     components = [name for name in cfg.density.model_extra if name.startswith("species-")]
33 |     if not components:
   |
note: This is an unsafe fix and may change runtime behavior

SIM118 Use `key in dict` instead of `key in dict.keys()`
   --> adept/_vlasov2d/modules.py:215:13
    |
213 |         poisson = InitialPoissonSolver(self.simulation.grid.kx, self.simulation.grid.ky)
214 |         rho0 = jnp.zeros((grid.nx, grid.ny))
215 |         for s_name in dist_result.keys():
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
216 |             sg = self.cfg["grid"]["species_grids"][s_name]
217 |             q = self.cfg["grid"]["species_params"][s_name]["charge"]
    |
help: Remove `.keys()`
    |
214 |         rho0 = jnp.zeros((grid.nx, grid.ny))
    -         for s_name in dist_result.keys():
215 +         for s_name in dist_result:
216 |             sg = self.cfg["grid"]["species_grids"][s_name]
    |
note: This is an unsafe fix and may change runtime behavior

C408 Unnecessary `dict()` call (rewrite as a literal)
   --> adept/_vlasov2d/modules.py:241:35
    |
239 |           grid = self.simulation.grid
240 |           self.time_quantities = {"t0": 0.0, "t1": grid.tmax, "max_steps": grid.max_steps}
241 |           self.diffeqsolve_quants = dict(
    |  ___________________________________^
242 | |             terms=ODETerm(VlasovMaxwell(self.cfg, grid, self.simulation)),
243 | |             solver=Stepper(),
244 | |             saveat=dict(subs={k: SubSaveAt(ts=v["t"]["ax"], fn=v["func"]) for k, v in self.cfg["save"].items()}),
245 | |         )
    | |_________^
246 |
247 |       def __call__(self, trainable_modules: dict, args: dict | None = None):
    |
help: Rewrite as a literal
    |
240 |         self.time_quantities = {"t0": 0.0, "t1": grid.tmax, "max_steps": grid.max_steps}
    -         self.diffeqsolve_quants = dict(
    -             terms=ODETerm(VlasovMaxwell(self.cfg, grid, self.simulation)),
    -             solver=Stepper(),
    -             saveat=dict(subs={k: SubSaveAt(ts=v["t"]["ax"], fn=v["func"]) for k, v in self.cfg["save"].items()}),
    -         )
241 +         self.diffeqsolve_quants = {
242 +             "terms": ODETerm(VlasovMaxwell(self.cfg, grid, self.simulation)),
243 +             "solver": Stepper(),
244 +             "saveat": dict(subs={k: SubSaveAt(ts=v["t"]["ax"], fn=v["func"]) for k, v in self.cfg["save"].items()}),
245 +         }
246 |
    |
note: This is an unsafe fix and may change runtime behavior

C408 Unnecessary `dict()` call (rewrite as a literal)
   --> adept/_vlasov2d/modules.py:244:20
    |
242 |             terms=ODETerm(VlasovMaxwell(self.cfg, grid, self.simulation)),
243 |             solver=Stepper(),
244 |             saveat=dict(subs={k: SubSaveAt(ts=v["t"]["ax"], fn=v["func"]) for k, v in self.cfg["save"].items()}),
    |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
245 |         )
    |
help: Rewrite as a literal
    |
243 |             solver=Stepper(),
    -             saveat=dict(subs={k: SubSaveAt(ts=v["t"]["ax"], fn=v["func"]) for k, v in self.cfg["save"].items()}),
244 +             saveat={"subs": {k: SubSaveAt(ts=v["t"]["ax"], fn=v["func"]) for k, v in self.cfg["save"].items()}},
245 |         )
    |
note: This is an unsafe fix and may change runtime behavior

SIM118 Use `key in dict` instead of `key in dict.keys()`
   --> adept/_vlasov2d/solvers/vector_field.py:129:37
    |
128 |     def __call__(self, t, y, args):
129 |         f_dict = {name: y[name] for name in self.species_grids.keys()}
    |                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
130 |         ex = y["ex"]
131 |         ey = y["ey"]
    |
help: Remove `.keys()`
    |
128 |     def __call__(self, t, y, args):
    -         f_dict = {name: y[name] for name in self.species_grids.keys()}
129 +         f_dict = {name: y[name] for name in self.species_grids}
130 |         ex = y["ex"]
    |
note: This is an unsafe fix and may change runtime behavior

BLE001 Do not catch blind exception: `Exception`
   --> adept/core/checkpoints.py:751:20
    |
749 |                     shutil.rmtree(checkpoint_path)
750 |                 _fsync_directory(self.root)
751 |             except Exception as rollback_error:
    |                    ^^^^^^^^^
752 |                 rollback_errors.append(f"checkpoint data rollback failed: {rollback_error}")
753 |             if latest_update_started:
    |

BLE001 Do not catch blind exception: `Exception`
   --> adept/core/checkpoints.py:756:24
    |
754 |                 try:
755 |                     self._restore_latest_snapshot(previous_latest)
756 |                 except Exception as rollback_error:
    |                        ^^^^^^^^^
757 |                     rollback_errors.append(f"latest pointer rollback failed: {rollback_error}")
758 |             for message in rollback_errors:
    |

PLC0105 `TypeVar` name "ProgramParamsT" does not reflect its contravariance; consider renaming it to "ProgramParamsT_contra"
   --> adept/core/contracts.py:321:18
    |
319 | InputsT = TypeVar("InputsT")
320 | AnalyzerT = TypeVar("AnalyzerT")
321 | ProgramParamsT = TypeVar("ProgramParamsT", contravariant=True)
    |                  ^^^^^^^
322 | ProgramStateT = TypeVar("ProgramStateT", contravariant=True)
323 | ProgramInputsT = TypeVar("ProgramInputsT", contravariant=True)
    |

PLC0105 `TypeVar` name "ProgramStateT" does not reflect its contravariance; consider renaming it to "ProgramStateT_contra"
   --> adept/core/contracts.py:322:17
    |
320 | AnalyzerT = TypeVar("AnalyzerT")
321 | ProgramParamsT = TypeVar("ProgramParamsT", contravariant=True)
322 | ProgramStateT = TypeVar("ProgramStateT", contravariant=True)
    |                 ^^^^^^^
323 | ProgramInputsT = TypeVar("ProgramInputsT", contravariant=True)
324 | KeyT = TypeVar("KeyT", contravariant=True)
    |

PLC0105 `TypeVar` name "ProgramInputsT" does not reflect its contravariance; consider renaming it to "ProgramInputsT_contra"
   --> adept/core/contracts.py:323:18
    |
321 | ProgramParamsT = TypeVar("ProgramParamsT", contravariant=True)
322 | ProgramStateT = TypeVar("ProgramStateT", contravariant=True)
323 | ProgramInputsT = TypeVar("ProgramInputsT", contravariant=True)
    |                  ^^^^^^^
324 | KeyT = TypeVar("KeyT", contravariant=True)
325 | RawResultT = TypeVar("RawResultT", covariant=True)
    |

PLC0105 `TypeVar` name "KeyT" does not reflect its contravariance; consider renaming it to "KeyT_contra"
   --> adept/core/contracts.py:324:8
    |
322 | ProgramStateT = TypeVar("ProgramStateT", contravariant=True)
323 | ProgramInputsT = TypeVar("ProgramInputsT", contravariant=True)
324 | KeyT = TypeVar("KeyT", contravariant=True)
    |        ^^^^^^^
325 | RawResultT = TypeVar("RawResultT", covariant=True)
326 | ObjectiveRawResultT = TypeVar("ObjectiveRawResultT", contravariant=True)
    |

PLC0105 `TypeVar` name "RawResultT" does not reflect its covariance; consider renaming it to "RawResultT_co"
   --> adept/core/contracts.py:325:14
    |
323 | ProgramInputsT = TypeVar("ProgramInputsT", contravariant=True)
324 | KeyT = TypeVar("KeyT", contravariant=True)
325 | RawResultT = TypeVar("RawResultT", covariant=True)
    |              ^^^^^^^
326 | ObjectiveRawResultT = TypeVar("ObjectiveRawResultT", contravariant=True)
327 | ObjectiveParamsT = TypeVar("ObjectiveParamsT", contravariant=True)
    |

PLC0105 `TypeVar` name "ObjectiveRawResultT" does not reflect its contravariance; consider renaming it to "ObjectiveRawResultT_contra"
   --> adept/core/contracts.py:326:23
    |
324 | KeyT = TypeVar("KeyT", contravariant=True)
325 | RawResultT = TypeVar("RawResultT", covariant=True)
326 | ObjectiveRawResultT = TypeVar("ObjectiveRawResultT", contravariant=True)
    |                       ^^^^^^^
327 | ObjectiveParamsT = TypeVar("ObjectiveParamsT", contravariant=True)
328 | ObjectiveInputsT = TypeVar("ObjectiveInputsT", contravariant=True)
    |

PLC0105 `TypeVar` name "ObjectiveParamsT" does not reflect its contravariance; consider renaming it to "ObjectiveParamsT_contra"
   --> adept/core/contracts.py:327:20
    |
325 | RawResultT = TypeVar("RawResultT", covariant=True)
326 | ObjectiveRawResultT = TypeVar("ObjectiveRawResultT", contravariant=True)
327 | ObjectiveParamsT = TypeVar("ObjectiveParamsT", contravariant=True)
    |                    ^^^^^^^
328 | ObjectiveInputsT = TypeVar("ObjectiveInputsT", contravariant=True)
329 | AnalyzedResultT = TypeVar("AnalyzedResultT", contravariant=True)
    |

PLC0105 `TypeVar` name "ObjectiveInputsT" does not reflect its contravariance; consider renaming it to "ObjectiveInputsT_contra"
   --> adept/core/contracts.py:328:20
    |
326 | ObjectiveRawResultT = TypeVar("ObjectiveRawResultT", contravariant=True)
327 | ObjectiveParamsT = TypeVar("ObjectiveParamsT", contravariant=True)
328 | ObjectiveInputsT = TypeVar("ObjectiveInputsT", contravariant=True)
    |                    ^^^^^^^
329 | AnalyzedResultT = TypeVar("AnalyzedResultT", contravariant=True)
330 | ReportT = TypeVar("ReportT", covariant=True)
    |

PLC0105 `TypeVar` name "AnalyzedResultT" does not reflect its contravariance; consider renaming it to "AnalyzedResultT_contra"
   --> adept/core/contracts.py:329:19
    |
327 | ObjectiveParamsT = TypeVar("ObjectiveParamsT", contravariant=True)
328 | ObjectiveInputsT = TypeVar("ObjectiveInputsT", contravariant=True)
329 | AnalyzedResultT = TypeVar("AnalyzedResultT", contravariant=True)
    |                   ^^^^^^^
330 | ReportT = TypeVar("ReportT", covariant=True)
    |

PLC0105 `TypeVar` name "ReportT" does not reflect its covariance; consider renaming it to "ReportT_co"
   --> adept/core/contracts.py:330:11
    |
328 | ObjectiveInputsT = TypeVar("ObjectiveInputsT", contravariant=True)
329 | AnalyzedResultT = TypeVar("AnalyzedResultT", contravariant=True)
330 | ReportT = TypeVar("ReportT", covariant=True)
    |           ^^^^^^^

PYI034 `__enter__` methods in classes like `LocalExecutor` usually return `self` at runtime
   --> adept/core/executors.py:437:9
    |
435 |         self._pool.shutdown(wait=wait, cancel_futures=cancel_futures)
436 |
437 |     def __enter__(self) -> LocalExecutor:
    |         ^^^^^^^^^
438 |         return self
    |
help: Use `Self` as return type
    |
13  | from threading import Lock, RLock
    - from typing import Any, Protocol, runtime_checkable
14  + from typing import Any, Protocol, runtime_checkable, Self
15  | from uuid import uuid4
--------------------------------------------------------------------------------
436 |
    -     def __enter__(self) -> LocalExecutor:
437 +     def __enter__(self) -> Self:
438 |         return self
    |
note: This is an unsafe fix and may change runtime behavior

PYI036 The first argument in `__exit__` should be annotated with `object` or `type[BaseException] | None`
   --> adept/core/executors.py:440:34
    |
438 |         return self
439 |
440 |     def __exit__(self, exc_type: Any, exc: Any, traceback: Any) -> None:
    |                                  ^^^
441 |         del exc_type, exc, traceback
442 |         self.shutdown()
    |

PYI036 The second argument in `__exit__` should be annotated with `object` or `BaseException | None`
   --> adept/core/executors.py:440:44
    |
438 |         return self
439 |
440 |     def __exit__(self, exc_type: Any, exc: Any, traceback: Any) -> None:
    |                                            ^^^
441 |         del exc_type, exc, traceback
442 |         self.shutdown()
    |

PYI036 The third argument in `__exit__` should be annotated with `object` or `types.TracebackType | None`
   --> adept/core/executors.py:440:60
    |
438 |         return self
439 |
440 |     def __exit__(self, exc_type: Any, exc: Any, traceback: Any) -> None:
    |                                                            ^^^
441 |         del exc_type, exc, traceback
442 |         self.shutdown()
    |

BLE001 Do not catch blind exception: `Exception`
   --> adept/core/runtime.py:194:20
    |
192 |             try:
193 |                 tracker.finish(handle, RunStatus.FAILED, error=str(primary_error))
194 |             except Exception as tracking_error:
    |                    ^^^^^^^^^
195 |                 primary_error.add_note(_tracking_error("tracker failure status", tracking_error))
196 |         raise
    |

BLE001 Do not catch blind exception: `Exception`
   --> adept/core/tracking_mlflow.py:131:16
    |
129 |         try:
130 |             return str(client.create_experiment(name))
131 |         except Exception as error:
    |                ^^^^^^^^^
132 |             # A concurrent process may have won creation. Resolve the explicit id
133 |             # rather than falling back to MLflow's process-global default experiment.
    |

BLE001 Do not catch blind exception: `Exception`
   --> adept/core/tracking_mlflow.py:220:20
    |
218 |             try:
219 |                 client.set_tag(handle.run_id, "adept.error", error[:5000], synchronous=True)
220 |             except Exception as caught:
    |                    ^^^^^^^^^
221 |                 tag_error = caught
222 |         client.set_terminated(handle.run_id, status=status.value)
    |

SIM118 Use `key in dict` instead of `key in dict.keys()`
   --> adept/osiris/deck.py:287:83
    |
285 |             raise KeyError(f"Override references unknown section: {sec_name!r}")
286 |         occurrences = by_name[sec_name]
287 |         if isinstance(sec_over, dict) and sec_over and all(isinstance(k, int) for k in sec_over.keys()):
    |                                                                                   ^^^^^^^^^^^^^^^^^^^^
288 |             for idx, params_over in sec_over.items():
289 |                 if idx < 0 or idx >= len(occurrences):
    |
help: Remove `.keys()`
    |
286 |         occurrences = by_name[sec_name]
    -         if isinstance(sec_over, dict) and sec_over and all(isinstance(k, int) for k in sec_over.keys()):
287 +         if isinstance(sec_over, dict) and sec_over and all(isinstance(k, int) for k in sec_over):
288 |             for idx, params_over in sec_over.items():
    |
note: This is an unsafe fix and may change runtime behavior

SIM118 Use `key in dict` instead of `key in dict.keys()`
  --> adept/osiris/io.py:91:28
   |
89 |     with h5py.File(path, "r") as f:
90 |         # Identify the data dataset (everything that's not AXIS / SIMULATION).
91 |         data_keys = [k for k in f.keys() if k not in ("AXIS", "SIMULATION")]
   |                            ^^^^^^^^^^^^^
92 |         if len(data_keys) != 1:
93 |             raise ValueError(f"Expected exactly one data dataset in {path}; got {data_keys}")
   |
help: Remove `.keys()`
   |
90 |         # Identify the data dataset (everything that's not AXIS / SIMULATION).
   -         data_keys = [k for k in f.keys() if k not in ("AXIS", "SIMULATION")]
91 +         data_keys = [k for k in f if k not in ("AXIS", "SIMULATION")]
92 |         if len(data_keys) != 1:
   |
note: This is an unsafe fix and may change runtime behavior

SIM118 Use `key in dict` instead of `key in dict.keys()`
   --> adept/osiris/io.py:143:24
    |
141 |     ``AXIS`` group, as non-grid.
142 |     """
143 |     data_keys = [k for k in f.keys() if k not in ("AXIS", "SIMULATION")]
    |                        ^^^^^^^^^^^^^
144 |     return len(data_keys) != 1 or "AXIS" not in f
    |
help: Remove `.keys()`
    |
142 |     """
    -     data_keys = [k for k in f.keys() if k not in ("AXIS", "SIMULATION")]
143 +     data_keys = [k for k in f if k not in ("AXIS", "SIMULATION")]
144 |     return len(data_keys) != 1 or "AXIS" not in f
    |
note: This is an unsafe fix and may change runtime behavior

SIM118 Use `key in dict` instead of `key in dict.keys()`
   --> adept/osiris/io.py:164:34
    |
162 |     path = Path(path)
163 |     with h5py.File(path, "r") as f:
164 |         data_keys = sorted(k for k in f.keys() if k not in ("AXIS", "SIMULATION") and isinstance(f[k], h5py.Dataset))
    |                                  ^^^^^^^^^^^^^
165 |         data_vars: dict[str, tuple] = {}
166 |         for name in data_keys:
    |
help: Remove `.keys()`
    |
163 |     with h5py.File(path, "r") as f:
    -         data_keys = sorted(k for k in f.keys() if k not in ("AXIS", "SIMULATION") and isinstance(f[k], h5py.Dataset))
164 +         data_keys = sorted(k for k in f if k not in ("AXIS", "SIMULATION") and isinstance(f[k], h5py.Dataset))
165 |         data_vars: dict[str, tuple] = {}
    |
note: This is an unsafe fix and may change runtime behavior

BLE001 Do not catch blind exception: `Exception`
   --> adept/osiris/io.py:263:12
    |
261 |         with h5py.File(dumps[0], "r") as f:
262 |             return _is_raw_h5(f)
263 |     except Exception:
    |            ^^^^^^^^^
264 |         return False
    |

BLE001 Do not catch blind exception: `Exception`
   --> adept/osiris/io.py:753:16
    |
751 |                 ds.to_netcdf(dest, engine="h5netcdf", encoding=_compression_encoding(ds))
752 |             written.append(dest)
753 |         except Exception as e:  # one bad diagnostic must not abort the rest
    |                ^^^^^^^^^
754 |             print(f"[post] skipping diagnostic {relpath}: {e}")
755 |             continue
    |

BLE001 Do not catch blind exception: `Exception`
   --> adept/osiris/io.py:767:12
    |
765 |             energy.to_netcdf(dest, engine="h5netcdf", encoding=_compression_encoding(energy))
766 |             written.append(dest)
767 |     except Exception as e:
    |            ^^^^^^^^^
768 |         print(f"[post] skipping HIST energy: {e}")
    |

S110 `try`-`except`-`pass` detected, consider logging the exception
  --> adept/osiris/plots.py:95:5
   |
93 |           w_in *= float(pos.width)
94 |           h_in *= float(pos.height)
95 | /     except Exception:
96 | |         pass
   | |____________^
97 |       fr_rows = max(float(visible_frac[0]), 1e-3)
98 |       fr_cols = max(float(visible_frac[1]), 1e-3)
   |

BLE001 Do not catch blind exception: `Exception`
  --> adept/osiris/plots.py:95:12
   |
93 |         w_in *= float(pos.width)
94 |         h_in *= float(pos.height)
95 |     except Exception:
   |            ^^^^^^^^^
96 |         pass
97 |     fr_rows = max(float(visible_frac[0]), 1e-3)
   |

BLE001 Do not catch blind exception: `Exception`
   --> adept/osiris/plots.py:445:16
    |
443 |         try:
444 |             ser = _io.load_series(diags[rel])
445 |         except Exception as e:  # a bad component must not sink the rest
    |                ^^^^^^^^^
446 |             print(f"[plots] skipping field-energy component {comp}: {e}")
447 |             continue
    |

BLE001 Do not catch blind exception: `Exception`
   --> adept/osiris/plots.py:659:12
    |
657 |     try:
658 |         sections = _deck.parse_deck_file(deck_path)
659 |     except Exception as e:
    |            ^^^^^^^^^
660 |         print(f"[plots] ion_acoustic: could not parse {deck_path}: {e}")
661 |         return []
    |

BLE001 Do not catch blind exception: `Exception`
   --> adept/osiris/plots.py:991:20
    |
989 |             try:
990 |                 ser = _io.load_series(diags[rel])
991 |             except Exception as e:  # skip a bad component
    |                    ^^^^^^^^^
992 |                 print(f"[plots] skipping current {comp}: {e}")
993 |                 continue
    |

PERF102 When using only the values of a dict use the `values()` method
    --> adept/osiris/plots.py:1029:22
     |
1027 |         return None
1028 |     fig, ax = plt.subplots(figsize=(6, 4))
1029 |     for comp, ser in comps.items():
     |                      ^^^^^^^^^^^
1030 |         da = _decorate(ser)
1031 |         xdim = next(d for d in da.dims if d != "t")
     |
help: Replace `.items()` with `.values()`
     |
1028 |     fig, ax = plt.subplots(figsize=(6, 4))
     -     for comp, ser in comps.items():
1029 +     for ser in comps.values():
1030 |         da = _decorate(ser)
     |
note: This is an unsafe fix and may change runtime behavior

BLE001 Do not catch blind exception: `Exception`
    --> adept/osiris/plots.py:1545:16
     |
1543 |         try:
1544 |             ser = _io.load_series(diag_path)
1545 |         except Exception as e:
     |                ^^^^^^^^^
1546 |             print(f"[plots] skipping series {diag_rel}: {e}")
1547 |             continue
     |

BLE001 Do not catch blind exception: `Exception`
    --> adept/osiris/plots.py:1579:16
     |
1577 |                 f"omega_k/{comp}.png",
1578 |             )
1579 |         except Exception as e:
     |                ^^^^^^^^^
1580 |             print(f"[plots] skipping field plots for {diag_rel}: {e}")
     |

BLE001 Do not catch blind exception: `Exception`
    --> adept/osiris/plots.py:1590:12
     |
1588 |         if fig is not None:
1589 |             written["currents/lineouts"] = _write(fig, "currents/lineouts.png")
1590 |     except Exception as e:
     |            ^^^^^^^^^
1591 |         print(f"[plots] skipping currents: {e}")
     |

BLE001 Do not catch blind exception: `Exception`
    --> adept/osiris/plots.py:1603:16
     |
1601 |         try:
1602 |             ser = _io.load_series(diag_path)
1603 |         except Exception as e:
     |                ^^^^^^^^^
1604 |             print(f"[plots] skipping moment {diag_rel}: {e}")
1605 |             continue
     |

BLE001 Do not catch blind exception: `Exception`
    --> adept/osiris/plots.py:1622:16
     |
1620 |                 f"moments/{species}/lineouts/{quantity}.png",
1621 |             )
1622 |         except Exception as e:
     |                ^^^^^^^^^
1623 |             print(f"[plots] skipping moment plots for {diag_rel}: {e}")
     |

BLE001 Do not catch blind exception: `Exception`
    --> adept/osiris/plots.py:1639:16
     |
1637 |                 )
1638 |                 written[f"profiles/{species}/density"] = _write(fig, f"profiles/{species}/density.png")
1639 |         except Exception as e:
     |                ^^^^^^^^^
1640 |             print(f"[plots] skipping density profile for {species}: {e}")
1641 |         try:
     |

BLE001 Do not catch blind exception: `Exception`
    --> adept/osiris/plots.py:1668:16
     |
1666 |                 )
1667 |                 written[f"profiles/{species}/temperature"] = _write(fig, f"profiles/{species}/temperature.png")
1668 |         except Exception as e:
     |                ^^^^^^^^^
1669 |             print(f"[plots] skipping temperature profile for {species}: {e}")
     |

BLE001 Do not catch blind exception: `Exception`
    --> adept/osiris/plots.py:1689:16
     |
1687 |                 continue
1688 |             ser = _io.load_series(diag_path, t_indices=_evolution_t_indices(n_t, n_panels))
1689 |         except Exception as e:
     |                ^^^^^^^^^
1690 |             print(f"[plots] skipping phasespace {diag_rel}: {e}")
1691 |             continue
     |

BLE001 Do not catch blind exception: `Exception`
    --> adept/osiris/plots.py:1707:16
     |
1705 |                     f"phasespace_evolution/{species}/{ps_name}.png",
1706 |                 )
1707 |         except Exception as e:
     |                ^^^^^^^^^
1708 |             print(f"[plots] skipping phasespace evolution {diag_rel}: {e}")
     |

BLE001 Do not catch blind exception: `Exception`
    --> adept/osiris/plots.py:1714:12
     |
1712 |         for comp, fig in plot_field_lr_decomposition(run_dir).items():
1713 |             written[f"field_decomp/{comp}"] = _write(fig, f"field_decomp/{comp}.png")
1714 |     except Exception as e:
     |            ^^^^^^^^^
1715 |         print(f"[plots] skipping field decomposition: {e}")
     |

BLE001 Do not catch blind exception: `Exception`
    --> adept/osiris/plots.py:1745:12
     |
1743 |             plot_energy_conservation(energy, ax=ax)
1744 |             written["total_energy_vs_time"] = _write(fig, "total_energy_vs_time.png")
1745 |     except Exception as e:
     |            ^^^^^^^^^
1746 |         print(f"[plots] skipping total_energy_vs_time: {e}")
     |

BLE001 Do not catch blind exception: `Exception`
    --> adept/osiris/plots.py:1754:12
     |
1752 |             plot_energy_partition(energy, ax=ax)
1753 |             written["energy_partition_vs_time"] = _write(fig, "energy_partition_vs_time.png")
1754 |     except Exception as e:
     |            ^^^^^^^^^
1755 |         print(f"[plots] skipping energy_partition_vs_time: {e}")
     |

SIM118 Use `key in dict` instead of `key in dict.keys()`
  --> adept/osiris/post.py:71:32
   |
69 |         name = h5_path.stem.rsplit("-", 1)[0]
70 |         if name 

@github-actions
github-actions Bot force-pushed the _bot/update-precommit branch 2 times, most recently from 2d853f4 to 5eb4e41 Compare August 10, 2026 00:11
@github-actions
github-actions Bot force-pushed the _bot/update-precommit branch from 5eb4e41 to 90e1ea8 Compare August 17, 2026 00:06
@github-actions
github-actions Bot force-pushed the _bot/update-precommit branch from 90e1ea8 to 130bdfc Compare August 24, 2026 00:07
@github-actions
github-actions Bot force-pushed the _bot/update-precommit branch 2 times, most recently from e9890f4 to 57d72e5 Compare September 7, 2026 00:14
@github-actions
github-actions Bot force-pushed the _bot/update-precommit branch 2 times, most recently from d1bf494 to dd56424 Compare September 21, 2026 00:14
@github-actions
github-actions Bot force-pushed the _bot/update-precommit branch 2 times, most recently from d56ae6b to 0894f5c Compare October 5, 2026 00:14
@github-actions
github-actions Bot force-pushed the _bot/update-precommit branch 2 times, most recently from d58750c to 3a11bca Compare October 19, 2026 00:13
@github-actions
github-actions Bot force-pushed the _bot/update-precommit branch from 3a11bca to 9875ebc Compare October 26, 2026 00:13

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant