Skip to content

Commit

Permalink
Improve public type annotations for OneQubitEulerDecomposer
Browse files Browse the repository at this point in the history
  • Loading branch information
garrison committed Jun 7, 2024
1 parent 72f09ad commit 3faef4c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions qiskit/synthesis/one_qubit/one_qubit_decompose.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 = {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 3faef4c

Please sign in to comment.