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

Apply new deprecation decorators to dagcircuit folder #9874

Merged
merged 5 commits into from
May 10, 2023
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
8 changes: 3 additions & 5 deletions qiskit/dagcircuit/dagcircuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
from qiskit.circuit.parameterexpression import ParameterExpression
from qiskit.dagcircuit.exceptions import DAGCircuitError
from qiskit.dagcircuit.dagnode import DAGNode, DAGOpNode, DAGInNode, DAGOutNode
from qiskit.utils.deprecation import deprecate_function
from qiskit.utils.deprecation import deprecate_func


class DAGCircuit:
Expand Down Expand Up @@ -526,10 +526,8 @@ def _add_op_node(self, op, qargs, cargs):
self._increment_op(op)
return node_index

@deprecate_function(
"The DAGCircuit._copy_circuit_metadata method is deprecated as of 0.20.0. It will be "
"removed no earlier than 3 months after the release date. You should use the "
"DAGCircuit.copy_empty_like method instead, which acts identically.",
@deprecate_func(
additional_msg="Instead, use :meth:`~copy_empty_like()`, which acts identically.",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it work with ()?

Suggested change
additional_msg="Instead, use :meth:`~copy_empty_like()`, which acts identically.",
additional_msg="Instead, use :meth:`~copy_empty_like`, which acts identically.",

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://www.sphinx-doc.org/en/master/usage/restructuredtext/domains.html#role-py-func

The role text needs not include trailing parentheses to enhance readability; they will be added automatically by Sphinx if the add_function_parentheses config value is True (the default).

since="0.20.0",
)
def _copy_circuit_metadata(self):
Expand Down
1 change: 0 additions & 1 deletion qiskit/dagcircuit/dagnode.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ def semantic_eq(node1, node2, bit_indices1=None, bit_indices2=None):
"release will require the mappings to be provided as arguments.",
DeprecationWarning,
)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, didn't mean to do this. Doesn't seem worth a CI burn though - this code path will be deleted soon (deprecation is from 0.20)

bit_indices1 = {arg: arg for arg in node1.qargs + node1.cargs}
bit_indices2 = {arg: arg for arg in node2.qargs + node2.cargs}

Expand Down