diff --git a/qiskit/synthesis/one_qubit/one_qubit_decompose.py b/qiskit/synthesis/one_qubit/one_qubit_decompose.py index 5ca44d43d5b4..c84db761b7f0 100644 --- a/qiskit/synthesis/one_qubit/one_qubit_decompose.py +++ b/qiskit/synthesis/one_qubit/one_qubit_decompose.py @@ -14,6 +14,7 @@ Decompose a single-qubit unitary via Euler angles. """ from __future__ import annotations +from typing import TYPE_CHECKING import numpy as np from qiskit._accelerate import euler_one_qubit_decomposer @@ -37,6 +38,9 @@ from qiskit.circuit.gate import Gate from qiskit.quantum_info.operators.operator import Operator +if TYPE_CHECKING: + from qiskit.dagcircuit import DAGCircuit + DEFAULT_ATOL = 1e-12 ONE_QUBIT_EULER_BASIS_GATES = { @@ -150,7 +154,7 @@ def __init__(self, basis: str = "U3", use_dag: bool = False): self.basis = basis # sets: self._basis, self._params, self._circuit self.use_dag = use_dag - def build_circuit(self, gates, global_phase): + def build_circuit(self, gates, global_phase) -> QuantumCircuit | DAGCircuit: """Return the circuit or dag object from a list of gates.""" qr = [Qubit()] lookup_gate = False @@ -186,7 +190,7 @@ def __call__( unitary: Operator | Gate | np.ndarray, simplify: bool = True, atol: float = DEFAULT_ATOL, - ) -> QuantumCircuit: + ) -> QuantumCircuit | DAGCircuit: """Decompose single qubit gate into a circuit. Args: