From 1e1ae9662065529ab856a74ad01db9910fb4b259 Mon Sep 17 00:00:00 2001 From: Jun Doi Date: Thu, 8 Aug 2024 18:05:41 +0900 Subject: [PATCH] lint --- qiskit_aer/backends/aer_simulator.py | 3 +-- qiskit_aer/backends/aerbackend.py | 15 +-------------- qiskit_aer/backends/qasm_simulator.py | 9 +++++---- 3 files changed, 7 insertions(+), 20 deletions(-) diff --git a/qiskit_aer/backends/aer_simulator.py b/qiskit_aer/backends/aer_simulator.py index a316f779c3..f5badc852d 100644 --- a/qiskit_aer/backends/aer_simulator.py +++ b/qiskit_aer/backends/aer_simulator.py @@ -18,7 +18,6 @@ from qiskit.providers import convert_to_target from qiskit.providers.options import Options from qiskit.providers.backend import BackendV2, BackendV1 -from qiskit.transpiler.target import target_to_backend_properties from ..version import __version__ from .aerbackend import AerBackend, AerError @@ -854,7 +853,7 @@ def from_backend(cls, backend, **options): target = backend.target elif isinstance(backend, BackendV1): # BackendV1 will be removed in Qiskit 2.0, so we will remove this soon - warnings.warn( + warn( " from_backend using V1 based backend is deprecated as of Aer 0.15" " and will be removed no sooner than 3 months from that release" " date. Please use backends based on V2.", diff --git a/qiskit_aer/backends/aerbackend.py b/qiskit_aer/backends/aerbackend.py index 43ec732cce..c0865acf2b 100644 --- a/qiskit_aer/backends/aerbackend.py +++ b/qiskit_aer/backends/aerbackend.py @@ -29,7 +29,7 @@ from qiskit.qobj import QasmQobj, PulseQobj from qiskit.result import Result from qiskit.transpiler import CouplingMap -from qiskit.circuit.controlflow import CONTROL_FLOW_OP_NAMES +from qiskit.circuit.library.standard_gates import get_standard_gate_name_mapping from ..aererror import AerError from ..jobs import AerJob, AerJobSet, split_qobj from ..noise.noise_model import NoiseModel, QuantumErrorLocation @@ -329,21 +329,8 @@ def target(self): return self._target # make target for AerBackend - - # importing packages where they are needed, to avoid cyclic-import. - # pylint: disable=cyclic-import - from qiskit.transpiler.target import ( - Target, - InstructionProperties, - ) - from qiskit.circuit.controlflow import ForLoopOp, IfElseOp, SwitchCaseOp, WhileLoopOp - from qiskit.circuit.library.standard_gates import get_standard_gate_name_mapping - from qiskit.circuit.parameter import Parameter - from qiskit.circuit.gate import Gate - required = ["measure", "delay"] - # Load Qiskit object representation qiskit_inst_mapping = get_standard_gate_name_mapping() qiskit_inst_mapping.update(NAME_MAPPING) diff --git a/qiskit_aer/backends/qasm_simulator.py b/qiskit_aer/backends/qasm_simulator.py index b3f8d90497..a74a2d6c18 100644 --- a/qiskit_aer/backends/qasm_simulator.py +++ b/qiskit_aer/backends/qasm_simulator.py @@ -16,9 +16,9 @@ import copy import logging from warnings import warn +from qiskit.providers import convert_to_target from qiskit.providers.options import Options -from qiskit.providers.models import QasmBackendConfiguration -from qiskit.providers.backend import BackendV2 +from qiskit.providers.backend import BackendV2, BackendV1 from ..version import __version__ from ..aererror import AerError @@ -35,6 +35,7 @@ # pylint: disable=import-error, no-name-in-module, abstract-method from .controller_wrappers import aer_controller_execute +from .name_mapping import NAME_MAPPING logger = logging.getLogger(__name__) @@ -431,7 +432,7 @@ class QasmSimulator(AerBackend): _AVAILABLE_DEVICES = None - def __init__(self, configuration=None, properties=None, provider=None, **backend_options): + def __init__(self, configuration=None, provider=None, **backend_options): warn( "The `QasmSimulator` backend will be deprecated in the" " future. It has been superseded by the `AerSimulator`" @@ -550,7 +551,7 @@ def from_backend(cls, backend, **options): target = backend.target elif isinstance(backend, BackendV1): # BackendV1 will be removed in Qiskit 2.0, so we will remove this soon - warnings.warn( + warn( " from_backend using V1 based backend is deprecated as of Aer 0.15" " and will be removed no sooner than 3 months from that release" " date. Please use backends based on V2.",