diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f54d087..0788265 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -58,7 +58,7 @@ repos: # Python linting using ruff - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.5.5 + rev: v0.5.7 hooks: - id: ruff args: ["--fix", "--show-fixes"] @@ -68,7 +68,7 @@ repos: # Static type checking using mypy - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.11.0 + rev: v1.11.1 hooks: - id: mypy files: ^(src/mqt|test/python) diff --git a/src/mqt/qudits/compiler/state_compilation/state_preparation.py b/src/mqt/qudits/compiler/state_compilation/state_preparation.py index 346b500..45279a9 100644 --- a/src/mqt/qudits/compiler/state_compilation/state_preparation.py +++ b/src/mqt/qudits/compiler/state_compilation/state_preparation.py @@ -107,10 +107,10 @@ def retrieve_local_sequence(self, fweight, children): a, p = getAngles(coef[i + 1], coef[i]) gate = R(self.circuit, "R", qudit, [i, i + 1, a, p], self.circuit.dimensions[qudit], None).to_matrix() coef = np.dot(gate, coef) - aplog[(i, i + 1)] = (-a, p) + aplog[i, i + 1] = (-a, p) phase_2 = np.angle(find_complex_number(fweight, coef[0])) - aplog[(-1, 0)] = (-phase_2 * 2, 0) + aplog[-1, 0] = (-phase_2 * 2, 0) return aplog diff --git a/src/mqt/qudits/quantum_circuit/circuit.py b/src/mqt/qudits/quantum_circuit/circuit.py index 28bbde3..e158edf 100644 --- a/src/mqt/qudits/quantum_circuit/circuit.py +++ b/src/mqt/qudits/quantum_circuit/circuit.py @@ -139,7 +139,7 @@ def append(self, qreg: QuantumRegister) -> None: num_lines_stored = len(self._sitemap) for i in range(qreg.size): qreg.local_sitemap[i] = num_lines_stored + i - self._sitemap[(str(qreg.label), i)] = (num_lines_stored + i, qreg.dimensions[i]) + self._sitemap[str(qreg.label), i] = (num_lines_stored + i, qreg.dimensions[i]) self.inverse_sitemap[num_lines_stored + i] = (str(qreg.label), i) def append_classic(self, creg: ClassicRegister) -> None: @@ -149,7 +149,7 @@ def append_classic(self, creg: ClassicRegister) -> None: num_lines_stored = len(self._classic_site_map) for i in range(creg.size): creg.local_sitemap[i] = num_lines_stored + i - self._classic_site_map[(str(creg.label), i)] = (num_lines_stored + i,) + self._classic_site_map[str(creg.label), i] = (num_lines_stored + i,) self.cl_inverse_sitemap[num_lines_stored + i] = (str(creg.label), i) @add_gate_decorator diff --git a/src/mqt/qudits/quantum_circuit/qasm.py b/src/mqt/qudits/quantum_circuit/qasm.py index 119caff..53d1128 100644 --- a/src/mqt/qudits/quantum_circuit/qasm.py +++ b/src/mqt/qudits/quantum_circuit/qasm.py @@ -50,7 +50,7 @@ def parse_qreg(self, line, rgxs, sitemap) -> bool: qdims = [2] * nq for i in range(int(nq)): - sitemap[(str(name), i)] = len(sitemap), qdims[i] + sitemap[str(name), i] = len(sitemap), qdims[i] return True return False @@ -60,7 +60,7 @@ def parse_creg(self, line, rgxs, sitemap_classic) -> bool: if match: name, nclassics = match.groups() for i in range(int(nclassics)): - sitemap_classic[(str(name), i)] = len(sitemap_classic) + sitemap_classic[str(name), i] = len(sitemap_classic) return True return False @@ -100,7 +100,7 @@ def parse_gate(self, line, rgxs, sitemap, gates) -> bool: if match: name, reg_qudit_index = match.groups() reg_qudit_index = int(*re.search(r"\[(\d+)\]", reg_qudit_index).groups()) - qudit = tuple(sitemap[(name, reg_qudit_index)]) + qudit = tuple(sitemap[name, reg_qudit_index]) qudits_list.append(qudit) qudits_control_list = [] @@ -109,7 +109,7 @@ def parse_gate(self, line, rgxs, sitemap, gates) -> bool: for match in matches: name, reg_qudit_index = match reg_qudit_index = int(*re.search(r"\[(\d+)\]", reg_qudit_index).groups()) - qudit = tuple(sitemap[(name, reg_qudit_index)]) + qudit = tuple(sitemap[name, reg_qudit_index]) qudits_control_list.append(qudit[0]) qudits_levels_list = [] diff --git a/src/mqt/qudits/simulation/backends/backendv2.py b/src/mqt/qudits/simulation/backends/backendv2.py index b9dd6cd..a2ea347 100644 --- a/src/mqt/qudits/simulation/backends/backendv2.py +++ b/src/mqt/qudits/simulation/backends/backendv2.py @@ -63,7 +63,7 @@ def num_qudits(self) -> int: return self.target.num_qudits @property - def energy_level_graphs(self) -> list[(LevelGraph, LevelGraph)]: + def energy_level_graphs(self) -> list[LevelGraph, LevelGraph]: raise NotImplementedError def _default_options(self): diff --git a/src/mqt/qudits/simulation/backends/fake_backends/fake_traps2six.py b/src/mqt/qudits/simulation/backends/fake_backends/fake_traps2six.py index 6a90748..da21faa 100644 --- a/src/mqt/qudits/simulation/backends/fake_backends/fake_traps2six.py +++ b/src/mqt/qudits/simulation/backends/fake_backends/fake_traps2six.py @@ -47,7 +47,7 @@ def __init__( self._energy_level_graphs = None @property - def energy_level_graphs(self) -> list[(LevelGraph, LevelGraph)]: + def energy_level_graphs(self) -> list[LevelGraph, LevelGraph]: e_graphs = [] # declare the edges on the energy level graph between logic states . diff --git a/src/mqt/qudits/simulation/backends/fake_backends/fake_traps2three.py b/src/mqt/qudits/simulation/backends/fake_backends/fake_traps2three.py index 264892d..135ec2c 100644 --- a/src/mqt/qudits/simulation/backends/fake_backends/fake_traps2three.py +++ b/src/mqt/qudits/simulation/backends/fake_backends/fake_traps2three.py @@ -47,7 +47,7 @@ def __init__( self._energy_level_graphs = None @property - def energy_level_graphs(self) -> list[(LevelGraph, LevelGraph)]: + def energy_level_graphs(self) -> list[LevelGraph, LevelGraph]: e_graphs = [] # declare the edges on the energy level graph between logic states .