Skip to content

Commit f6a332d

Browse files
committed
Linter fixes
1 parent 68681f8 commit f6a332d

File tree

3 files changed

+26
-21
lines changed

3 files changed

+26
-21
lines changed

netqasm/lang/instr/flavour.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from dataclasses import dataclass
33
from typing import Dict, List, Optional, Type
44

5-
from . import NetQASMInstruction, core, nv, trapped_ion, vanilla, trapped_ion_individual
5+
from . import NetQASMInstruction, core, nv, trapped_ion, trapped_ion_individual, vanilla
66

77

88
@dataclass
@@ -154,4 +154,4 @@ def instrs(self):
154154
]
155155

156156
def __init__(self):
157-
super().__init__(self.instrs)
157+
super().__init__(self.instrs)

netqasm/lang/instr/trapped_ion_individual.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@
33

44
import numpy as np
55

6-
from netqasm.lang.operand import Immediate, Operand, Register, Template
6+
from netqasm.lang.operand import Operand
77
from netqasm.util.quantum_gates import get_rotation_matrix
88

9-
from . import base, core
10-
9+
from . import core
1110

1211

1312
@dataclass
@@ -59,4 +58,4 @@ def to_matrix(self):
5958
def to_matrix_target_only(self):
6059
# NOTE: The MS instruction acts on both qubits
6160
# Therefore, it is OK to not explicitly define a matrix.
62-
return None # type: ignore
61+
return None # type: ignore

netqasm/sdk/transpile.py

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,14 @@
88
import abc
99
from typing import Dict, List, Optional, Set, Tuple, Union
1010

11-
from netqasm.lang.instr import DebugInstruction, NetQASMInstruction, core, nv, vanilla, trapped_ion_individual
11+
from netqasm.lang.instr import (
12+
DebugInstruction,
13+
NetQASMInstruction,
14+
core,
15+
nv,
16+
trapped_ion_individual,
17+
vanilla,
18+
)
1219
from netqasm.lang.instr.flavour import REIDSFlavour
1320
from netqasm.lang.operand import Immediate, Register, RegisterName
1421
from netqasm.lang.subroutine import Subroutine
@@ -805,26 +812,25 @@ def _transpile_two_qubit_gate(self, instr: core.TwoQubitInstruction):
805812
# TODO Different implementation per CNOT or CPHASE or MOV
806813
if isinstance(instr, vanilla.CnotInstruction):
807814
return [
808-
trapped_ion_individual.RotXInstruction(
809-
lineno=instr.lineno,
810-
reg=instr.reg0,
811-
imm0=Immediate(24),
812-
imm1=Immediate(4)),
813-
814-
trapped_ion_individual.MSGateInstruction(
815-
lineno=instr.lineno,
816-
reg0=instr.reg0,
817-
reg1=instr.reg1,
818-
)] # TODO This is just a draft, not acually the proper CNOT transpile
815+
trapped_ion_individual.RotXInstruction(
816+
lineno=instr.lineno,
817+
reg=instr.reg0,
818+
imm0=Immediate(24),
819+
imm1=Immediate(4),
820+
),
821+
trapped_ion_individual.MSGateInstruction(
822+
lineno=instr.lineno,
823+
reg0=instr.reg0,
824+
reg1=instr.reg1,
825+
),
826+
] # TODO This is just a draft, not acually the proper CNOT transpile
819827
elif isinstance(instr, vanilla.CphaseInstruction):
820828
return [] # TODO add instructions
821829
elif isinstance(instr, vanilla.MovInstruction):
822830
return [] # TODO add instructions
823831
else:
824832
raise KeyError("")
825833

826-
827-
828834
def _handle_single_qubit_gate(
829835
self,
830836
instr: Union[core.SingleQubitInstruction, core.RotationInstruction],
@@ -979,4 +985,4 @@ def _map_single_gate(
979985
else:
980986
raise ValueError(
981987
f"Don't know how to map instruction {instr} of type {type(instr)}"
982-
)
988+
)

0 commit comments

Comments
 (0)