Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove DagDepNode.condition (deprecated in #6110) #9406

Merged
merged 10 commits into from
Feb 6, 2023
48 changes: 2 additions & 46 deletions qiskit/dagcircuit/dagdepnode.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@

"""Object to represent the information at a node in the DAGCircuit."""

import warnings

from qiskit.exceptions import QiskitError


Expand Down Expand Up @@ -51,7 +49,6 @@ def __init__(
name=None,
qargs=(),
cargs=(),
condition=None,
successors=None,
predecessors=None,
reachable=None,
Expand All @@ -68,15 +65,6 @@ def __init__(
self.name = name
self._qargs = tuple(qargs) if qargs is not None else ()
self.cargs = tuple(cargs) if cargs is not None else ()
if condition:
warnings.warn(
"The DAGDepNode 'condition' kwarg and 'condition' attribute are deprecated "
"as of 0.18.0 and will be removed no earlier than 3 months after the "
"release date. You can use 'DAGDepNode.op.condition' if the DAGDepNode "
"is of type 'op'.",
DeprecationWarning,
2,
)
self.node_id = nid
self.sort_key = str(self._qargs)
self.successors = successors if successors is not None else []
Expand All @@ -99,34 +87,6 @@ def op(self):
def op(self, data):
self._op = data

@property
def condition(self):
"""Returns the condition of the node.op"""
if not self.type or self.type != "op":
raise QiskitError("The node %s is not an op node" % (str(self)))
warnings.warn(
"The DAGDepNode 'condition' attribute is deprecated as of 0.18.0 and "
"will be removed no earlier than 3 months after the release date. "
"You can use 'DAGDepNode.op.condition' if the DAGDepNode is of type 'op'.",
DeprecationWarning,
2,
)
return getattr(self._op, "condition", None)

@condition.setter
def condition(self, new_condition):
"""Sets the node.condition which sets the node.op.condition."""
if not self.type or self.type != "op":
raise QiskitError("The node %s is not an op node" % (str(self)))
warnings.warn(
"The DAGDepNode 'condition' attribute is deprecated as of 0.18.0 and "
"will be removed no earlier than 3 months after the release date. "
"You can use 'DAGDepNode.op.condition' if the DAGDepNode is of type 'op'.",
DeprecationWarning,
2,
)
self._op.condition = new_condition

@property
def qargs(self):
"""
Expand Down Expand Up @@ -161,12 +121,8 @@ def semantic_eq(node1, node2):
if node1.name == node2.name:
if node1._qargs == node2._qargs:
if node1.cargs == node2.cargs:
if node1.type == "op":
if getattr(node1._op, "condition", None) != getattr(
node2._op, "condition", None
):
return False
return True
if node1._op.condition == node2._op.condition:
return True
1ucian0 marked this conversation as resolved.
Show resolved Hide resolved
return False

def copy(self):
Expand Down
4 changes: 4 additions & 0 deletions releasenotes/notes/6110-709f6fa891bdb26b.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
upgrade:
- |
For the class :class:`~DagDepNode`, thew previously deprecated ``condition`` attribute have been removed. It was deprecated in 0.18 release.
1ucian0 marked this conversation as resolved.
Show resolved Hide resolved