Skip to content

Handle Qiskit 1.0 removals #1363

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

Merged
merged 13 commits into from
Feb 5, 2024
8 changes: 2 additions & 6 deletions qiskit_ibm_runtime/estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import os
from typing import Optional, Dict, Sequence, Any, Union
import logging
import typing

from qiskit.circuit import QuantumCircuit
from qiskit.quantum_info.operators.base_operator import BaseOperator
Expand All @@ -31,9 +30,6 @@
# pylint: disable=unused-import,cyclic-import
from .session import Session

if typing.TYPE_CHECKING:
from qiskit.opflow import PauliSumOp

logger = logging.getLogger(__name__)


Expand Down Expand Up @@ -118,7 +114,7 @@ def __init__(
def run( # pylint: disable=arguments-differ
self,
circuits: QuantumCircuit | Sequence[QuantumCircuit],
observables: BaseOperator | PauliSumOp | Sequence[BaseOperator | PauliSumOp],
observables: BaseOperator | Sequence[BaseOperator],
parameter_values: Sequence[float] | Sequence[Sequence[float]] | None = None,
**kwargs: Any,
) -> RuntimeJob:
Expand Down Expand Up @@ -154,7 +150,7 @@ def run( # pylint: disable=arguments-differ
def _run( # pylint: disable=arguments-differ
self,
circuits: Sequence[QuantumCircuit],
observables: Sequence[BaseOperator | PauliSumOp],
observables: Sequence[BaseOperator],
parameter_values: Sequence[Sequence[float]],
**kwargs: Any,
) -> RuntimeJob:
Expand Down
3 changes: 1 addition & 2 deletions qiskit_ibm_runtime/transpiler/passes/scheduling/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@
from qiskit_ibm_runtime.transpiler.passes.scheduling import DynamicCircuitInstructionDurations
from qiskit_ibm_runtime.transpiler.passes.scheduling import ALAPScheduleAnalysis
from qiskit_ibm_runtime.transpiler.passes.scheduling import PadDelay
from qiskit.providers.fake_provider import FakeJakarta

from qiskit_ibm_runtime.fake_provider import FakeJakarta

backend = FakeJakarta()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,16 @@
from qiskit.circuit.reset import Reset
from qiskit.dagcircuit import DAGCircuit, DAGNode, DAGInNode, DAGOpNode
from qiskit.quantum_info.operators.predicates import matrix_equal
from qiskit.quantum_info.synthesis import OneQubitEulerDecomposer
from qiskit.transpiler.exceptions import TranspilerError
from qiskit.transpiler.instruction_durations import InstructionDurations
from qiskit.transpiler.passes.optimization import Optimize1qGates
from qiskit.transpiler import CouplingMap

try:
from qiskit.quantum_info.synthesis import OneQubitEulerDecomposer
except ImportError:
from qiskit.synthesis import OneQubitEulerDecomposer

from .block_base_padder import BlockBasePadder


Expand Down
8 changes: 0 additions & 8 deletions test/unit/test_data_serialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,21 +96,13 @@ def test_coder_qc(self):
def test_coder_operators(self):
"""Test runtime encoder and decoder for operators."""

# filter warnings triggered by opflow imports
with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=DeprecationWarning)
from qiskit.opflow import PauliSumOp # pylint: disable=import-outside-toplevel

deprecated_op = PauliSumOp(SparsePauliOp(Pauli("XYZX"), coeffs=[2]))

coeff_x = Parameter("x")
coeff_y = coeff_x + 1

subtests = (
SparsePauliOp(Pauli("XYZX"), coeffs=[2]),
SparsePauliOp(Pauli("XYZX"), coeffs=[coeff_y]),
SparsePauliOp(Pauli("XYZX"), coeffs=[1 + 2j]),
deprecated_op,
)

for operator in subtests:
Expand Down
36 changes: 0 additions & 36 deletions test/unit/transpiler/passes/scheduling/control_flow_test_case.py

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@
DynamicCircuitInstructionDurations,
)

from .control_flow_test_case import ControlFlowTestCase
from .....ibm_test_case import IBMTestCase

# pylint: disable=invalid-name,not-context-manager


@ddt
class TestPadDynamicalDecoupling(ControlFlowTestCase):
class TestPadDynamicalDecoupling(IBMTestCase):
"""Tests PadDynamicalDecoupling pass."""

def setUp(self):
Expand Down
6 changes: 3 additions & 3 deletions test/unit/transpiler/passes/scheduling/test_scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@
DynamicCircuitInstructionDurations,
)

from .control_flow_test_case import ControlFlowTestCase
from .....ibm_test_case import IBMTestCase

# pylint: disable=invalid-name,not-context-manager


class TestASAPSchedulingAndPaddingPass(ControlFlowTestCase):
class TestASAPSchedulingAndPaddingPass(IBMTestCase):
"""Tests the ASAP Scheduling passes"""

def test_if_test_gate_after_measure(self):
Expand Down Expand Up @@ -808,7 +808,7 @@ def test_c_if_plugin_conversion_with_transpile(self):
self.assertEqual(expected, scheduled)


class TestALAPSchedulingAndPaddingPass(ControlFlowTestCase):
class TestALAPSchedulingAndPaddingPass(IBMTestCase):
"""Tests the ALAP Scheduling passes"""

def test_alap(self):
Expand Down