diff --git a/ai-clifford-synthesis-demo.ipynb b/ai-clifford-synthesis-demo.ipynb index 302dc66..788b710 100644 --- a/ai-clifford-synthesis-demo.ipynb +++ b/ai-clifford-synthesis-demo.ipynb @@ -19,10 +19,10 @@ "import numpy as np\n", "from qiskit import QuantumCircuit\n", "from qiskit.quantum_info import random_clifford\n", - "\n", "from qiskit.transpiler import PassManager\n", - "from qiskit_ibm_transpiler.ai.synthesis import AICliffordSynthesis\n", - "from qiskit_ibm_transpiler.ai.collection import CollectCliffords" + "\n", + "from qiskit_ibm_transpiler.ai.collection import CollectCliffords\n", + "from qiskit_ibm_transpiler.ai.synthesis import AICliffordSynthesis" ] }, { diff --git a/ai-linear-function-synthesis-demo.ipynb b/ai-linear-function-synthesis-demo.ipynb index e7525cb..b444977 100644 --- a/ai-linear-function-synthesis-demo.ipynb +++ b/ai-linear-function-synthesis-demo.ipynb @@ -19,10 +19,10 @@ "import numpy as np\n", "from qiskit import QuantumCircuit\n", "from qiskit.quantum_info import random_clifford\n", - "\n", "from qiskit.transpiler import PassManager\n", - "from qiskit_ibm_transpiler.ai.synthesis import AILinearFunctionSynthesis\n", - "from qiskit_ibm_transpiler.ai.collection import CollectLinearFunctions" + "\n", + "from qiskit_ibm_transpiler.ai.collection import CollectLinearFunctions\n", + "from qiskit_ibm_transpiler.ai.synthesis import AILinearFunctionSynthesis" ] }, { diff --git a/ai-permutation-synthesis-demo.ipynb b/ai-permutation-synthesis-demo.ipynb index cd979e4..21cd892 100644 --- a/ai-permutation-synthesis-demo.ipynb +++ b/ai-permutation-synthesis-demo.ipynb @@ -17,10 +17,11 @@ "outputs": [], "source": [ "from qiskit import QuantumCircuit\n", + "from qiskit.circuit.library import Permutation\n", "from qiskit.transpiler import PassManager\n", + "\n", "from qiskit_ibm_transpiler.ai.collection import CollectPermutations\n", - "from qiskit_ibm_transpiler.ai.synthesis import AIPermutationSynthesis\n", - "from qiskit.circuit.library import Permutation" + "from qiskit_ibm_transpiler.ai.synthesis import AIPermutationSynthesis" ] }, { diff --git a/documentation-examples.ipynb b/documentation-examples.ipynb index 53e1d1c..0ad77ea 100644 --- a/documentation-examples.ipynb +++ b/documentation-examples.ipynb @@ -16,6 +16,7 @@ ], "source": [ "from qiskit.circuit.library import EfficientSU2\n", + "\n", "from qiskit_ibm_transpiler.transpiler_service import TranspilerService\n", "\n", "circuit = EfficientSU2(101, entanglement=\"circular\", reps=1).decompose()\n", @@ -44,6 +45,7 @@ ], "source": [ "from qiskit.circuit.library import EfficientSU2\n", + "\n", "from qiskit_ibm_transpiler.transpiler_service import TranspilerService\n", "\n", "circuit = EfficientSU2(101, entanglement=\"circular\", reps=1).decompose()\n", @@ -72,6 +74,7 @@ ], "source": [ "from qiskit.circuit.library import EfficientSU2\n", + "\n", "from qiskit_ibm_transpiler.transpiler_service import TranspilerService\n", "\n", "circuit = EfficientSU2(101, entanglement=\"circular\", reps=1).decompose()\n", @@ -100,6 +103,7 @@ ], "source": [ "from qiskit.circuit.library import EfficientSU2\n", + "\n", "from qiskit_ibm_transpiler.transpiler_service import TranspilerService\n", "\n", "circuit = EfficientSU2(101, entanglement=\"circular\", reps=1).decompose()\n", @@ -118,9 +122,10 @@ "metadata": {}, "outputs": [], "source": [ + "from qiskit.circuit.library import EfficientSU2\n", "from qiskit.transpiler import PassManager\n", + "\n", "from qiskit_ibm_transpiler.ai.routing import AIRouting\n", - "from qiskit.circuit.library import EfficientSU2\n", "\n", "ai_passmanager = PassManager(\n", " [\n", @@ -149,12 +154,12 @@ } ], "source": [ + "from qiskit.circuit.library import EfficientSU2\n", "from qiskit.transpiler import PassManager\n", "\n", + "from qiskit_ibm_transpiler.ai.collection import CollectLinearFunctions\n", "from qiskit_ibm_transpiler.ai.routing import AIRouting\n", "from qiskit_ibm_transpiler.ai.synthesis import AILinearFunctionSynthesis\n", - "from qiskit_ibm_transpiler.ai.collection import CollectLinearFunctions\n", - "from qiskit.circuit.library import EfficientSU2\n", "\n", "ai_passmanager = PassManager(\n", " [\n", diff --git a/local-mode-example.ipynb b/local-mode-example.ipynb index bc597dc..5975667 100644 --- a/local-mode-example.ipynb +++ b/local-mode-example.ipynb @@ -6,12 +6,12 @@ "metadata": {}, "outputs": [], "source": [ + "import numpy as np\n", "from qiskit import QuantumCircuit\n", + "from qiskit.quantum_info import random_clifford\n", "from qiskit.transpiler import PassManager, generate_preset_pass_manager\n", - "import numpy as np\n", "\n", "from qiskit_ibm_transpiler.ai.collection import CollectLinearFunctions\n", - "from qiskit.quantum_info import random_clifford\n", "from qiskit_ibm_transpiler.ai.synthesis import AILinearFunctionSynthesis" ] }, diff --git a/local-mode-routing.ipynb b/local-mode-routing.ipynb index cabddbd..63cc3d3 100644 --- a/local-mode-routing.ipynb +++ b/local-mode-routing.ipynb @@ -6,9 +6,10 @@ "metadata": {}, "outputs": [], "source": [ + "from qiskit.circuit.library import EfficientSU2\n", "from qiskit.transpiler import PassManager\n", - "from qiskit_ibm_transpiler.ai.routing import AIRouting\n", - "from qiskit.circuit.library import EfficientSU2" + "\n", + "from qiskit_ibm_transpiler.ai.routing import AIRouting" ] }, { diff --git a/qiskit_ibm_transpiler/__init__.py b/qiskit_ibm_transpiler/__init__.py index b279994..ff599e4 100644 --- a/qiskit_ibm_transpiler/__init__.py +++ b/qiskit_ibm_transpiler/__init__.py @@ -10,12 +10,12 @@ # copyright notice, and modified files need to carry a notice indicating # that they have been altered from the originals. +import logging + from .ai import AIRouting +from .ai_passmanager import generate_ai_pass_manager from .transpiler_service import TranspilerService from .utils import create_random_linear_function, get_metrics -from .ai_passmanager import generate_ai_pass_manager - -import logging logging.basicConfig() logging.getLogger(__name__).addHandler(logging.NullHandler()) diff --git a/qiskit_ibm_transpiler/ai/routing.py b/qiskit_ibm_transpiler/ai/routing.py index 813b445..18a1fc7 100644 --- a/qiskit_ibm_transpiler/ai/routing.py +++ b/qiskit_ibm_transpiler/ai/routing.py @@ -16,19 +16,19 @@ # torch.set_num_threads(1) import importlib -import numpy as np import logging +from typing import List, Literal, Union + +import numpy as np from qiskit import ClassicalRegister, QuantumCircuit from qiskit.converters import circuit_to_dag, dag_to_circuit +from qiskit.providers.backend import BackendV2 as Backend from qiskit.transpiler import CouplingMap, TranspilerError from qiskit.transpiler.basepasses import TransformationPass from qiskit.transpiler.layout import Layout -from qiskit.providers.backend import BackendV2 as Backend from qiskit_ibm_runtime import QiskitRuntimeService -from qiskit_ibm_transpiler.wrappers import AIRoutingAPI, AILocalRouting - -from typing import List, Union, Literal +from qiskit_ibm_transpiler.wrappers import AILocalRouting, AIRoutingAPI logger = logging.getLogger(__name__) logger.setLevel(logging.INFO) diff --git a/qiskit_ibm_transpiler/ai/synthesis.py b/qiskit_ibm_transpiler/ai/synthesis.py index 2ca35bf..fb42e73 100644 --- a/qiskit_ibm_transpiler/ai/synthesis.py +++ b/qiskit_ibm_transpiler/ai/synthesis.py @@ -15,32 +15,30 @@ import os from concurrent.futures import ThreadPoolExecutor, as_completed from multiprocessing import cpu_count -from typing import Dict, Union, List +from typing import Dict, List, Union from qiskit.circuit.exceptions import CircuitError from qiskit.converters import circuit_to_dag from qiskit.dagcircuit.dagcircuit import DAGCircuit +from qiskit.providers.backend import BackendV2 as Backend from qiskit.quantum_info import Clifford from qiskit.transpiler import CouplingMap from qiskit.transpiler.basepasses import TransformationPass from qiskit.transpiler.exceptions import TranspilerError -from qiskit.providers.backend import BackendV2 as Backend from qiskit_ibm_runtime import QiskitRuntimeService from qiskit_ibm_transpiler.wrappers import ( AICliffordAPI, AILinearFunctionAPI, - AIPermutationAPI, AIPauliNetworkAPI, + AIPermutationAPI, ) - from qiskit_ibm_transpiler.wrappers.ai_local_synthesis import ( + AILocalCliffordSynthesis, AILocalLinearFunctionSynthesis, AILocalPermutationSynthesis, - AILocalCliffordSynthesis, ) - logger = logging.getLogger(__name__) MAX_THREADS = os.environ.get("AI_TRANSPILER_MAX_THREADS", int(cpu_count() / 2)) diff --git a/qiskit_ibm_transpiler/ai_passmanager.py b/qiskit_ibm_transpiler/ai_passmanager.py index 8275648..21d64e4 100644 --- a/qiskit_ibm_transpiler/ai_passmanager.py +++ b/qiskit_ibm_transpiler/ai_passmanager.py @@ -17,9 +17,9 @@ from qiskit.transpiler import CouplingMap, PassManager from qiskit.transpiler.preset_passmanagers import generate_preset_pass_manager +from .ai.collection import CollectLinearFunctions from .ai.routing import AIRouting from .ai.synthesis import AILinearFunctionSynthesis -from .ai.collection import CollectLinearFunctions def generate_ai_pass_manager( diff --git a/qiskit_ibm_transpiler/transpiler_service.py b/qiskit_ibm_transpiler/transpiler_service.py index 8689f70..928dd4e 100644 --- a/qiskit_ibm_transpiler/transpiler_service.py +++ b/qiskit_ibm_transpiler/transpiler_service.py @@ -27,7 +27,7 @@ """ import logging -from typing import Dict, List, Union, Literal +from typing import Dict, List, Literal, Union from qiskit import QuantumCircuit diff --git a/qiskit_ibm_transpiler/utils.py b/qiskit_ibm_transpiler/utils.py index e334aa9..7cef340 100644 --- a/qiskit_ibm_transpiler/utils.py +++ b/qiskit_ibm_transpiler/utils.py @@ -26,20 +26,19 @@ """ -from typing import Dict, Union, List, Tuple -from enum import Enum - -import numpy as np -import logging import base64 import io +import logging import struct +from enum import Enum +from typing import Dict, List, Tuple, Union +import numpy as np from qiskit import QuantumCircuit, qasm2, qasm3, qpy +from qiskit.circuit import QuantumCircuit, library from qiskit.circuit.library import LinearFunction from qiskit.quantum_info import Clifford from qiskit.synthesis.linear.linear_matrix_utils import random_invertible_binary_matrix -from qiskit.circuit import QuantumCircuit, library from qiskit.transpiler.basepasses import TransformationPass logger = logging.getLogger(__name__) diff --git a/qiskit_ibm_transpiler/wrappers/__init__.py b/qiskit_ibm_transpiler/wrappers/__init__.py index 679cf8b..ea40f77 100644 --- a/qiskit_ibm_transpiler/wrappers/__init__.py +++ b/qiskit_ibm_transpiler/wrappers/__init__.py @@ -33,12 +33,12 @@ """ from .ai_api_routing import AIRoutingAPI -from .ai_local_routing import AILocalRouting from .ai_api_synthesis import ( AICliffordAPI, AILinearFunctionAPI, - AIPermutationAPI, AIPauliNetworkAPI, + AIPermutationAPI, ) +from .ai_local_routing import AILocalRouting from .base import BackendTaskError, QiskitTranspilerService from .transpile import TranspileAPI, _get_circuit_from_result diff --git a/qiskit_ibm_transpiler/wrappers/ai_api_routing.py b/qiskit_ibm_transpiler/wrappers/ai_api_routing.py index f40d112..e3a56b3 100644 --- a/qiskit_ibm_transpiler/wrappers/ai_api_routing.py +++ b/qiskit_ibm_transpiler/wrappers/ai_api_routing.py @@ -10,17 +10,19 @@ # copyright notice, and modified files need to carry a notice indicating # that they have been altered from the originals. +from typing import List, Literal, Union + from qiskit import QuantumCircuit +from qiskit.transpiler import CouplingMap + from qiskit_ibm_transpiler.utils import ( deserialize_circuit_from_qpy_or_qasm, get_circuit_from_qpy, get_qpy_from_circuit, serialize_circuit_to_qpy_or_qasm, ) -from .base import QiskitTranspilerService -from typing import List, Union, Literal -from qiskit.transpiler import CouplingMap +from .base import QiskitTranspilerService # TODO: Reuse this code, it's repeated several times OptimizationOptions = Literal["n_cnots", "n_gates", "cnot_layers", "layers", "noise"] diff --git a/qiskit_ibm_transpiler/wrappers/ai_api_synthesis.py b/qiskit_ibm_transpiler/wrappers/ai_api_synthesis.py index ef52ddc..cbcde6f 100644 --- a/qiskit_ibm_transpiler/wrappers/ai_api_synthesis.py +++ b/qiskit_ibm_transpiler/wrappers/ai_api_synthesis.py @@ -11,18 +11,18 @@ # that they have been altered from the originals. import logging -from typing import Union, List +from typing import List, Union from qiskit import QuantumCircuit from qiskit.circuit.library import LinearFunction -from qiskit.quantum_info import Clifford from qiskit.providers.backend import BackendV2 as Backend +from qiskit.quantum_info import Clifford -from .base import QiskitTranspilerService from ..utils import ( - serialize_circuits_to_qpy_or_qasm, deserialize_circuit_from_qpy_or_qasm, + serialize_circuits_to_qpy_or_qasm, ) +from .base import QiskitTranspilerService logger = logging.getLogger(__name__) logger.setLevel(logging.INFO) diff --git a/qiskit_ibm_transpiler/wrappers/ai_local_routing.py b/qiskit_ibm_transpiler/wrappers/ai_local_routing.py index 94678d3..0a716ec 100644 --- a/qiskit_ibm_transpiler/wrappers/ai_local_routing.py +++ b/qiskit_ibm_transpiler/wrappers/ai_local_routing.py @@ -11,11 +11,13 @@ # that they have been altered from the originals. import importlib +from typing import List, Literal, Union + from qiskit import QuantumCircuit -from qiskit_ibm_transpiler.utils import get_circuit_from_qasm, input_to_qasm -from typing import List, Union, Literal from qiskit.transpiler import CouplingMap +from qiskit_ibm_transpiler.utils import get_circuit_from_qasm, input_to_qasm + ai_local_package = "qiskit_ibm_ai_local_transpiler" qiskit_ibm_ai_local_transpiler = ( importlib.import_module(ai_local_package) diff --git a/qiskit_ibm_transpiler/wrappers/ai_local_synthesis.py b/qiskit_ibm_transpiler/wrappers/ai_local_synthesis.py index 9dd5b67..5741383 100644 --- a/qiskit_ibm_transpiler/wrappers/ai_local_synthesis.py +++ b/qiskit_ibm_transpiler/wrappers/ai_local_synthesis.py @@ -12,6 +12,7 @@ import importlib import logging + import networkx as nx from networkx.exception import NetworkXError @@ -70,14 +71,14 @@ "CLIFFORD_COUPLING_MAPS_BY_HASHES_DICT not found", ) -from typing import Union, List +from typing import List, Union import numpy as np from qiskit import QuantumCircuit -from qiskit.transpiler import CouplingMap from qiskit.circuit.library import LinearFunction -from qiskit.quantum_info import Clifford from qiskit.providers.backend import BackendV2 as Backend +from qiskit.quantum_info import Clifford +from qiskit.transpiler import CouplingMap logger = logging.getLogger(__name__) logger.setLevel(logging.INFO) diff --git a/qiskit_ibm_transpiler/wrappers/transpile.py b/qiskit_ibm_transpiler/wrappers/transpile.py index 76e63e4..c830404 100644 --- a/qiskit_ibm_transpiler/wrappers/transpile.py +++ b/qiskit_ibm_transpiler/wrappers/transpile.py @@ -11,13 +11,14 @@ # that they have been altered from the originals. import logging -from typing import Dict, List, Union, Literal +from typing import Dict, List, Literal, Union import numpy as np from qiskit import QuantumCircuit, QuantumRegister from qiskit.circuit import QuantumCircuit, QuantumRegister, Qubit from qiskit.transpiler import TranspileLayout from qiskit.transpiler.layout import Layout + from qiskit_ibm_transpiler.utils import ( deserialize_circuit_from_qpy_or_qasm, get_circuit_from_qpy, diff --git a/qiskit_transpiler_service/__init__.py b/qiskit_transpiler_service/__init__.py index 172df09..398796f 100644 --- a/qiskit_transpiler_service/__init__.py +++ b/qiskit_transpiler_service/__init__.py @@ -10,11 +10,12 @@ # copyright notice, and modified files need to carry a notice indicating # that they have been altered from the originals. +import logging + from qiskit_ibm_transpiler.ai import AIRouting -from .transpiler_service import TranspilerService from qiskit_ibm_transpiler.utils import create_random_linear_function, get_metrics -import logging +from .transpiler_service import TranspilerService logging.basicConfig() logging.getLogger(__name__).addHandler(logging.NullHandler()) diff --git a/qiskit_transpiler_service/transpiler_service.py b/qiskit_transpiler_service/transpiler_service.py index 0f35f03..dc30265 100644 --- a/qiskit_transpiler_service/transpiler_service.py +++ b/qiskit_transpiler_service/transpiler_service.py @@ -27,7 +27,7 @@ """ import logging -from typing import Dict, List, Union, Literal +from typing import Dict, List, Literal, Union from qiskit_ibm_transpiler import TranspilerService as NewTranspilerService diff --git a/scripts/concat_release_notes.py b/scripts/concat_release_notes.py index c5fd72a..8653286 100644 --- a/scripts/concat_release_notes.py +++ b/scripts/concat_release_notes.py @@ -1,6 +1,7 @@ -from packaging import version from pathlib import Path +from packaging import version + def get_root_path() -> Path: return Path(__file__).resolve().parent.parent diff --git a/tests/conftest.py b/tests/conftest.py index 75d45a8..398aaa9 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -13,25 +13,23 @@ """Fixtures used on the tests""" import logging -import pytest +import pytest from qiskit import QuantumCircuit from qiskit.circuit.library import QuantumVolume +from qiskit_ibm_runtime import QiskitRuntimeService from qiskit_ibm_transpiler.utils import ( create_random_linear_function, - random_clifford_from_linear_function, get_qpy_from_circuit, + random_clifford_from_linear_function, ) - from tests.utils import create_random_circuit_with_several_operators -from qiskit_ibm_runtime import QiskitRuntimeService - @pytest.fixture(autouse=True) def env_set(monkeypatch, request): - if not "disable_monkeypatch" in request.keywords: + if "disable_monkeypatch" not in request.keywords: monkeypatch.setenv( "QISKIT_IBM_TRANSPILER_PERMUTATIONS_URL", "https://cloud-transpiler-experimental.quantum-computing.ibm.com/permutations", diff --git a/tests/parametrize_functions.py b/tests/parametrize_functions.py index 3f3eb07..4dd973e 100644 --- a/tests/parametrize_functions.py +++ b/tests/parametrize_functions.py @@ -13,21 +13,19 @@ """Parametrize functions""" import pytest - from qiskit.transpiler.exceptions import TranspilerError from qiskit_ibm_transpiler.ai.collection import ( - CollectPermutations, - CollectLinearFunctions, CollectCliffords, + CollectLinearFunctions, CollectPauliNetworks, + CollectPermutations, ) - from qiskit_ibm_transpiler.ai.synthesis import ( - AIPermutationSynthesis, - AILinearFunctionSynthesis, AICliffordSynthesis, + AILinearFunctionSynthesis, AIPauliNetworkSynthesis, + AIPermutationSynthesis, ) diff --git a/tests/test_ai_passmanager.py b/tests/test_ai_passmanager.py index 9884229..5e4fbfe 100644 --- a/tests/test_ai_passmanager.py +++ b/tests/test_ai_passmanager.py @@ -14,15 +14,14 @@ from qiskit import QuantumCircuit from qiskit.circuit.library import EfficientSU2 -from qiskit_ibm_transpiler import generate_ai_pass_manager - +from qiskit_ibm_transpiler import generate_ai_pass_manager from tests.parametrize_functions import ( - parametrize_valid_optimization_level, - parametrize_valid_ai_optimization_level, + parametrize_ai_layout_mode, parametrize_include_ai_synthesis, parametrize_qiskit_transpile_options, - parametrize_ai_layout_mode, + parametrize_valid_ai_optimization_level, + parametrize_valid_optimization_level, ) diff --git a/tests/test_ai_routing_pass.py b/tests/test_ai_routing_pass.py index c0a3843..7b8717d 100644 --- a/tests/test_ai_routing_pass.py +++ b/tests/test_ai_routing_pass.py @@ -13,23 +13,21 @@ """Tests for the ai routing pass""" import pytest - from qiskit import QuantumCircuit from qiskit.transpiler import PassManager from qiskit.transpiler.exceptions import TranspilerError from qiskit_ibm_transpiler.ai.routing import AIRouting - from tests.parametrize_functions import ( - parametrize_local_mode, parametrize_coupling_map_format, - parametrize_non_valid_optimization_preferences, - parametrize_valid_optimization_preferences, + parametrize_local_mode, parametrize_local_mode_and_error_type, - parametrize_non_valid_optimization_level, - parametrize_valid_optimization_level, parametrize_non_valid_layout_mode, + parametrize_non_valid_optimization_level, + parametrize_non_valid_optimization_preferences, parametrize_valid_layout_mode, + parametrize_valid_optimization_level, + parametrize_valid_optimization_preferences, ) diff --git a/tests/test_ai_synthesis_pass.py b/tests/test_ai_synthesis_pass.py index 21047b9..ec7893d 100644 --- a/tests/test_ai_synthesis_pass.py +++ b/tests/test_ai_synthesis_pass.py @@ -13,7 +13,6 @@ """Tests for the ai synthesis pass""" import pytest - from qiskit import QuantumCircuit from qiskit.transpiler import PassManager @@ -21,12 +20,11 @@ CollectPauliNetworks, CollectPermutations, ) - from tests.parametrize_functions import ( parametrize_basic_circuit_collector_pass_and_ai_synthesis_pass, parametrize_complex_circuit_collector_pass_and_ai_synthesis_pass, - parametrize_local_mode, parametrize_coupling_map_format, + parametrize_local_mode, ) diff --git a/tests/test_collection_pass.py b/tests/test_collection_pass.py index 3c67811..34f7ad4 100644 --- a/tests/test_collection_pass.py +++ b/tests/test_collection_pass.py @@ -13,21 +13,19 @@ """Tests for the collector pass""" import pytest - from qiskit import QuantumCircuit from qiskit.transpiler import PassManager from qiskit.transpiler.preset_passmanagers import generate_preset_pass_manager from qiskit_ibm_transpiler.ai.collection import CollectPermutations - -from tests.utils import create_linear_circuit from tests.parametrize_functions import ( parametrize_circuit_collector_pass_and_operator_name, - parametrize_collectable_gates_collector_pass_operation_name, parametrize_collectable_gates_and_collector_pass, - parametrize_non_collectable_gates_collector_pass_operation_name, + parametrize_collectable_gates_collector_pass_operation_name, parametrize_n_qubits, + parametrize_non_collectable_gates_collector_pass_operation_name, ) +from tests.utils import create_linear_circuit @parametrize_circuit_collector_pass_and_operator_name() diff --git a/tests/test_transpiler_service.py b/tests/test_transpiler_service.py index eb612f6..6135d2e 100644 --- a/tests/test_transpiler_service.py +++ b/tests/test_transpiler_service.py @@ -17,18 +17,17 @@ from qiskit import QuantumCircuit, qasm2, qasm3 from qiskit.circuit.library import ( IQP, - EfficientSU2, ECRGate, + EfficientSU2, ZZFeatureMap, ) from qiskit.circuit.random import random_circuit from qiskit.compiler import transpile -from qiskit.quantum_info import SparsePauliOp, random_hermitian from qiskit.providers.fake_provider import GenericBackendV2 +from qiskit.quantum_info import SparsePauliOp, random_hermitian from qiskit.transpiler.exceptions import TranspilerError from qiskit_ibm_transpiler.transpiler_service import TranspilerService -from qiskit_ibm_transpiler.wrappers import _get_circuit_from_result from qiskit_ibm_transpiler.utils import ( get_circuit_from_qasm, get_circuit_from_qpy, @@ -36,14 +35,14 @@ input_to_qasm, to_qasm3_iterative_decomposition, ) - +from qiskit_ibm_transpiler.wrappers import _get_circuit_from_result from tests.parametrize_functions import ( - parametrize_valid_optimization_level, parametrize_ai, - parametrize_qiskit_transpile_options, parametrize_non_valid_use_fractional_gates, - parametrize_valid_use_fractional_gates, + parametrize_qiskit_transpile_options, + parametrize_valid_optimization_level, parametrize_valid_optimization_preferences_without_noise, + parametrize_valid_use_fractional_gates, ) diff --git a/tests/test_transpiler_service_deprecated_package.py b/tests/test_transpiler_service_deprecated_package.py index c22c934..4f626ed 100644 --- a/tests/test_transpiler_service_deprecated_package.py +++ b/tests/test_transpiler_service_deprecated_package.py @@ -12,13 +12,14 @@ """Unit-testing Transpiler Service""" -import pytest from warnings import catch_warnings + +import pytest from qiskit import QuantumCircuit from qiskit.circuit.library import IQP, EfficientSU2, QuantumVolume from qiskit.circuit.random import random_circuit -from qiskit_ibm_transpiler.utils import get_circuit_from_qpy, get_qpy_from_circuit +from qiskit_ibm_transpiler.utils import get_circuit_from_qpy, get_qpy_from_circuit from qiskit_transpiler_service.transpiler_service import TranspilerService diff --git a/tests/utils.py b/tests/utils.py index 392ad36..e9362a4 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -12,7 +12,6 @@ """Functions used on the tests""" import numpy as np - from qiskit import QuantumCircuit from qiskit.circuit.library import Permutation from qiskit.quantum_info import random_clifford, random_pauli diff --git a/tools/verify_images.py b/tools/verify_images.py index 98fb8f0..8f2c108 100644 --- a/tools/verify_images.py +++ b/tools/verify_images.py @@ -13,10 +13,10 @@ """Utility script to verify that all images have alt text""" -from pathlib import Path +import glob import multiprocessing import sys -import glob +from pathlib import Path # List of allowlist files that the checker will not verify ALLOWLIST_MISSING_ALT_TEXT = []