Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions qiskit/dagcircuit/dagcircuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import copy
import itertools
import math
from typing import Generator, Any, List

import numpy as np
import rustworkx as rx
Expand Down Expand Up @@ -84,8 +85,8 @@ def __init__(self):
self.cregs = OrderedDict()

# List of Qubit/Clbit wires that the DAG acts on.
self.qubits = []
self.clbits = []
self.qubits: List[Qubit] = []
self.clbits: List[Clbit] = []

self._global_phase = 0
self._calibrations = defaultdict(dict)
Expand Down Expand Up @@ -1051,7 +1052,7 @@ def _key(x):

return iter(rx.lexicographical_topological_sort(self._multi_graph, key=key))

def topological_op_nodes(self, key=None):
def topological_op_nodes(self, key=None) -> Generator[DAGOpNode, Any, Any]:
"""
Yield op nodes in topological order.

Expand Down
5 changes: 3 additions & 2 deletions qiskit/dagcircuit/dagnode.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
"""Objects to represent the information at a node in the DAGCircuit."""

import warnings
from typing import Iterable

from qiskit.circuit import Clbit
from qiskit.circuit import Qubit, Clbit


def _condition_as_indices(operation, bit_indices):
Expand Down Expand Up @@ -110,7 +111,7 @@ class DAGOpNode(DAGNode):

__slots__ = ["op", "qargs", "cargs", "sort_key"]

def __init__(self, op, qargs=(), cargs=()):
def __init__(self, op, qargs: Iterable[Qubit] = (), cargs: Iterable[Clbit] = ()):
"""Create an Instruction node"""
super().__init__()
self.op = op
Expand Down