Skip to content

Commit

Permalink
⬆️🪝 update pre-commit hooks (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] authored Aug 12, 2024
1 parent 1943838 commit 10a75f9
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions src/mqt/qudits/quantum_circuit/circuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions src/mqt/qudits/quantum_circuit/qasm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -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 = []
Expand All @@ -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 = []
Expand Down
2 changes: 1 addition & 1 deletion src/mqt/qudits/simulation/backends/backendv2.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 .
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 .
Expand Down

0 comments on commit 10a75f9

Please sign in to comment.