From 3fde760e622e5821a5f74c1690857ec15f552b80 Mon Sep 17 00:00:00 2001 From: "aikido-autofix[bot]" <119856028+aikido-autofix[bot]@users.noreply.github.com> Date: Sun, 10 May 2026 18:24:36 +0000 Subject: [PATCH] fix(security): autofix Dangerous use of assert --- src/pulseopt/scheduler.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pulseopt/scheduler.py b/src/pulseopt/scheduler.py index bbe3ce9..eabf60f 100644 --- a/src/pulseopt/scheduler.py +++ b/src/pulseopt/scheduler.py @@ -191,7 +191,8 @@ def step_end(self, loss: float | Tensor) -> None: if not self._step_started: raise RuntimeError("step_end() called without a preceding step_start().") candidate = self._current_candidate - assert candidate is not None + if candidate is None: + raise AssertionError float_loss = float(loss.item()) if isinstance(loss, Tensor) else float(loss) if not math.isfinite(float_loss):