From 654a53051a22eaf0c933d95b543133f5cadbd918 Mon Sep 17 00:00:00 2001 From: Julien Gacon Date: Fri, 5 Jan 2024 14:31:40 +0100 Subject: [PATCH] Remove deprecated top-level `classicalfunction` imports (#11486) * Remove deprecated top-level classicalfunction imports * add reno * new editor does not automatically run black yet... sorry * Update releasenotes/notes/remove-cfun-toplevel-5d0d58bed83d57ed.yaml Co-authored-by: Jake Lishman --------- Co-authored-by: Jake Lishman --- qiskit/circuit/__init__.py | 25 ------------------- ...remove-cfun-toplevel-5d0d58bed83d57ed.yaml | 6 +++++ 2 files changed, 6 insertions(+), 25 deletions(-) create mode 100644 releasenotes/notes/remove-cfun-toplevel-5d0d58bed83d57ed.yaml diff --git a/qiskit/circuit/__init__.py b/qiskit/circuit/__init__.py index 8886c88c4136..62c6c524eb29 100644 --- a/qiskit/circuit/__init__.py +++ b/qiskit/circuit/__init__.py @@ -398,28 +398,3 @@ BreakLoopOp, ContinueLoopOp, ) - - -_DEPRECATED_NAMES = { - "Int1": "qiskit.circuit.classicalfunction.types", - "Int2": "qiskit.circuit.classicalfunction.types", - "classical_function": "qiskit.circuit.classicalfunction", - "BooleanExpression": "qiskit.circuit.classicalfunction", -} - - -def __getattr__(name): - if name in _DEPRECATED_NAMES: - import importlib - import warnings - - module_name = _DEPRECATED_NAMES[name] - warnings.warn( - f"Accessing '{name}' from '{__name__}' is deprecated since Qiskit Terra 0.22 " - f"and will be removed in 0.23. Import from '{module_name}' instead. " - "This will require installing 'tweedledum' as an optional dependency from Terra 0.23.", - DeprecationWarning, - stacklevel=2, - ) - return getattr(importlib.import_module(module_name), name) - raise AttributeError(f"module '{__name__}' has no attribute '{name}'") diff --git a/releasenotes/notes/remove-cfun-toplevel-5d0d58bed83d57ed.yaml b/releasenotes/notes/remove-cfun-toplevel-5d0d58bed83d57ed.yaml new file mode 100644 index 000000000000..52013163fe80 --- /dev/null +++ b/releasenotes/notes/remove-cfun-toplevel-5d0d58bed83d57ed.yaml @@ -0,0 +1,6 @@ +--- +upgrade: + - | + Importing :class:`.Int1`, :class:`.Int2`, :class:`.BooleanFunction`, :func:`.classical_function` + from :mod:`qiskit.circuit` is now disabled. Instead, import the objects from the + :mod:`qiskit.circuit.classicalfunction` submodule, which requires the ``tweedledum`` package.