Skip to content

Commit

Permalink
Use _ consistently for unused variables
Browse files Browse the repository at this point in the history
  • Loading branch information
pavoljuhas committed Nov 4, 2024
1 parent e4a635d commit d470f10
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion unitary/quantum_chess/mcpe_utils_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def test_effect_of_swap():


def test_distance_fn():
a1, a2, a3, _b1, b2, _b3 = cirq.GridQubit.rect(2, 3)
a1, a2, a3, _, b2, _ = cirq.GridQubit.rect(2, 3)

# A gate operating on (a1, a3) will be improved by swapping a1 and a2, but
# by how much depends on the distance function used.
Expand Down
8 changes: 4 additions & 4 deletions unitary/quantum_chess/swap_updater_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def test_pentagonal_split_and_merge():
cirq.NamedQubit(f"{x}{i}") for x in ("a", "b") for i in range(3)
)
initial_mapping = dict(zip(logical_qubits, grid_2x3))
a1, a2, a3, b1, _b2, b3 = logical_qubits
a1, a2, a3, b1, _, b3 = logical_qubits
logical_circuit = cirq.Circuit(
qm.normal_move(a1, b1), qm.normal_move(a2, a3), qm.merge_move(a3, b1, b3)
)
Expand Down Expand Up @@ -182,7 +182,7 @@ def test_holes_in_device_graph():
cirq.NamedQubit(f"{x}{i}") for x in ("a", "b") for i in range(3)
)
initial_mapping = dict(zip(logical_qubits, grid_2x3))
_a1, _a2, _a3, b1, b2, b3 = logical_qubits
_, _, _, b1, b2, b3 = logical_qubits
# Circuit has a gate that operate on (b1, b3) qubits.
# The best way to add swaps would be between (b1, b2) and (b2, b3), but
# we aren't allowed to use b2, so we're forced to route swaps around it.
Expand All @@ -203,7 +203,7 @@ def test_bad_initial_mapping():
cirq.NamedQubit(f"{x}{i}") for x in ("a", "b") for i in range(3)
)
initial_mapping = dict(zip(logical_qubits, grid_2x3))
a1, _a2, a3, _b1, _b2, _b3 = logical_qubits
a1, _, a3, _, _, _ = logical_qubits
# Initial mapping puts a1 on a qubit that we're not allowed to use, but the
# circuit uses a1.
# That should cause the swap updater to throw.
Expand All @@ -223,7 +223,7 @@ def test_disconnected_components():
cirq.NamedQubit(f"{x}{i}") for x in ("a", "b") for i in range(3)
)
initial_mapping = dict(zip(logical_qubits, grid_2x3))
a1, a2, a3, _b1, b2, _b3 = logical_qubits
a1, a2, a3, _, b2, _ = logical_qubits
# a2 and b2 are disallowed. That splits the device graph into 2 disconnected
# components and makes a3 unreachable from a1.
circuit = cirq.Circuit(cirq.ISWAP(a1, a3))
Expand Down

0 comments on commit d470f10

Please sign in to comment.