From 0ddce339c826f54c026acb82fce4cde71e9d4f99 Mon Sep 17 00:00:00 2001 From: Dan Mills <52407433+daniel-mills-cqc@users.noreply.github.com> Date: Sun, 8 Dec 2024 16:06:22 +0000 Subject: [PATCH 1/2] Fix typing --- .github/workflows/build_and_test.yml | 2 +- tests/ccl_test.py | 14 +++++----- tests/cdr_test.py | 8 +++--- tests/dfsc_test.py | 16 ++++++------ tests/frame_randomisation_test.py | 6 ++--- tests/full_spam_test.py | 8 +++--- tests/measurement_reduction_test.py | 12 ++++----- tests/mitex_test.py | 10 +++---- tests/mitres_test.py | 6 ++--- tests/noise_model_test.py | 39 ++++++++++++++-------------- tests/pec_test.py | 16 ++++++------ tests/spam_methods_test.py | 10 +++---- tests/spectral_filtering_test.py | 4 +-- tests/taskgraph_test.py | 4 +-- tests/tomography_test.py | 6 ++--- tests/utils_test.py | 28 ++++++++++---------- tests/zne_test.py | 24 ++++++++--------- 17 files changed, 107 insertions(+), 106 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index f02b7981..7ac280b7 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -91,7 +91,7 @@ jobs: pip install .[tests] cd tests - name: Run mypy - run: mypy -p qermit --warn-unused-ignores + run: mypy -p qermit tests --warn-unused-ignores - name: Linting check run: ruff check - name: Format check diff --git a/tests/ccl_test.py b/tests/ccl_test.py index e9586cae..1d15f626 100644 --- a/tests/ccl_test.py +++ b/tests/ccl_test.py @@ -12,24 +12,24 @@ # See the License for the specific language governing permissions and # limitations under the License. -import numpy as np # type: ignore +import numpy as np from pytket import Circuit, OpType, Qubit -from pytket.extensions.qiskit import AerBackend # type: ignore -from pytket.pauli import Pauli, QubitPauliString # type: ignore -from pytket.predicates import CliffordCircuitPredicate # type: ignore +from pytket.extensions.qiskit import AerBackend +from pytket.pauli import Pauli, QubitPauliString +from pytket.predicates import CliffordCircuitPredicate from pytket.utils import QubitPauliOperator -from qermit import ( # type: ignore +from qermit import ( AnsatzCircuit, MitEx, ObservableExperiment, ObservableTracker, SymbolsDict, ) -from qermit.clifford_noise_characterisation import ( # type: ignore +from qermit.clifford_noise_characterisation import ( gen_CDR_MitEx, ) -from qermit.clifford_noise_characterisation.ccl import ( # type: ignore +from qermit.clifford_noise_characterisation.ccl import ( ccl_likelihood_filtering_task_gen, ccl_result_batching_task_gen, ccl_state_task_gen, diff --git a/tests/cdr_test.py b/tests/cdr_test.py index fe6da0c1..d38f7546 100644 --- a/tests/cdr_test.py +++ b/tests/cdr_test.py @@ -15,13 +15,13 @@ from typing import cast -import numpy as np # type: ignore +import numpy as np from pytket import Qubit -from pytket.extensions.qiskit import AerBackend # type: ignore -from pytket.pauli import Pauli, QubitPauliString # type: ignore +from pytket.extensions.qiskit import AerBackend +from pytket.pauli import Pauli, QubitPauliString from pytket.utils import QubitPauliOperator -from qermit.clifford_noise_characterisation.cdr_post import ( # type: ignore +from qermit.clifford_noise_characterisation.cdr_post import ( _PolyCDRCorrect, cdr_calibration_task_gen, cdr_correction_task_gen, diff --git a/tests/dfsc_test.py b/tests/dfsc_test.py index 0821cdf3..2991da5f 100644 --- a/tests/dfsc_test.py +++ b/tests/dfsc_test.py @@ -16,23 +16,23 @@ import copy from pytket import Circuit, Qubit -from pytket.circuit import fresh_symbol # type: ignore -from pytket.extensions.qiskit import AerBackend # type: ignore -from pytket.pauli import Pauli, QubitPauliString # type: ignore -from pytket.transform import Transform # type: ignore +from pytket.circuit import fresh_symbol +from pytket.extensions.qiskit import AerBackend +from pytket.pauli import Pauli, QubitPauliString +from pytket.transform import Transform from pytket.utils import QubitPauliOperator -from qermit import ( # type: ignore +from qermit import ( MeasurementCircuit, MitEx, ObservableExperiment, ObservableTracker, SymbolsDict, ) -from qermit.clifford_noise_characterisation import ( # type: ignore +from qermit.clifford_noise_characterisation import ( gen_DFSC_MitEx, ) -from qermit.clifford_noise_characterisation.dfsc import ( # type: ignore +from qermit.clifford_noise_characterisation.dfsc import ( DFSC_characterisation_task_gen, DFSC_circuit_task_gen, DFSC_collater_task_gen, @@ -40,7 +40,7 @@ get_clifford_mcs, preparation_circuit_for_partition, ) -from qermit.taskgraph.mitex import get_basic_measurement_circuit # type: ignore +from qermit.taskgraph.mitex import get_basic_measurement_circuit sym_0 = fresh_symbol("alpha") sym_1 = fresh_symbol("beta") diff --git a/tests/frame_randomisation_test.py b/tests/frame_randomisation_test.py index 6db21f1f..96421e2a 100644 --- a/tests/frame_randomisation_test.py +++ b/tests/frame_randomisation_test.py @@ -14,13 +14,13 @@ from pytket import Circuit -from pytket.extensions.qiskit import AerBackend # type: ignore +from pytket.extensions.qiskit import AerBackend -from qermit.frame_randomisation import ( # type: ignore +from qermit.frame_randomisation import ( FrameRandomisation, gen_Frame_Randomisation_MitRes, ) -from qermit.frame_randomisation.frame_randomisation import ( # type: ignore +from qermit.frame_randomisation.frame_randomisation import ( frame_randomisation_circuits_task_gen, ) diff --git a/tests/full_spam_test.py b/tests/full_spam_test.py index ac28afd6..fb17db12 100644 --- a/tests/full_spam_test.py +++ b/tests/full_spam_test.py @@ -13,14 +13,14 @@ # limitations under the License. -import numpy as np # type: ignore +import numpy as np from pytket import Bit, Circuit, Qubit -from pytket.extensions.qiskit import AerBackend # type: ignore +from pytket.extensions.qiskit import AerBackend -from qermit.spam import ( # type: ignore +from qermit.spam import ( CorrectionMethod, ) -from qermit.spam.full_spam_correction import ( # type: ignore +from qermit.spam.full_spam_correction import ( gen_full_tomography_spam_characterisation_task, gen_full_tomography_spam_circuits_task, gen_full_tomography_spam_correction_task, diff --git a/tests/measurement_reduction_test.py b/tests/measurement_reduction_test.py index 006c2ea3..1761d522 100644 --- a/tests/measurement_reduction_test.py +++ b/tests/measurement_reduction_test.py @@ -14,20 +14,20 @@ from pytket import Bit, Circuit, Qubit -from pytket.extensions.qiskit import AerBackend # type: ignore -from pytket.partition import ( # type: ignore +from pytket.extensions.qiskit import AerBackend +from pytket.partition import ( GraphColourMethod, PauliPartitionStrat, ) -from pytket.pauli import Pauli, QubitPauliString # type: ignore -from pytket.transform import CXConfigType # type: ignore +from pytket.pauli import Pauli, QubitPauliString +from pytket.transform import CXConfigType from pytket.utils import QubitPauliOperator -from qermit import ( # type: ignore +from qermit import ( ObservableTracker, SymbolsDict, ) -from qermit.taskgraph.measurement_reduction import ( # type: ignore +from qermit.taskgraph.measurement_reduction import ( gen_MeasurementReduction_MitEx, measurement_reduction_task_gen, ) diff --git a/tests/mitex_test.py b/tests/mitex_test.py index 7480c614..ff59a8e6 100644 --- a/tests/mitex_test.py +++ b/tests/mitex_test.py @@ -16,12 +16,12 @@ import copy import pytest -from pytket.circuit import Circuit, OpType, Qubit, fresh_symbol # type: ignore -from pytket.extensions.qiskit import AerBackend # type: ignore -from pytket.pauli import Pauli, QubitPauliString # type: ignore +from pytket.circuit import Circuit, OpType, Qubit, fresh_symbol +from pytket.extensions.qiskit import AerBackend +from pytket.pauli import Pauli, QubitPauliString from pytket.utils import QubitPauliOperator -from qermit import ( # type: ignore +from qermit import ( AnsatzCircuit, CircuitShots, MitEx, @@ -29,7 +29,7 @@ ObservableTracker, SymbolsDict, ) -from qermit.taskgraph.mitex import ( # type: ignore +from qermit.taskgraph.mitex import ( collate_circuit_shots_task_gen, filter_observable_tracker_task_gen, gen_compiled_shot_split_MitRes, diff --git a/tests/mitres_test.py b/tests/mitres_test.py index a2194ab1..bb5009b8 100644 --- a/tests/mitres_test.py +++ b/tests/mitres_test.py @@ -14,13 +14,13 @@ from pytket import Circuit -from pytket.extensions.qiskit import AerBackend # type: ignore +from pytket.extensions.qiskit import AerBackend -from qermit import ( # type: ignore +from qermit import ( CircuitShots, MitRes, ) -from qermit.taskgraph.mitres import ( # type: ignore +from qermit.taskgraph.mitres import ( backend_handle_task_gen, backend_res_task_gen, gen_shot_split_MitRes, diff --git a/tests/noise_model_test.py b/tests/noise_model_test.py index baf66689..517ab6fe 100644 --- a/tests/noise_model_test.py +++ b/tests/noise_model_test.py @@ -57,7 +57,7 @@ def test_to_ptm() -> None: def test_from_ptm() -> None: # Test that the error distribution to and from ptm is the same as the initial - distribution = { + distribution: dict[tuple[Pauli, ...], float] = { (Pauli.X, Pauli.X): 0.1, (Pauli.Y, Pauli.Z): 0.2, (Pauli.Z, Pauli.X): 0.3, @@ -150,7 +150,7 @@ def test_qermit_pauli_commute_coeff() -> None: def test_noise_model_logical_error_propagation() -> None: pytket_ciruit = Circuit(2).H(0).CX(0, 1).measure_all() - error_distribution_dict = { + error_distribution_dict: dict[tuple[Pauli, ...], float] = { (Pauli.X, Pauli.I): 0.1, } error_distribution = ErrorDistribution( @@ -163,23 +163,23 @@ def test_noise_model_logical_error_propagation() -> None: pytket_ciruit, n_rand=10000 ) - ideal_error = QubitPauliString(map={Qubit(0): Pauli.Z, Qubit(1): Pauli.X}) - assert list(logical_distribution.distribution.keys()) == [ideal_error] - assert abs(logical_distribution.distribution[ideal_error] - 0.1) <= 0.01 + ideal_error_one = QubitPauliString(map={Qubit(0): Pauli.Z, Qubit(1): Pauli.X}) + assert list(logical_distribution.distribution.keys()) == [ideal_error_one] + assert abs(logical_distribution.distribution[ideal_error_one] - 0.1) <= 0.01 - logical_distribution = noise_model.counter_propagate( + error_counter = noise_model.counter_propagate( pytket_ciruit, n_counts=10000, direction=Direction.forward ) - ideal_error = QermitPauli.from_qubit_pauli_string( + ideal_error_two = QermitPauli.from_qubit_pauli_string( QubitPauliString(map={Qubit(0): Pauli.X, Qubit(1): Pauli.I}) ) - assert list(logical_distribution.keys()) == [ideal_error] - assert abs(logical_distribution[ideal_error] - 1000) <= 1 + assert list(error_counter.keys()) == [ideal_error_two] + assert abs(error_counter[ideal_error_two] - 1000) <= 1 def test_error_distribution_utilities(tmp_path_factory) -> None: # Test that the probabilities must be less than 1. - error_distribution_dict = {(Pauli.X, Pauli.I): 1.1} + error_distribution_dict: dict[tuple[Pauli, ...], float] = {(Pauli.X, Pauli.I): 1.1} with pytest.raises(Exception): error_distribution = ErrorDistribution( distribution=error_distribution_dict, @@ -290,12 +290,12 @@ def test_error_distribution_post_select() -> None: def test_to_dict(tmpdir_factory) -> None: - error_distribution_dict_zzmax = {} + error_distribution_dict_zzmax: dict[tuple[Pauli, ...], float] = {} error_distribution_dict_zzmax[(Pauli.X, Pauli.I)] = 0.0002 error_distribution_dict_zzmax[(Pauli.I, Pauli.X)] = 0.0002 error_distribution_dict_zzmax[(Pauli.I, Pauli.I)] = 0.9996 - error_distribution_dict_cz = {} + error_distribution_dict_cz: dict[tuple[Pauli, ...], float] = {} error_distribution_dict_cz[(Pauli.Z, Pauli.Z)] = 0.002 error_distribution_dict_cz[(Pauli.I, Pauli.Z)] = 0.002 error_distribution_dict_cz[(Pauli.I, Pauli.I)] = 0.996 @@ -339,7 +339,7 @@ def test_transpiler_backend() -> None: circuit.ZZMax(0, 1).ZZMax(1, 2) circuit.measure_all() - error_distribution_dict = {} + error_distribution_dict: dict[tuple[Pauli, ...], float] = {} error_distribution_dict[(Pauli.X, Pauli.I)] = 0.002 error_distribution_dict[(Pauli.I, Pauli.X)] = 0.002 @@ -363,14 +363,13 @@ def test_transpiler_backend() -> None: def test_pauli_error_transpile() -> None: error_distribution_dict = { - error: 0 for error in product([Pauli.I, Pauli.X, Pauli.Y, Pauli.Z], repeat=2) + error: 0.0 for error in product([Pauli.I, Pauli.X, Pauli.Y, Pauli.Z], repeat=2) } error_rate = 0.5 error_distribution_dict[(Pauli.X, Pauli.I)] = error_rate error_distribution_dict[(Pauli.I, Pauli.X)] = error_rate error_distribution_dict[(Pauli.I, Pauli.I)] = 1 - 2 * error_rate - # error_distribution_dict[(Pauli.I, Pauli.I)] = 1 - 2*error_rate error_distribution = ErrorDistribution( error_distribution_dict, rng=np.random.default_rng(seed=2) @@ -389,7 +388,7 @@ def test_pauli_error_transpile() -> None: def test_noise_model() -> None: mp.set_start_method("spawn", force=True) - error_distribution_dict = {} + error_distribution_dict: dict[tuple[Pauli, ...], float] = {} error_rate = 0.5 error_distribution_dict[(Pauli.X, Pauli.I)] = error_rate error_distribution_dict[(Pauli.I, Pauli.X)] = error_rate @@ -454,7 +453,7 @@ def test_back_propagate_random_error() -> None: qubit_list = cliff_circ.qubits error_rate = 0.5 - error_distribution_dict = {} + error_distribution_dict: dict[tuple[Pauli, ...], float] = {} error_distribution_dict[(Pauli.X, Pauli.I)] = error_rate error_distribution_dict[(Pauli.I, Pauli.X)] = error_rate error_distribution_dict[(Pauli.I, Pauli.I)] = 1 - 2 * error_rate @@ -483,7 +482,7 @@ def test_effective_error_distribution() -> None: qubits = cliff_circ.qubits error_rate = 0.5 - error_distribution_dict = {} + error_distribution_dict: dict[tuple[Pauli, ...], float] = {} error_distribution_dict[(Pauli.X, Pauli.I)] = error_rate error_distribution_dict[(Pauli.I, Pauli.X)] = error_rate @@ -493,13 +492,13 @@ def test_effective_error_distribution() -> None: ) noise_model = NoiseModel({OpType.CZ: error_distribution}) - error_distribution = noise_model.get_effective_pre_error_distribution( + logical_error_distribution = noise_model.get_effective_pre_error_distribution( cliff_circ, n_rand=10000 ) assert all( abs(count - 2500) < 100 - for count in error_distribution.pauli_error_counter.values() + for count in logical_error_distribution.pauli_error_counter.values() ) cliff_circ = Circuit() diff --git a/tests/pec_test.py b/tests/pec_test.py index 66592f24..8c858699 100644 --- a/tests/pec_test.py +++ b/tests/pec_test.py @@ -18,24 +18,24 @@ import pytest from pytket import Circuit, OpType, Qubit from pytket.extensions.qiskit import ( - AerBackend, # type: ignore - IBMQEmulatorBackend, # type: ignore + AerBackend, + IBMQEmulatorBackend, ) -from pytket.pauli import Pauli, QubitPauliString # type: ignore -from pytket.predicates import CliffordCircuitPredicate, GateSetPredicate # type: ignore +from pytket.pauli import Pauli, QubitPauliString +from pytket.predicates import CliffordCircuitPredicate, GateSetPredicate from pytket.utils import QubitPauliOperator -from qiskit_ibm_provider import IBMProvider +from qiskit_ibm_provider import IBMProvider # type: ignore -from qermit import ( # type: ignore +from qermit import ( AnsatzCircuit, ObservableExperiment, ObservableTracker, SymbolsDict, ) -from qermit.probabilistic_error_cancellation import ( # type: ignore +from qermit.probabilistic_error_cancellation import ( gen_PEC_learning_based_MitEx, ) -from qermit.probabilistic_error_cancellation.pec_learning_based import ( # type: ignore +from qermit.probabilistic_error_cancellation.pec_learning_based import ( collate_results_task_gen, gen_get_clifford_training_set, gen_get_noisy_circuits, diff --git a/tests/spam_methods_test.py b/tests/spam_methods_test.py index 315c8b60..d2646a5a 100644 --- a/tests/spam_methods_test.py +++ b/tests/spam_methods_test.py @@ -14,13 +14,13 @@ from pytket import Circuit, Qubit -from pytket.architecture import Architecture # type: ignore -from pytket.circuit import Node # type: ignore -from pytket.extensions.qiskit import AerBackend # type: ignore +from pytket.architecture import Architecture +from pytket.circuit import Node +from pytket.extensions.qiskit import AerBackend from qermit import CircuitShots -from qermit.noise_model import MockQuantinuumBackend # type: ignore -from qermit.spam import ( # type: ignore +from qermit.noise_model import MockQuantinuumBackend +from qermit.spam import ( CorrectionMethod, gen_FullyCorrelated_SPAM_MitRes, gen_UnCorrelated_SPAM_MitRes, diff --git a/tests/spectral_filtering_test.py b/tests/spectral_filtering_test.py index d8e9e858..1d83cef1 100644 --- a/tests/spectral_filtering_test.py +++ b/tests/spectral_filtering_test.py @@ -15,12 +15,12 @@ import math import numpy as np -import scipy.fft +import scipy.fft # type: ignore from pytket import Circuit, Qubit from pytket.extensions.qiskit import AerBackend from pytket.pauli import Pauli, QubitPauliString from pytket.utils import QubitPauliOperator -from sympy import Symbol +from sympy import Symbol # type: ignore from qermit import AnsatzCircuit, ObservableExperiment, ObservableTracker, SymbolsDict from qermit.spectral_filtering import SmallCoefficientSignalFilter diff --git a/tests/taskgraph_test.py b/tests/taskgraph_test.py index 4b8f0864..a7e5e014 100644 --- a/tests/taskgraph_test.py +++ b/tests/taskgraph_test.py @@ -16,11 +16,11 @@ import networkx as nx # type: ignore import pytest -from qermit import ( # type: ignore +from qermit import ( MitTask, TaskGraph, ) -from qermit.taskgraph import ( # type: ignore +from qermit.taskgraph import ( IOTask, duplicate_wire_task_gen, ) diff --git a/tests/tomography_test.py b/tests/tomography_test.py index 58d8535f..de663aad 100644 --- a/tests/tomography_test.py +++ b/tests/tomography_test.py @@ -13,12 +13,12 @@ # limitations under the License. -import numpy as np # type: ignore +import numpy as np import qiskit_aer.noise as noise # type: ignore from pytket import Bit, Circuit, Qubit -from pytket.extensions.qiskit import AerBackend # type: ignore +from pytket.extensions.qiskit import AerBackend -from qermit.spam.full_transition_tomography import ( # type: ignore +from qermit.spam.full_transition_tomography import ( CorrectionMethod, binary_to_int, calculate_correlation_matrices, diff --git a/tests/utils_test.py b/tests/utils_test.py index 437f5de4..655e3264 100644 --- a/tests/utils_test.py +++ b/tests/utils_test.py @@ -13,17 +13,19 @@ # limitations under the License. -import pytest # type: ignore -from pytket.circuit import Bit, Circuit, Qubit, fresh_symbol # type: ignore -from pytket.extensions.qiskit import AerBackend # type: ignore -from pytket.pauli import Pauli, QubitPauliString # type: ignore +import pytest +from pytket.circuit import Bit, Circuit, Qubit, fresh_symbol +from pytket.extensions.qiskit import AerBackend +from pytket.pauli import Pauli, QubitPauliString from pytket.utils import QubitPauliOperator +from typing import Any -from qermit import ( # type: ignore +from qermit import ( MeasurementCircuit, ObservableTracker, SymbolsDict, ) +import numpy as np # tests for SymbolsDict class in utils @@ -46,9 +48,9 @@ def test_SymbolsDict_circuit_constructor() -> None: def test_SymbolsDict_dict_constructor() -> None: - symbols_dict = dict() + symbols_dict: dict[Any, float | None] = dict() for i in range(4): - symbols_dict[fresh_symbol("a" + str(i))] = i + symbols_dict[fresh_symbol("a" + str(i))] = float(i) sd = SymbolsDict.symbols_from_dict(symbols_dict) assert sd._symbolic_map == symbols_dict @@ -89,14 +91,14 @@ def test_basic_MeasurementCircuit_constructor() -> None: def test_MeasurementCircuit_constructor() -> None: - symbols_dict = dict() + symbols_dict: dict[Any, float | None] = dict() test_circuit = Circuit(4) comparison_circuit = Circuit(4) for i in range(4): sym = fresh_symbol("d" + str(i)) test_circuit.Ry(sym, i) comparison_circuit.Ry(i, i) - symbols_dict[sym] = i + symbols_dict[sym] = float(i) sd = SymbolsDict.symbols_from_dict(symbols_dict) mc = MeasurementCircuit(test_circuit, sd) @@ -144,8 +146,8 @@ def test_ObservableTracker_measurement_circuits_methods() -> None: # make measurement circuits for addition circuit_0 = Circuit(5) circuit_1 = Circuit(5) - symbols_dict_0 = dict() - symbols_dict_1 = dict() + symbols_dict_0: dict[Any, float | None] = dict() + symbols_dict_1: dict[Any, float | None] = dict() for i in range(5): # new symbol @@ -157,8 +159,8 @@ def test_ObservableTracker_measurement_circuits_methods() -> None: circuit_1.Ry(sym_1, i) circuit_1.add_bit(Bit(i)) # update symbols dict - symbols_dict_0[sym_0] = i - symbols_dict_1[sym_1] = i + symbols_dict_0[sym_0] = float(i) + symbols_dict_1[sym_1] = float(i) circuit_0.H(Qubit(0)) circuit_0.Rx(0.5, Qubit(1)) diff --git a/tests/zne_test.py b/tests/zne_test.py index f526ec66..0bed8202 100644 --- a/tests/zne_test.py +++ b/tests/zne_test.py @@ -16,23 +16,23 @@ import multiprocessing as mp from itertools import product -import numpy as np # type: ignore +import numpy as np import pytest import qiskit_aer.noise as noise # type: ignore -from numpy.polynomial.polynomial import polyval # type: ignore +from numpy.polynomial.polynomial import polyval from pytket import Circuit, Qubit from pytket.circuit import ( CircBox, - Node, # type: ignore - OpType, # type: ignore + Node, + OpType, ) -from pytket.extensions.qiskit import AerBackend, IBMQEmulatorBackend # type: ignore -from pytket.pauli import Pauli, QubitPauliString # type: ignore -from pytket.predicates import GateSetPredicate # type: ignore +from pytket.extensions.qiskit import AerBackend, IBMQEmulatorBackend +from pytket.pauli import Pauli, QubitPauliString +from pytket.predicates import GateSetPredicate from pytket.utils import QubitPauliOperator -from qiskit_ibm_provider import IBMProvider +from qiskit_ibm_provider import IBMProvider # type: ignore -from qermit import ( # type: ignore # type: ignore +from qermit import ( AnsatzCircuit, ObservableExperiment, ObservableTracker, @@ -40,18 +40,18 @@ ) from qermit.noise_model import ( ErrorDistribution, - MockQuantinuumBackend, # type: ignore + MockQuantinuumBackend, NoiseModel, PauliErrorTranspile, TranspilerBackend, ) from qermit.taskgraph import gen_MeasurementReduction_MitEx -from qermit.zero_noise_extrapolation import ( # type: ignore +from qermit.zero_noise_extrapolation import ( Fit, Folding, gen_ZNE_MitEx, ) -from qermit.zero_noise_extrapolation.zne import ( # type: ignore +from qermit.zero_noise_extrapolation.zne import ( digital_folding_task_gen, extrapolation_task_gen, gen_duplication_task, From e3816cb76e4c31a1b326b4583e2cc9f4bbdcccfc Mon Sep 17 00:00:00 2001 From: Dan Mills <52407433+daniel-mills-cqc@users.noreply.github.com> Date: Sun, 8 Dec 2024 18:37:26 +0000 Subject: [PATCH 2/2] Correct mypy call in action --- .github/workflows/build_and_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 7ac280b7..529bb040 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -91,7 +91,7 @@ jobs: pip install .[tests] cd tests - name: Run mypy - run: mypy -p qermit tests --warn-unused-ignores + run: mypy qermit tests --warn-unused-ignores - name: Linting check run: ruff check - name: Format check