From fe2ff647e65d592be187ae4f88d9de8153404fda Mon Sep 17 00:00:00 2001 From: Jake Lishman Date: Thu, 1 Feb 2024 20:03:38 +0000 Subject: [PATCH 1/7] Effect final removals from Qiskit 1.0 This is a roll-up of a bunch of extant deprecation warnings that were spotted in the 1.0 branch just before its release. All of these are trivial removals. There remain one or two pending deprecations, but it's too late to do anything about those. There are also a couple of deprecations in the older timeline drawer for features that are still used in documentation, so I've just left in place. --- qiskit/circuit/qpy_serialization.py | 28 ------------ qiskit/circuit/quantumcircuit.py | 12 +---- qiskit/circuit/quantumregister.py | 15 ------- qiskit/circuit/register.py | 20 --------- qiskit/quantum_info/operators/measures.py | 12 ++--- .../two_qubit/two_qubit_decompose.py | 2 - qiskit/transpiler/passes/__init__.py | 4 +- .../passes/scheduling/calibration_creators.py | 27 ----------- .../passes/scheduling/rzx_templates.py | 28 ------------ .../transpiler/passes/synthesis/__init__.py | 2 +- .../synthesis/linear_functions_synthesis.py | 22 --------- qiskit/visualization/pulse_v2/stylesheet.py | 12 +---- qiskit/visualization/timeline/stylesheet.py | 12 +---- .../rollup-removals-ce8326ea90c0ad99.yaml | 41 +++++++++++++++++ .../test_linear_functions_passes.py | 45 +------------------ 15 files changed, 53 insertions(+), 229 deletions(-) delete mode 100644 qiskit/circuit/qpy_serialization.py delete mode 100644 qiskit/transpiler/passes/scheduling/calibration_creators.py delete mode 100644 qiskit/transpiler/passes/scheduling/rzx_templates.py create mode 100644 releasenotes/notes/rollup-removals-ce8326ea90c0ad99.yaml diff --git a/qiskit/circuit/qpy_serialization.py b/qiskit/circuit/qpy_serialization.py deleted file mode 100644 index 400f29a513b6..000000000000 --- a/qiskit/circuit/qpy_serialization.py +++ /dev/null @@ -1,28 +0,0 @@ -# This code is part of Qiskit. -# -# (C) Copyright IBM 2021. -# -# This code is licensed under the Apache License, Version 2.0. You may -# obtain a copy of this license in the LICENSE.txt file in the root directory -# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. -# -# Any modifications or derivative works of this code must retain this -# copyright notice, and modified files need to carry a notice indicating -# that they have been altered from the originals. - -"""Alias for Qiskit QPY import.""" - - -def __getattr__(name): - import warnings - from qiskit import qpy - - # Skip warning on special Python dunders, which Python occasionally queries on its own accord. - if f"__{name[2:-2]}__" != name: - warnings.warn( - f"Module '{__name__}' is deprecated since Qiskit Terra 0.23," - " and will be removed in a future release. Please import from 'qiskit.qpy' instead.", - category=DeprecationWarning, - stacklevel=2, - ) - return getattr(qpy, name) diff --git a/qiskit/circuit/quantumcircuit.py b/qiskit/circuit/quantumcircuit.py index 83c80e80aa1d..d1c7d77f5140 100644 --- a/qiskit/circuit/quantumcircuit.py +++ b/qiskit/circuit/quantumcircuit.py @@ -468,17 +468,9 @@ def metadata(self) -> dict: return self._metadata @metadata.setter - def metadata(self, metadata: dict | None): + def metadata(self, metadata: dict): """Update the circuit metadata""" - if metadata is None: - metadata = {} - warnings.warn( - "Setting metadata to None was deprecated in Terra 0.24.0 and this ability will be " - "removed in a future release. Instead, set metadata to an empty dictionary.", - DeprecationWarning, - stacklevel=2, - ) - elif not isinstance(metadata, dict): + if not isinstance(metadata, dict): raise TypeError("Only a dictionary is accepted for circuit metadata") self._metadata = metadata diff --git a/qiskit/circuit/quantumregister.py b/qiskit/circuit/quantumregister.py index 67fe26b1b224..2ae815b1d172 100644 --- a/qiskit/circuit/quantumregister.py +++ b/qiskit/circuit/quantumregister.py @@ -19,8 +19,6 @@ from qiskit.circuit.exceptions import CircuitError -# Over-specific import to avoid cyclic imports. -from qiskit.utils.deprecation import deprecate_func from .register import Register from .bit import Bit @@ -58,19 +56,6 @@ class QuantumRegister(Register): prefix = "q" bit_type = Qubit - @deprecate_func( - additional_msg=( - "Correct exporting to OpenQASM 2 is the responsibility of a larger exporter; it cannot " - "safely be done on an object-by-object basis without context. No replacement will be " - "provided, because the premise is wrong." - ), - since="0.23.0", - package_name="qiskit-terra", - ) - def qasm(self): - """Return OPENQASM string for this register.""" - return "qreg %s[%d];" % (self.name, self.size) - class AncillaQubit(Qubit): """A qubit used as ancillary qubit.""" diff --git a/qiskit/circuit/register.py b/qiskit/circuit/register.py index 361f4ce2699b..58a12c07f861 100644 --- a/qiskit/circuit/register.py +++ b/qiskit/circuit/register.py @@ -19,26 +19,11 @@ from __future__ import annotations import re import itertools -import warnings import numpy as np from qiskit.circuit.exceptions import CircuitError -class _NameFormat: - REGEX = re.compile("[a-z][a-zA-Z0-9_]*") - - def __get__(self, obj, objtype=None): - warnings.warn( - "Register.name_format is deprecated as of Qiskit Terra 0.23, and will be removed in a" - " future release. There is no longer a restriction on the names of registers, so the" - " attribute has no meaning any more.", - DeprecationWarning, - stacklevel=2, - ) - return self.REGEX - - class Register: """Implement a generic register. @@ -50,11 +35,6 @@ class Register: __slots__ = ["_name", "_size", "_bits", "_bit_indices", "_hash", "_repr"] - # In historical version of Terra, registers' name had to conform to the OpenQASM 2 specification - # (see appendix A of https://arxiv.org/pdf/1707.03429v2.pdf), and this regex enforced it. That - # restriction has been relaxed, so this is no longer necessary. - name_format = _NameFormat() - # Counter for the number of instances in this class. instances_counter = itertools.count() # Prefix to use for auto naming. diff --git a/qiskit/quantum_info/operators/measures.py b/qiskit/quantum_info/operators/measures.py index b9fd7fadea0d..cb340bad9d02 100644 --- a/qiskit/quantum_info/operators/measures.py +++ b/qiskit/quantum_info/operators/measures.py @@ -388,16 +388,10 @@ def _input_formatter(obj, fallback_class, func_name, arg_name): return Operator(obj) if hasattr(obj, "to_operator"): return obj.to_operator() - - warnings.warn( - "Passing in a list or Numpy array to `{}` `{}` argument is " - "deprecated as of 0.17.0 since the matrix representation cannot be inferred " - "unambiguously. Use a Gate or BaseOperator subclass (eg. Operator, " - "SuperOp, Choi) object instead.".format(func_name, arg_name), - DeprecationWarning, + raise TypeError( + f"invalid type supplied to {arg_name} of {func_name}." + f" A {fallback_class.__name__} is best." ) - warnings.warn(f"Treating array input as a {fallback_class.__name__} object") - return fallback_class(obj) def _cp_condition(channel): diff --git a/qiskit/synthesis/two_qubit/two_qubit_decompose.py b/qiskit/synthesis/two_qubit/two_qubit_decompose.py index 9de76541de54..297ca7322c00 100644 --- a/qiskit/synthesis/two_qubit/two_qubit_decompose.py +++ b/qiskit/synthesis/two_qubit/two_qubit_decompose.py @@ -44,7 +44,6 @@ OneQubitEulerDecomposer, DEFAULT_ATOL, ) -from qiskit.utils.deprecation import deprecate_arg from qiskit._accelerate import two_qubit_decompose logger = logging.getLogger(__name__) @@ -1086,7 +1085,6 @@ def decomp3_supercontrolled(self, target): return U3r, U3l, U2r, U2l, U1r, U1l, U0r, U0l - @deprecate_arg("target", new_alias="unitary", since="0.23.0", package_name="qiskit-terra") def __call__( self, unitary: Operator | np.ndarray, diff --git a/qiskit/transpiler/passes/__init__.py b/qiskit/transpiler/passes/__init__.py index d6451bdb7973..c04ad2bda698 100644 --- a/qiskit/transpiler/passes/__init__.py +++ b/qiskit/transpiler/passes/__init__.py @@ -100,6 +100,8 @@ RZXCalibrationBuilderNoEcho RXCalibrationBuilder +.. autofunction:: rzx_templates + Scheduling ============= @@ -248,7 +250,6 @@ # synthesis from .synthesis import UnitarySynthesis from .synthesis import unitary_synthesis_plugin_names -from .synthesis import LinearFunctionsSynthesis from .synthesis import LinearFunctionsToPermutations from .synthesis import HighLevelSynthesis from .synthesis import HLSConfig @@ -261,6 +262,7 @@ from .calibration import RZXCalibrationBuilder from .calibration import RZXCalibrationBuilderNoEcho from .calibration import RXCalibrationBuilder +from .calibration.rzx_templates import rzx_templates # circuit scheduling from .scheduling import TimeUnitConversion diff --git a/qiskit/transpiler/passes/scheduling/calibration_creators.py b/qiskit/transpiler/passes/scheduling/calibration_creators.py deleted file mode 100644 index d9c2762b45c2..000000000000 --- a/qiskit/transpiler/passes/scheduling/calibration_creators.py +++ /dev/null @@ -1,27 +0,0 @@ -# This code is part of Qiskit. -# -# (C) Copyright IBM 2021. -# -# This code is licensed under the Apache License, Version 2.0. You may -# obtain a copy of this license in the LICENSE.txt file in the root directory -# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. -# -# Any modifications or derivative works of this code must retain this -# copyright notice, and modified files need to carry a notice indicating -# that they have been altered from the originals. - -# pylint: disable=unused-import - -"""Calibration creators.""" - -import warnings -from qiskit.transpiler.passes.calibration import RZXCalibrationBuilder, RZXCalibrationBuilderNoEcho - -# TODO remove this import after sufficient deprecation period - -warnings.warn( - "RZXCalibrationBuilder and RZXCalibrationBuilderNoEcho passes are moved to " - "`qiskit.transpiler.passes.calibration.builders`. " - "This import path is being deprecated.", - DeprecationWarning, -) diff --git a/qiskit/transpiler/passes/scheduling/rzx_templates.py b/qiskit/transpiler/passes/scheduling/rzx_templates.py deleted file mode 100644 index 540d998b3b91..000000000000 --- a/qiskit/transpiler/passes/scheduling/rzx_templates.py +++ /dev/null @@ -1,28 +0,0 @@ -# This code is part of Qiskit. -# -# (C) Copyright IBM 2021. -# -# This code is licensed under the Apache License, Version 2.0. You may -# obtain a copy of this license in the LICENSE.txt file in the root directory -# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. -# -# Any modifications or derivative works of this code must retain this -# copyright notice, and modified files need to carry a notice indicating -# that they have been altered from the originals. - -# pylint: disable=unused-import - -""" -Convenience function to load RZXGate based templates. -""" - -import warnings -from qiskit.transpiler.passes.calibration.rzx_templates import rzx_templates - -# TODO remove this import after sufficient deprecation period - -warnings.warn( - "rzx_templates function is moved to `qiskit.transpiler.passes.calibration.rzx_templates`. " - "This import path is being deprecated.", - DeprecationWarning, -) diff --git a/qiskit/transpiler/passes/synthesis/__init__.py b/qiskit/transpiler/passes/synthesis/__init__.py index 117dad019dd2..2e8e8c17d809 100644 --- a/qiskit/transpiler/passes/synthesis/__init__.py +++ b/qiskit/transpiler/passes/synthesis/__init__.py @@ -14,7 +14,7 @@ from .unitary_synthesis import UnitarySynthesis from .plugin import high_level_synthesis_plugin_names, unitary_synthesis_plugin_names -from .linear_functions_synthesis import LinearFunctionsSynthesis, LinearFunctionsToPermutations +from .linear_functions_synthesis import LinearFunctionsToPermutations from .high_level_synthesis import HighLevelSynthesis, HLSConfig from .solovay_kitaev_synthesis import SolovayKitaev, SolovayKitaevSynthesis from .aqc_plugin import AQCSynthesisPlugin diff --git a/qiskit/transpiler/passes/synthesis/linear_functions_synthesis.py b/qiskit/transpiler/passes/synthesis/linear_functions_synthesis.py index eb773a985ddb..b0823346e7b2 100644 --- a/qiskit/transpiler/passes/synthesis/linear_functions_synthesis.py +++ b/qiskit/transpiler/passes/synthesis/linear_functions_synthesis.py @@ -17,28 +17,6 @@ from qiskit.dagcircuit.dagcircuit import DAGCircuit from qiskit.circuit.library import PermutationGate from qiskit.circuit.exceptions import CircuitError -from qiskit.transpiler.passes.synthesis.high_level_synthesis import HighLevelSynthesis, HLSConfig -from qiskit.utils.deprecation import deprecate_func - - -class LinearFunctionsSynthesis(HighLevelSynthesis): - """DEPRECATED: Synthesize linear functions. - - Under the hood, this runs the default high-level synthesis plugin for linear functions. - """ - - @deprecate_func( - additional_msg="Instead, use :class:`~.HighLevelSynthesis`.", - since="0.23.0", - package_name="qiskit-terra", - ) - def __init__(self): - # This config synthesizes only linear functions using the "default" method. - default_linear_config = HLSConfig( - linear_function=[("default", {})], - use_default_on_unspecified=False, - ) - super().__init__(hls_config=default_linear_config) class LinearFunctionsToPermutations(TransformationPass): diff --git a/qiskit/visualization/pulse_v2/stylesheet.py b/qiskit/visualization/pulse_v2/stylesheet.py index 838c82fdd45c..1a37756f4baa 100644 --- a/qiskit/visualization/pulse_v2/stylesheet.py +++ b/qiskit/visualization/pulse_v2/stylesheet.py @@ -31,7 +31,6 @@ the appearance of the output image. """ -import warnings from typing import Dict, Any, Mapping from qiskit.visualization.pulse_v2 import generators, layouts @@ -39,8 +38,6 @@ class QiskitPulseStyle(dict): """Stylesheet for pulse drawer.""" - _deprecated_keys = {} - def __init__(self): super().__init__() # to inform which stylesheet is applied. some plotter may not support specific style. @@ -50,14 +47,7 @@ def __init__(self): def update(self, __m: Mapping[str, Any], **kwargs) -> None: super().update(__m, **kwargs) for key, value in __m.items(): - if key in self._deprecated_keys: - warnings.warn( - f"{key} is deprecated. Use {self._deprecated_keys[key]} instead.", - DeprecationWarning, - ) - self.__setitem__(self._deprecated_keys[key], value) - else: - self.__setitem__(key, value) + self.__setitem__(key, value) self.stylesheet = __m.__class__.__name__ @property diff --git a/qiskit/visualization/timeline/stylesheet.py b/qiskit/visualization/timeline/stylesheet.py index d13564a6b91d..761adf328a35 100644 --- a/qiskit/visualization/timeline/stylesheet.py +++ b/qiskit/visualization/timeline/stylesheet.py @@ -37,7 +37,6 @@ only one layout function can be chosen for each stylesheet. """ -import warnings from typing import Dict, Any, Mapping from qiskit.visualization.timeline import generators, layouts @@ -46,8 +45,6 @@ class QiskitTimelineStyle(dict): """Stylesheet for pulse drawer.""" - _deprecated_keys = {"link_interval_dt": "link_interval_percent"} - def __init__(self): super().__init__() # to inform which stylesheet is applied. some plotter may not support specific style. @@ -57,14 +54,7 @@ def __init__(self): def update(self, __m: Mapping[str, Any], **kwargs) -> None: super().update(__m, **kwargs) for key, value in __m.items(): - if key in self._deprecated_keys: - warnings.warn( - f"{key} is deprecated. Use {self._deprecated_keys[key]} instead.", - DeprecationWarning, - ) - self.__setitem__(self._deprecated_keys[key], value) - else: - self.__setitem__(key, value) + self.__setitem__(key, value) self.stylesheet = __m.__class__.__name__ @property diff --git a/releasenotes/notes/rollup-removals-ce8326ea90c0ad99.yaml b/releasenotes/notes/rollup-removals-ce8326ea90c0ad99.yaml new file mode 100644 index 000000000000..78d5858f1f87 --- /dev/null +++ b/releasenotes/notes/rollup-removals-ce8326ea90c0ad99.yaml @@ -0,0 +1,41 @@ +--- +upgrade: + - | + The ``target`` keyword alias when calling :class:`.TwoQubitBasisDecomposer` instances as + functions has been removed following its deprecation in qiskit-terra 0.23.0. You should + pass the argument positionally as the first argument, or use the new name ``unitary``. + - | + The ``qasm()`` methods of the classes :class:`.QuantumRegister` and :class:`.ClassicalRegister` + have been removed. There is no replacement necessary; these were an internal detail of a + legacy implementation of the OpenQASM 2 exporter. To export a program to OpenQASM 2, use + :func:`.qasm2.dump` or :func:`.qasm2.dumps`. + - | + The specialized transpiler pass :class:`.LinearFunctionsSynthesis` has been removed following + its deprecation in qiskit-terra 0.23.0, since when it has been a very thing wrapper around + :class:`.HighLevelSynthesis`, which you should use instead. + - | + You can no longer set :attr:`.QuantumCircuit.metadata` to be ``None``, following deprecation + in qiskit-terra 0.24.0. Its type is :class:`dict`, so to clear it, set it to ``{}``. + - | + The functions :func:`.process_fidelity`, :func:`.average_gate_fidelity`, :func:`.gate_error` + and :func:`.diamond_norm` will no longer attempt to coerce arbitrary inputs to their marked + expected types, following the deprecation in qiskit-terra 0.17.0. Pass inputs of the marked + types to each argument directly. + - | + The module path ``qiskit.circuit.qpy_serialization`` has been removed, following its + deprecation in qiskit-terra 0.23.0. For QPY serialization, use :mod:`qiskit.qpy`, + which is the new location. + - | + The attribute :attr:`.Register.name_format` has been removed following its deprecation + in qiskit-terra 0.23.0. There is no restriction on register names any more, and the + regular expression there was simply ``[a-z][a-zA-Z0-9_]*``. + - | + The ``link_interval_dt`` key of :class:`.QiskitTimelineStyle` has been removed. + You should use the new name ``link_interval_percent``. + - | + The import path ``qiskit.transpiler.passes.scheduling.calibration_creators`` is removed. + The transpiler passes it housed, :class:`.RZXCalibrationBuilder` and :class:`.RZXCalibrationBuilderNoEcho` + can be imported directly from :mod:`qiskit.transpiler.passes`. + - | + The import path ``qiskit.transpiler.passes.scheduling.rzx_templates`` is removed. You + should import :func:`.rzx_templates` from :mod:`qiskit.transpiler.passes` directly. diff --git a/test/python/transpiler/test_linear_functions_passes.py b/test/python/transpiler/test_linear_functions_passes.py index e91d2942bbd4..1d157c437155 100644 --- a/test/python/transpiler/test_linear_functions_passes.py +++ b/test/python/transpiler/test_linear_functions_passes.py @@ -17,11 +17,7 @@ from qiskit.circuit import QuantumCircuit, Qubit, Clbit from qiskit.transpiler.passes.optimization import CollectLinearFunctions -from qiskit.transpiler.passes.synthesis import ( - LinearFunctionsSynthesis, - HighLevelSynthesis, - LinearFunctionsToPermutations, -) +from qiskit.transpiler.passes.synthesis import HighLevelSynthesis, LinearFunctionsToPermutations from qiskit.circuit.library.generalized_gates import LinearFunction from qiskit.circuit.library import RealAmplitudes from qiskit.transpiler import PassManager @@ -38,45 +34,6 @@ class TestLinearFunctionsPasses(QiskitTestCase): and the pass that promotes LinearFunctions to Permutations whenever possible. """ - def test_deprecated_synthesis_method(self): - """Test that when all gates in a circuit are either CX or SWAP, - we end up with a single LinearFunction.""" - - # original circuit - circuit = QuantumCircuit(4) - circuit.cx(0, 1) - circuit.cx(0, 2) - circuit.cx(0, 3) - circuit.swap(2, 3) - circuit.cx(0, 1) - circuit.cx(0, 3) - - # new circuit with linear functions extracted using transpiler pass - optimized_circuit = PassManager(CollectLinearFunctions()).run(circuit) - - # check that this circuit consists of a single LinearFunction - self.assertIn("linear_function", optimized_circuit.count_ops().keys()) - self.assertEqual(len(optimized_circuit.data), 1) - inst1 = optimized_circuit.data[0] - self.assertIsInstance(inst1.operation, LinearFunction) - - # construct a circuit with linear function directly, without the transpiler pass - expected_circuit = QuantumCircuit(4) - expected_circuit.append(LinearFunction(circuit), [0, 1, 2, 3]) - - # check that we have an equivalent circuit - self.assertEqual(Operator(optimized_circuit), Operator(expected_circuit)) - - # now a circuit with linear functions synthesized - with self.assertWarns(DeprecationWarning): - synthesized_circuit = PassManager(LinearFunctionsSynthesis()).run(optimized_circuit) - - # check that there are no LinearFunctions present in synthesized_circuit - self.assertNotIn("linear_function", synthesized_circuit.count_ops().keys()) - - # check that we have an equivalent circuit - self.assertEqual(Operator(optimized_circuit), Operator(synthesized_circuit)) - # Most of CollectLinearFunctions tests should work correctly both without and with # commutativity analysis. From a96b15a700a7d4ae6623ec0cd165757e6b666563 Mon Sep 17 00:00:00 2001 From: Jake Lishman Date: Thu, 1 Feb 2024 20:12:50 +0000 Subject: [PATCH 2/7] Remove unsed import --- qiskit/quantum_info/operators/measures.py | 1 - 1 file changed, 1 deletion(-) diff --git a/qiskit/quantum_info/operators/measures.py b/qiskit/quantum_info/operators/measures.py index cb340bad9d02..617e9f64b687 100644 --- a/qiskit/quantum_info/operators/measures.py +++ b/qiskit/quantum_info/operators/measures.py @@ -16,7 +16,6 @@ from __future__ import annotations import logging -import warnings import numpy as np from qiskit.exceptions import QiskitError, MissingOptionalLibraryError From 30e8b9bc5840df75cc7025cec6be256834be6fef Mon Sep 17 00:00:00 2001 From: Jake Lishman Date: Thu, 1 Feb 2024 20:15:10 +0000 Subject: [PATCH 3/7] Remove tests of deprecations --- test/python/circuit/test_circuit_load_from_qpy.py | 6 ------ test/python/circuit/test_circuit_properties.py | 7 ------- test/python/circuit/test_register.py | 12 ------------ 3 files changed, 25 deletions(-) diff --git a/test/python/circuit/test_circuit_load_from_qpy.py b/test/python/circuit/test_circuit_load_from_qpy.py index 6dac2c3f4963..766d555bda59 100644 --- a/test/python/circuit/test_circuit_load_from_qpy.py +++ b/test/python/circuit/test_circuit_load_from_qpy.py @@ -1687,12 +1687,6 @@ def test_multiple_nested_control_custom_definitions(self): self.assertEqual(qc, new_circuit) self.assertDeprecatedBitProperties(qc, new_circuit) - def test_qpy_deprecation(self): - """Test the old import path's deprecations fire.""" - with self.assertWarnsRegex(DeprecationWarning, "is deprecated"): - # pylint: disable=no-name-in-module, unused-import, redefined-outer-name, reimported - from qiskit.circuit.qpy_serialization import dump, load - @ddt.data(0, "01", [1, 0, 0, 0]) def test_valid_circuit_with_initialize_instruction(self, param): """Tests that circuit that has initialize instruction can be saved and correctly retrieved""" diff --git a/test/python/circuit/test_circuit_properties.py b/test/python/circuit/test_circuit_properties.py index 9875739d3aa8..bce49af689af 100644 --- a/test/python/circuit/test_circuit_properties.py +++ b/test/python/circuit/test_circuit_properties.py @@ -1233,13 +1233,6 @@ def test_metadata_raises(self): with self.assertRaises(TypeError): qc.metadata = 1 - def test_metdata_deprectation(self): - """Test that setting metadata to None emits a deprecation warning.""" - qc = QuantumCircuit(1) - with self.assertWarns(DeprecationWarning): - qc.metadata = None - self.assertEqual(qc.metadata, {}) - def test_scheduling(self): """Test cannot return schedule information without scheduling.""" qc = QuantumCircuit(2) diff --git a/test/python/circuit/test_register.py b/test/python/circuit/test_register.py index 7f74e560ce29..7fff70b1d23a 100644 --- a/test/python/circuit/test_register.py +++ b/test/python/circuit/test_register.py @@ -119,15 +119,3 @@ def test_newstyle_register_eq(self, reg_type): bits_difftype = [difftype.bit_type() for _ in range(3)] reg_difftype = difftype(name="foo", bits=bits_difftype) self.assertNotEqual(reg_difftype, test_reg) - - @data(QuantumRegister, ClassicalRegister, AncillaRegister) - def test_register_name_format_deprecation(self, reg_type): - """Test that the `Register.name_format` class data can be accessed and triggers its - deprecation correctly.""" - # From instance: - reg_inst = reg_type(2) - with self.assertWarnsRegex(DeprecationWarning, "Register.name_format is deprecated"): - self.assertTrue(reg_inst.name_format.match("name")) - # From class: - with self.assertWarnsRegex(DeprecationWarning, "Register.name_format is deprecated"): - self.assertTrue(reg_type.name_format.match("name")) From 91ae8cf80d263f2a62d8f58d1c66aac15ccd338a Mon Sep 17 00:00:00 2001 From: Jake Lishman Date: Thu, 1 Feb 2024 20:18:15 +0000 Subject: [PATCH 4/7] Remove ClassicalRegister.qasm too --- qiskit/circuit/classicalregister.py | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/qiskit/circuit/classicalregister.py b/qiskit/circuit/classicalregister.py index 9ae39055039c..7a21e6b2fa58 100644 --- a/qiskit/circuit/classicalregister.py +++ b/qiskit/circuit/classicalregister.py @@ -19,7 +19,6 @@ from qiskit.circuit.exceptions import CircuitError -from qiskit.utils.deprecation import deprecate_func from .register import Register from .bit import Bit @@ -56,16 +55,3 @@ class ClassicalRegister(Register): # Prefix to use for auto naming. prefix = "c" bit_type = Clbit - - @deprecate_func( - additional_msg=( - "Correct exporting to OpenQASM 2 is the responsibility of a larger exporter; it cannot " - "safely be done on an object-by-object basis without context. No replacement will be " - "provided, because the premise is wrong." - ), - since="0.23.0", - package_name="qiskit-terra", - ) - def qasm(self): - """Return OPENQASM string for this register.""" - return "creg %s[%d];" % (self.name, self.size) From b653d8fe362c52f974d05d4cb78e4fff9af229e7 Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Thu, 1 Feb 2024 15:40:25 -0500 Subject: [PATCH 5/7] Remove unused imports --- qiskit/circuit/quantumcircuit.py | 1 - qiskit/circuit/register.py | 1 - 2 files changed, 2 deletions(-) diff --git a/qiskit/circuit/quantumcircuit.py b/qiskit/circuit/quantumcircuit.py index d1c7d77f5140..1b7bbd8c08a7 100644 --- a/qiskit/circuit/quantumcircuit.py +++ b/qiskit/circuit/quantumcircuit.py @@ -17,7 +17,6 @@ from __future__ import annotations import copy import multiprocessing as mp -import warnings import typing from collections import OrderedDict, defaultdict, namedtuple from typing import ( diff --git a/qiskit/circuit/register.py b/qiskit/circuit/register.py index 58a12c07f861..e927d10e7360 100644 --- a/qiskit/circuit/register.py +++ b/qiskit/circuit/register.py @@ -17,7 +17,6 @@ """ from __future__ import annotations -import re import itertools import numpy as np From fb82dc88ebae04ddbf4e93ce668a8f7d1bc18aa7 Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Thu, 1 Feb 2024 15:40:59 -0500 Subject: [PATCH 6/7] Update releasenotes/notes/rollup-removals-ce8326ea90c0ad99.yaml --- releasenotes/notes/rollup-removals-ce8326ea90c0ad99.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/releasenotes/notes/rollup-removals-ce8326ea90c0ad99.yaml b/releasenotes/notes/rollup-removals-ce8326ea90c0ad99.yaml index 78d5858f1f87..3c7ff781ee60 100644 --- a/releasenotes/notes/rollup-removals-ce8326ea90c0ad99.yaml +++ b/releasenotes/notes/rollup-removals-ce8326ea90c0ad99.yaml @@ -11,7 +11,7 @@ upgrade: :func:`.qasm2.dump` or :func:`.qasm2.dumps`. - | The specialized transpiler pass :class:`.LinearFunctionsSynthesis` has been removed following - its deprecation in qiskit-terra 0.23.0, since when it has been a very thing wrapper around + its deprecation in qiskit-terra 0.23.0. Since its deprecation it just has been a very thin wrapper around :class:`.HighLevelSynthesis`, which you should use instead. - | You can no longer set :attr:`.QuantumCircuit.metadata` to be ``None``, following deprecation From 0f5bbef0a897d5f0c5d14528b887e75da54909a5 Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Thu, 1 Feb 2024 16:04:22 -0500 Subject: [PATCH 7/7] Remove stray autosummary for removed pass --- qiskit/transpiler/passes/__init__.py | 1 - 1 file changed, 1 deletion(-) diff --git a/qiskit/transpiler/passes/__init__.py b/qiskit/transpiler/passes/__init__.py index c04ad2bda698..9939581681f2 100644 --- a/qiskit/transpiler/passes/__init__.py +++ b/qiskit/transpiler/passes/__init__.py @@ -143,7 +143,6 @@ :toctree: ../stubs/ UnitarySynthesis - LinearFunctionsSynthesis LinearFunctionsToPermutations HighLevelSynthesis HLSConfig