Skip to content

Commit

Permalink
Fixes for mypy.
Browse files Browse the repository at this point in the history
  • Loading branch information
cqc-alec committed Feb 6, 2025
1 parent c7f2dd6 commit ff76dca
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions pytket/extensions/iqm/backends/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ class IQMConfig(PytketExtConfig):
api_token: Optional[str]

@classmethod
def from_extension_dict(
def from_extension_dict( # type: ignore
cls: Type["IQMConfig"], ext_dict: Dict[str, Any]
) -> "IQMConfig":
return cls(ext_dict.get("api_token"))


def set_iqm_config(api_token: Optional[str] = None) -> None:
"""Set default value for IQM API token."""
config = IQMConfig.from_default_config_file()
config: IQMConfig = IQMConfig.from_default_config_file()
if api_token is not None:
config.api_token = api_token
config.update_default_config_file()
8 changes: 4 additions & 4 deletions pytket/extensions/iqm/backends/iqm.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def __init__(
:param api_token: API token
"""
super().__init__()
config = IQMConfig.from_default_config_file()
config: IQMConfig = IQMConfig.from_default_config_file()

if api_token is None:
api_token = config.api_token
Expand Down Expand Up @@ -357,22 +357,22 @@ def _translate_iqm(circ: Circuit) -> Tuple[Instruction, ...]:
optype = op.type
params = op.params
if optype == OpType.PhasedX:
instr = Instruction(
instr = Instruction( # type: ignore
name="prx",
implementation=None,
qubits=(str(qbs[0]),),
args={"angle_t": 0.5 * params[0], "phase_t": 0.5 * params[1]},
)
elif optype == OpType.CZ:
instr = Instruction(
instr = Instruction( # type: ignore
name="cz",
implementation=None,
qubits=(str(qbs[0]), str(qbs[1])),
args={},
)
else:
assert optype == OpType.Measure
instr = Instruction(
instr = Instruction( # type: ignore
name="measure",
implementation=None,
qubits=(str(qbs[0]),),
Expand Down

0 comments on commit ff76dca

Please sign in to comment.