From bc11ce95128f0674b303647dc9655722aec4b00b Mon Sep 17 00:00:00 2001 From: Alec Edgington Date: Thu, 27 Jun 2024 13:36:45 +0100 Subject: [PATCH] Cast to Qubit for type checking. --- pytket/extensions/pyquil/pyquil_convert.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pytket/extensions/pyquil/pyquil_convert.py b/pytket/extensions/pyquil/pyquil_convert.py index 9e55e0f..334d686 100644 --- a/pytket/extensions/pyquil/pyquil_convert.py +++ b/pytket/extensions/pyquil/pyquil_convert.py @@ -183,11 +183,11 @@ def pyquil_to_tk(prog: Program) -> Circuit: raise NotImplementedError( "Operation not supported by tket: " + str(i) ) from error - qubits = [qmap[q.index] for q in i.qubits] + qubits = [qmap[cast(Qubit_, q).index] for q in i.qubits] params: list[Union[Expr, float]] = [param_from_pyquil(p) for p in i.params] # type: ignore tkc.add_gate(optype, params, qubits) elif isinstance(i, Measurement): - qubit = qmap[i.qubit.index] + qubit = qmap[cast(Qubit_, i.qubit).index] reg = cregmap[i.classical_reg.name] # type: ignore bit = reg[i.classical_reg.offset] # type: ignore tkc.Measure(qubit, bit)