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

Effect final removals from Qiskit 1.0 #11711

Merged
merged 7 commits into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
Changes from 6 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
14 changes: 0 additions & 14 deletions qiskit/circuit/classicalregister.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)
28 changes: 0 additions & 28 deletions qiskit/circuit/qpy_serialization.py

This file was deleted.

13 changes: 2 additions & 11 deletions qiskit/circuit/quantumcircuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -468,17 +467,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

Expand Down
15 changes: 0 additions & 15 deletions qiskit/circuit/quantumregister.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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."""
Expand Down
21 changes: 0 additions & 21 deletions qiskit/circuit/register.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,12 @@
"""

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.

Expand All @@ -50,11 +34,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.
Expand Down
13 changes: 3 additions & 10 deletions qiskit/quantum_info/operators/measures.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

from __future__ import annotations
import logging
import warnings
import numpy as np

from qiskit.exceptions import QiskitError, MissingOptionalLibraryError
Expand Down Expand Up @@ -388,16 +387,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):
Expand Down
2 changes: 0 additions & 2 deletions qiskit/synthesis/two_qubit/two_qubit_decompose.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 3 additions & 1 deletion qiskit/transpiler/passes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@
RZXCalibrationBuilderNoEcho
RXCalibrationBuilder

.. autofunction:: rzx_templates

Scheduling
=============

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
27 changes: 0 additions & 27 deletions qiskit/transpiler/passes/scheduling/calibration_creators.py

This file was deleted.

28 changes: 0 additions & 28 deletions qiskit/transpiler/passes/scheduling/rzx_templates.py

This file was deleted.

2 changes: 1 addition & 1 deletion qiskit/transpiler/passes/synthesis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
12 changes: 1 addition & 11 deletions qiskit/visualization/pulse_v2/stylesheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,13 @@
the appearance of the output image.
"""

import warnings
from typing import Dict, Any, Mapping
from qiskit.visualization.pulse_v2 import generators, layouts


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.
Expand All @@ -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
Expand Down
12 changes: 1 addition & 11 deletions qiskit/visualization/timeline/stylesheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand All @@ -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
Expand Down
Loading
Loading