Skip to content

Commit

Permalink
Add link to url guide
Browse files Browse the repository at this point in the history
  • Loading branch information
manoelmarques committed Feb 14, 2023
1 parent 4f10b93 commit 65edf73
Show file tree
Hide file tree
Showing 23 changed files with 363 additions and 180 deletions.
33 changes: 21 additions & 12 deletions qiskit/algorithms/amplitude_amplifiers/grover.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from qiskit.providers import Backend
from qiskit.quantum_info import partial_trace
from qiskit.utils import QuantumInstance, algorithm_globals
from qiskit.utils.deprecation import deprecate_function
from qiskit.utils.deprecation import deprecate_function_msg, deprecate_string_msg

from .amplification_problem import AmplificationProblem
from .amplitude_amplifier import AmplitudeAmplifier, AmplitudeAmplifierResult
Expand Down Expand Up @@ -175,9 +175,14 @@ def __init__(
self._quantum_instance = None
if quantum_instance is not None:
warnings.warn(
"The quantum_instance argument is deprecated as of Qiskit Terra 0.24.0 and "
"will be removed no sooner than 3 months after the release date. Instead, use "
"the sampler argument as a replacement.",
message=deprecate_string_msg(
version="0.24.0",
old_module="algorithms",
old_name="quantum_instance",
old_type="argument",
new_name="sampler",
url="https://qisk.it/qi_migration",
),
category=DeprecationWarning,
stacklevel=2,
)
Expand All @@ -191,10 +196,12 @@ def __init__(
self._iterations_arg = iterations

@property
@deprecate_function(
"The Grover.quantum_instance getter is deprecated as of Qiskit Terra 0.24.0 and "
"will be removed no sooner than 3 months after the release date.",
category=DeprecationWarning,
@deprecate_function_msg(
version="0.24.0",
old_module="algorithms",
old_name="Grover.quantum_instance",
old_type="getter",
url="https://qisk.it/qi_migration",
)
def quantum_instance(self) -> Optional[QuantumInstance]:
r"""Deprecated\; Get the quantum instance.
Expand All @@ -205,10 +212,12 @@ def quantum_instance(self) -> Optional[QuantumInstance]:
return self._quantum_instance

@quantum_instance.setter
@deprecate_function(
"The Grover.quantum_instance setter is deprecated as of Qiskit Terra 0.24.0 and "
"will be removed no sooner than 3 months after the release date.",
category=DeprecationWarning,
@deprecate_function_msg(
version="0.24.0",
old_module="algorithms",
old_name="Grover.quantum_instance",
old_type="setter",
url="https://qisk.it/qi_migration",
)
def quantum_instance(self, quantum_instance: Union[QuantumInstance, Backend]) -> None:
r"""Deprecated\; Set quantum instance.
Expand Down
34 changes: 22 additions & 12 deletions qiskit/algorithms/amplitude_estimators/ae.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from qiskit.providers import Backend
from qiskit.primitives import BaseSampler
from qiskit.utils import QuantumInstance
from qiskit.utils.deprecation import deprecate_function
from qiskit.utils.deprecation import deprecate_function_msg, deprecate_string_msg
from .amplitude_estimator import AmplitudeEstimator, AmplitudeEstimatorResult
from .ae_utils import pdf_a, derivative_log_pdf_a, bisect_max
from .estimation_problem import EstimationProblem
Expand Down Expand Up @@ -88,10 +88,16 @@ def __init__(
# set quantum instance
if quantum_instance is not None:
warnings.warn(
"The quantum_instance argument is deprecated as of Qiskit Terra 0.24.0 and "
"will be removed no sooner than 3 months after the release date. Instead, use "
"the sampler argument as a replacement.",
message=deprecate_string_msg(
version="0.24.0",
old_module="algorithms",
old_name="quantum_instance",
old_type="argument",
new_name="sampler",
url="https://qisk.it/qi_migration",
),
category=DeprecationWarning,
stacklevel=2,
)
with warnings.catch_warnings():
warnings.simplefilter("ignore")
Expand Down Expand Up @@ -124,10 +130,12 @@ def sampler(self, sampler: BaseSampler) -> None:
self._sampler = sampler

@property
@deprecate_function(
"The AmplitudeEstimation.quantum_instance getter is deprecated as of Qiskit Terra 0.24.0 and "
"will be removed no sooner than 3 months after the release date.",
category=DeprecationWarning,
@deprecate_function_msg(
version="0.24.0",
old_module="algorithms",
old_name="AmplitudeEstimation.quantum_instance",
old_type="getter",
url="https://qisk.it/qi_migration",
)
def quantum_instance(self) -> QuantumInstance | None:
"""Deprecated; Get the quantum instance.
Expand All @@ -138,10 +146,12 @@ def quantum_instance(self) -> QuantumInstance | None:
return self._quantum_instance

@quantum_instance.setter
@deprecate_function(
"The AmplitudeEstimation.quantum_instance setter is deprecated as of Qiskit Terra 0.24.0 and "
"will be removed no sooner than 3 months after the release date.",
category=DeprecationWarning,
@deprecate_function_msg(
version="0.24.0",
old_module="algorithms",
old_name="AmplitudeEstimation.quantum_instance",
old_type="setter",
url="https://qisk.it/qi_migration",
)
def quantum_instance(self, quantum_instance: QuantumInstance | Backend) -> None:
"""Deprecated; Set quantum instance.
Expand Down
36 changes: 22 additions & 14 deletions qiskit/algorithms/amplitude_estimators/fae.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from qiskit.providers import Backend
from qiskit.primitives import BaseSampler
from qiskit.utils import QuantumInstance
from qiskit.utils.deprecation import deprecate_function
from qiskit.utils.deprecation import deprecate_function_msg, deprecate_string_msg
from qiskit.algorithms.exceptions import AlgorithmError

from .amplitude_estimator import AmplitudeEstimator, AmplitudeEstimatorResult
Expand Down Expand Up @@ -75,10 +75,16 @@ def __init__(
# set quantum instance
if quantum_instance is not None:
warnings.warn(
"The quantum_instance argument is deprecated as of Qiskit Terra 0.24.0 and "
"will be removed no sooner than 3 months after the release date. Instead, use "
"the sampler argument as a replacement.",
message=deprecate_string_msg(
version="0.24.0",
old_module="algorithms",
old_name="quantum_instance",
old_type="argument",
new_name="sampler",
url="https://qisk.it/qi_migration",
),
category=DeprecationWarning,
stacklevel=2,
)
with warnings.catch_warnings():
warnings.simplefilter("ignore")
Expand Down Expand Up @@ -109,11 +115,12 @@ def sampler(self, sampler: BaseSampler) -> None:
self._sampler = sampler

@property
@deprecate_function(
"The FasterAmplitudeEstimation.quantum_instance getter is deprecated "
"as of Qiskit Terra 0.24.0 and "
"will be removed no sooner than 3 months after the release date.",
category=DeprecationWarning,
@deprecate_function_msg(
version="0.24.0",
old_module="algorithms",
old_name="FasterAmplitudeEstimation.quantum_instance",
old_type="getter",
url="https://qisk.it/qi_migration",
)
def quantum_instance(self) -> QuantumInstance | None:
"""Deprecated; Get the quantum instance.
Expand All @@ -124,11 +131,12 @@ def quantum_instance(self) -> QuantumInstance | None:
return self._quantum_instance

@quantum_instance.setter
@deprecate_function(
"The FasterAmplitudeEstimation.quantum_instance setter is deprecated "
"as of Qiskit Terra 0.24.0 and "
"will be removed no sooner than 3 months after the release date.",
category=DeprecationWarning,
@deprecate_function_msg(
version="0.24.0",
old_module="algorithms",
old_name="FasterAmplitudeEstimation.quantum_instance",
old_type="setter",
url="https://qisk.it/qi_migration",
)
def quantum_instance(self, quantum_instance: QuantumInstance | Backend) -> None:
"""Deprecated; Set quantum instance.
Expand Down
36 changes: 22 additions & 14 deletions qiskit/algorithms/amplitude_estimators/iae.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from qiskit.providers import Backend
from qiskit.primitives import BaseSampler
from qiskit.utils import QuantumInstance
from qiskit.utils.deprecation import deprecate_function
from qiskit.utils.deprecation import deprecate_function_msg, deprecate_string_msg

from .amplitude_estimator import AmplitudeEstimator, AmplitudeEstimatorResult
from .estimation_problem import EstimationProblem
Expand Down Expand Up @@ -97,10 +97,16 @@ def __init__(
# set quantum instance
if quantum_instance is not None:
warnings.warn(
"The quantum_instance argument is deprecated as of Qiskit Terra 0.24.0 and "
"will be removed no sooner than 3 months after the release date. Instead, use "
"the sampler argument as a replacement.",
message=deprecate_string_msg(
version="0.24.0",
old_module="algorithms",
old_name="quantum_instance",
old_type="argument",
new_name="sampler",
url="https://qisk.it/qi_migration",
),
category=DeprecationWarning,
stacklevel=2,
)
with warnings.catch_warnings():
warnings.simplefilter("ignore")
Expand Down Expand Up @@ -132,11 +138,12 @@ def sampler(self, sampler: BaseSampler) -> None:
self._sampler = sampler

@property
@deprecate_function(
"The IterativeAmplitudeEstimation.quantum_instance getter is deprecated "
"as of Qiskit Terra 0.24.0 and "
"will be removed no sooner than 3 months after the release date.",
category=DeprecationWarning,
@deprecate_function_msg(
version="0.24.0",
old_module="algorithms",
old_name="IterativeAmplitudeEstimation.quantum_instance",
old_type="getter",
url="https://qisk.it/qi_migration",
)
def quantum_instance(self) -> QuantumInstance | None:
"""Deprecated; Get the quantum instance.
Expand All @@ -147,11 +154,12 @@ def quantum_instance(self) -> QuantumInstance | None:
return self._quantum_instance

@quantum_instance.setter
@deprecate_function(
"The IterativeAmplitudeEstimation.quantum_instance setter is deprecated "
"as of Qiskit Terra 0.24.0 and "
"will be removed no sooner than 3 months after the release date.",
category=DeprecationWarning,
@deprecate_function_msg(
version="0.24.0",
old_module="algorithms",
old_name="IterativeAmplitudeEstimation.quantum_instance",
old_type="setter",
url="https://qisk.it/qi_migration",
)
def quantum_instance(self, quantum_instance: QuantumInstance | Backend) -> None:
"""Deprecated; Set quantum instance.
Expand Down
36 changes: 22 additions & 14 deletions qiskit/algorithms/amplitude_estimators/mlae.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from qiskit import ClassicalRegister, QuantumRegister, QuantumCircuit
from qiskit.utils import QuantumInstance
from qiskit.primitives import BaseSampler
from qiskit.utils.deprecation import deprecate_function
from qiskit.utils.deprecation import deprecate_function_msg, deprecate_string_msg

from .amplitude_estimator import AmplitudeEstimator, AmplitudeEstimatorResult
from .estimation_problem import EstimationProblem
Expand Down Expand Up @@ -83,10 +83,16 @@ def __init__(
# set quantum instance
if quantum_instance is not None:
warnings.warn(
"The quantum_instance argument is deprecated as of Qiskit Terra 0.24.0 and "
"will be removed no sooner than 3 months after the release date. Instead, use "
"the sampler argument as a replacement.",
message=deprecate_string_msg(
version="0.24.0",
old_module="algorithms",
old_name="quantum_instance",
old_type="argument",
new_name="sampler",
url="https://qisk.it/qi_migration",
),
category=DeprecationWarning,
stacklevel=2,
)
with warnings.catch_warnings():
warnings.simplefilter("ignore")
Expand Down Expand Up @@ -136,11 +142,12 @@ def sampler(self, sampler: BaseSampler) -> None:
self._sampler = sampler

@property
@deprecate_function(
"The MaximumLikelihoodAmplitudeEstimation.quantum_instance getter is deprecated "
"as of Qiskit Terra 0.24.0 and "
"will be removed no sooner than 3 months after the release date.",
category=DeprecationWarning,
@deprecate_function_msg(
version="0.24.0",
old_module="algorithms",
old_name="MaximumLikelihoodAmplitudeEstimation.quantum_instance",
old_type="getter",
url="https://qisk.it/qi_migration",
)
def quantum_instance(self) -> QuantumInstance | None:
"""Deprecated; Get the quantum instance.
Expand All @@ -151,11 +158,12 @@ def quantum_instance(self) -> QuantumInstance | None:
return self._quantum_instance

@quantum_instance.setter
@deprecate_function(
"The MaximumLikelihoodAmplitudeEstimation.quantum_instance setter is deprecated "
"as of Qiskit Terra 0.24.0 and "
"will be removed no sooner than 3 months after the release date.",
category=DeprecationWarning,
@deprecate_function_msg(
version="0.24.0",
old_module="algorithms",
old_name="MaximumLikelihoodAmplitudeEstimation.quantum_instance",
old_type="setter",
url="https://qisk.it/qi_migration",
)
def quantum_instance(self, quantum_instance: QuantumInstance | Backend) -> None:
"""Deprecated; Set quantum instance.
Expand Down
14 changes: 8 additions & 6 deletions qiskit/algorithms/aux_ops_evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,18 @@
from qiskit.providers import Backend
from qiskit.quantum_info import Statevector
from qiskit.utils import QuantumInstance
from qiskit.utils.deprecation import deprecate_function
from qiskit.utils.deprecation import deprecate_function_msg

from .list_or_dict import ListOrDict


@deprecate_function(
"The eval_observables function is deprecated as of Qiskit Terra 0.24.0 and "
"will be removed no sooner than 3 months after the release date. Instead, use "
"qiskit.algorithms.observables_evaluator.estimate_observables function as a replacement.",
category=DeprecationWarning,
@deprecate_function_msg(
version="0.24.0",
old_module="algorithms",
old_name="eval_observables",
old_type="function",
new_name="qiskit.algorithms.observables_evaluator.estimate_observables",
url="https://qisk.it/qi_migration",
)
def eval_observables(
quantum_instance: Union[QuantumInstance, Backend],
Expand Down
25 changes: 14 additions & 11 deletions qiskit/algorithms/eigen_solvers/eigen_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import numpy as np

from qiskit.opflow import OperatorBase
from qiskit.utils.deprecation import deprecate_function
from qiskit.utils.deprecation import deprecate_function_msg
from ..algorithm_result import AlgorithmResult
from ..list_or_dict import ListOrDict

Expand All @@ -36,11 +36,13 @@ class Eigensolver(ABC):
used interchangeably.
"""

@deprecate_function(
"The Eigensolver interface is deprecated as of Qiskit Terra 0.24.0 and "
"will be removed no sooner than 3 months after the release date. Instead, use "
"the qiskit.algorithms.eigensolvers.Eigensolver interface.",
category=DeprecationWarning,
@deprecate_function_msg(
version="0.24.0",
old_module="algorithms",
old_name="Eigensolver",
old_type="interface",
new_name="qiskit.algorithms.eigensolvers.Eigensolver",
url="https://qisk.it/qi_migration",
)
def __init__(self) -> None:
pass
Expand Down Expand Up @@ -87,11 +89,12 @@ class EigensolverResult(AlgorithmResult):
"""

@deprecate_function(
"The EigensolverResult class is deprecated as of Qiskit Terra 0.24.0 and "
"will be removed no sooner than 3 months after the release date. Instead, use "
"the qiskit.algorithms.eigensolvers.EigensolverResult class.",
category=DeprecationWarning,
@deprecate_function_msg(
version="0.24.0",
old_module="algorithms",
old_name="EigensolverResult",
new_name="qiskit.algorithms.eigensolvers.EigensolverResult",
url="https://qisk.it/qi_migration",
)
def __init__(self) -> None:
super().__init__()
Expand Down
Loading

0 comments on commit 65edf73

Please sign in to comment.