-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reinstate and deprecate loose measure and reset functions (#7376)
Previously, the `QuantumCircuit` methods `.measure` and `.reset` were defined as regular functions in `circuit/measure.py` (m.m. `reset`) and monkey-patched onto `QuantumCircuit`. Commit 2cd42b4 removed the monkey-patching by defining them as regular methods, but did not implement a deprecation period for the functions. This reinstates them, with the deprecation warning.
- Loading branch information
1 parent
a34644f
commit 89b324c
Showing
4 changed files
with
114 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
releasenotes/notes/reinstate-deprecate-loose-measure-reset-11591e35d350aaeb.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
deprecations: | ||
- | | ||
The loose functions ``qiskit.circuit.measure.measure()`` and | ||
``qiskit.circuit.reset.reset()`` are deprecated, and will be removed in a | ||
future release. Instead, you should access these as methods on | ||
:class:`.QuantumCircuit`:: | ||
from qiskit import QuantumCircuit | ||
circuit = QuantumCircuit(1, 1) | ||
# Replace this deprecated form ... | ||
from qiskit.circuit.measure import measure | ||
measure(circuit, 0, 0) | ||
# ... with either of the next two lines: | ||
circuit.measure(0, 0) | ||
QuantumCircuit.measure(circuit, 0, 0) | ||
fixes: | ||
- | | ||
Two loose functions ``qiskit.circuit.measure.measure()`` and | ||
``qiskit.circuit.reset.reset()`` were accidentally removed without a | ||
deprecation period. They have been reinstated, but are marked as deprecated | ||
in favour of the methods :meth:`.QuantumCircuit.measure` and | ||
:meth:`.QuantumCircuit.reset`, respectively, and will be removed in a future | ||
release. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters