Skip to content

Commit

Permalink
🎨 pre-commit fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] committed Nov 29, 2024
1 parent 3900ce1 commit 847a3d8
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 25 deletions.
12 changes: 6 additions & 6 deletions src/mqt/ddsim/deterministicnoisesimulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ def _default_options(cls) -> Options:
@staticmethod
def _run_experiment(qc: QuantumCircuit, **options: dict[str, Any]) -> ExperimentResult:
start_time = time.time()
noise_effects = cast(str, options.get("noise_effects", "APD"))
noise_probability = cast(float, options.get("noise_probability", 0.01))
amp_damping_probability = cast(float, options.get("amp_damping_probability", 0.02))
multi_qubit_gate_factor = cast(float, options.get("multi_qubit_gate_factor", 2))
seed = cast(int, options.get("simulator_seed", -1))
shots = cast(int, options.get("shots", 1024))
noise_effects = cast("str", options.get("noise_effects", "APD"))
noise_probability = cast("float", options.get("noise_probability", 0.01))
amp_damping_probability = cast("float", options.get("amp_damping_probability", 0.02))
multi_qubit_gate_factor = cast("float", options.get("multi_qubit_gate_factor", 2))
seed = cast("int", options.get("simulator_seed", -1))
shots = cast("int", options.get("shots", 1024))

sim = ddsim.DeterministicNoiseSimulator(
circ=qc,
Expand Down
2 changes: 1 addition & 1 deletion src/mqt/ddsim/pathqasmsimulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def get_simulation_path(
minimize="flops",
)
info = tn.contract(all, get="path-info", optimize=opt)
path = cast(list[tuple[int, int]], linear_to_ssa(info.path))
path = cast("list[tuple[int, int]]", linear_to_ssa(info.path))

if dump_path:
filename = qc.name + "_" + str(qc.num_qubits) + ".path" if isinstance(qc, QuantumCircuit) else "simulation.path"
Expand Down
6 changes: 3 additions & 3 deletions src/mqt/ddsim/primitives/estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,10 @@ def _run_experiment(
obs_circ_list: list[QuantumCircuit],
**options: dict[str, Any],
) -> list[float]:
approximation_step_fidelity = cast(float, options.get("approximation_step_fidelity", 1.0))
approximation_steps = cast(int, options.get("approximation_steps", 1))
approximation_step_fidelity = cast("float", options.get("approximation_step_fidelity", 1.0))
approximation_steps = cast("int", options.get("approximation_steps", 1))
approximation_strategy = str(options.get("approximation_strategy", "fidelity"))
seed = cast(int, options.get("seed_simulator", -1))
seed = cast("int", options.get("seed_simulator", -1))

sim = CircuitSimulator(
circ,
Expand Down
5 changes: 3 additions & 2 deletions src/mqt/ddsim/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

from typing import TYPE_CHECKING, Any, cast

from qiskit.providers import BackendV2
from qiskit.providers.exceptions import QiskitBackendNotFoundError
from qiskit.providers.providerutils import filter_backends

Expand All @@ -21,6 +20,8 @@
if TYPE_CHECKING:
from collections.abc import Callable

from qiskit.providers import BackendV2


class DDSIMProvider:
"""Provider for DDSIM backends."""
Expand Down Expand Up @@ -70,7 +71,7 @@ def backends(
backends = [
backend_cls() for backend_name, backend_cls in self._BACKENDS if name is None or backend_name == name
]
return cast(list[BackendV2], filter_backends(backends, filters=filters, **kwargs))
return cast("list[BackendV2]", filter_backends(backends, filters=filters, **kwargs))

def __str__(self) -> str:
"""Return the provider name."""
Expand Down
8 changes: 4 additions & 4 deletions src/mqt/ddsim/qasmsimulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,11 @@ def _run_job(

def _run_experiment(self, qc: QuantumCircuit, **options: dict[str, Any]) -> ExperimentResult:
start_time = time.time()
approximation_step_fidelity = cast(float, options.get("approximation_step_fidelity", 1.0))
approximation_steps = cast(int, options.get("approximation_steps", 1))
approximation_step_fidelity = cast("float", options.get("approximation_step_fidelity", 1.0))
approximation_steps = cast("int", options.get("approximation_steps", 1))
approximation_strategy = str(options.get("approximation_strategy", "fidelity"))
seed = cast(int, options.get("seed_simulator", -1))
shots = cast(int, options.get("shots", 1024))
seed = cast("int", options.get("seed_simulator", -1))
shots = cast("int", options.get("shots", 1024))

sim = CircuitSimulator(
qc,
Expand Down
18 changes: 9 additions & 9 deletions src/mqt/ddsim/stochasticnoisesimulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ def _default_options(cls) -> Options:
@staticmethod
def _run_experiment(qc: QuantumCircuit, **options: dict[str, Any]) -> ExperimentResult:
start_time = time.time()
approximation_step_fidelity = cast(float, options.get("approximation_step_fidelity", 1.0))
approximation_steps = cast(int, options.get("approximation_steps", 1))
approximation_strategy = cast(str, options.get("approximation_strategy", "fidelity"))
noise_effects = cast(str, options.get("noise_effects", "APD"))
noise_probability = cast(float, options.get("noise_probability", 0.01))
amp_damping_probability = cast(float, options.get("amp_damping_probability", 0.02))
multi_qubit_gate_factor = cast(float, options.get("multi_qubit_gate_factor", 2))
seed = cast(int, options.get("seed_simulator", -1))
shots = cast(int, options.get("shots", 1024))
approximation_step_fidelity = cast("float", options.get("approximation_step_fidelity", 1.0))
approximation_steps = cast("int", options.get("approximation_steps", 1))
approximation_strategy = cast("str", options.get("approximation_strategy", "fidelity"))
noise_effects = cast("str", options.get("noise_effects", "APD"))
noise_probability = cast("float", options.get("noise_probability", 0.01))
amp_damping_probability = cast("float", options.get("amp_damping_probability", 0.02))
multi_qubit_gate_factor = cast("float", options.get("multi_qubit_gate_factor", 2))
seed = cast("int", options.get("seed_simulator", -1))
shots = cast("int", options.get("shots", 1024))

sim = ddsim.StochasticNoiseSimulator(
circ=qc,
Expand Down

0 comments on commit 847a3d8

Please sign in to comment.