From 379dd09e7116785e029d9657e82d5c6e33f58651 Mon Sep 17 00:00:00 2001 From: mhucka <1450019+mhucka@users.noreply.github.com> Date: Fri, 27 Mar 2026 04:55:14 +0000 Subject: [PATCH] Clean up pragmas and dead code in bksf.py - Remove reachable # coverage: ignore and # pragma: no cover directives. - Remove associated TODO comments. - Remove unreachable dead code blocks to improve maintainability. --- src/openfermion/transforms/opconversions/bksf.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/openfermion/transforms/opconversions/bksf.py b/src/openfermion/transforms/opconversions/bksf.py index 35d4ecce6..bf7c8fe58 100644 --- a/src/openfermion/transforms/opconversions/bksf.py +++ b/src/openfermion/transforms/opconversions/bksf.py @@ -110,7 +110,6 @@ def bravyi_kitaev_fast_interaction_op(iop: InteractionOperator) -> QubitOperator # Skip zero terms. if (not coefficient) or (p == q) or (r == s): - # coverage: ignore continue # Identify and skip one of the complex conjugates. @@ -124,9 +123,6 @@ def bravyi_kitaev_fast_interaction_op(iop: InteractionOperator) -> QubitOperator transformed_term *= 0.5 * coefficient qubit_operator += transformed_term continue - elif p != r and q < p: - # TODO: remove pragma if reachable continue - continue # pragma: no cover # Handle the two-body terms. transformed_term = _two_body(edge_matrix_indices, p, q, r, s) @@ -169,16 +165,13 @@ def bravyi_kitaev_fast_edge_matrix( # Skip zero terms. if (not coefficient2) or (p == q) or (r == s): - # TODO: remove pragma if this is a reachable continue - continue # pragma: no cover + continue # Identify and skip one of the complex conjugates. if [p, q, r, s] != [s, r, q, p]: if len(set([p, q, r, s])) == 4: if min(r, s) < min(p, q): continue - elif p != r and q < p: - continue # Handle case of four unique indices. if len(set([p, q, r, s])) == 4: