Skip to content

Commit f120996

Browse files
authored
Merge branch 'main' into CalMacCQ-patch-1
2 parents 297b715 + 5d4d069 commit f120996

File tree

3 files changed

+21
-15
lines changed

3 files changed

+21
-15
lines changed

docs/changelog.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@
44

55
# Changelog
66

7-
## 0.40.0rc0 (November 2024)
7+
## 0.40.0rc0 (Unreleased)
88

99
- Update pytket-qir version requirement to 0.17.
1010
- Updated pytket version requirement to 1.34.
1111
- Updated pytket-pecos version requirement to 0.1.31.
12+
- Allow circuits containing `OpType.ClExpr` operations.
1213

1314

1415
## 0.39.0 (November 2024)

pytket/extensions/quantinuum/backends/api_wrappers.py

+17-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import json
2323
import time
2424
from http import HTTPStatus
25-
from typing import Optional
25+
from typing import Any, Optional, cast
2626

2727
import nest_asyncio # type: ignore
2828
from requests import Session
@@ -513,6 +513,20 @@ def get_calendar(self, start_date: str, end_date: str) -> list[dict[str, str]]:
513513
jr: list[dict[str, str]] = res.json()
514514
return jr
515515

516+
def get_machine_list(self) -> list[dict[str, Any]]:
517+
"""Returns a given list of the available machines
518+
:return: list of machines
519+
"""
520+
id_token = self.login()
521+
res = self.session.get(
522+
f"{self.url}machine/?config=true",
523+
headers={"Authorization": id_token},
524+
)
525+
self._response_check(res, "get machine list")
526+
jr = res.json()
527+
528+
return cast(list[dict[str, Any]], jr)
529+
516530

517531
OFFLINE_MACHINE_LIST = [
518532
{
@@ -616,8 +630,8 @@ def __init__(self, machine_list: Optional[list] = None):
616630
self._cred_store = None
617631
self.submitted: list = []
618632

619-
def _get_machine_list(self) -> Optional[list]:
620-
"""returns the given list of the avilable machines
633+
def get_machine_list(self) -> list[dict[str, Any]]:
634+
"""Returns a given list of the available machines
621635
:return: list of machines
622636
"""
623637

pytket/extensions/quantinuum/backends/quantinuum.py

+2-11
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@
113113
OpType.SetBits,
114114
OpType.CopyBits,
115115
OpType.ClassicalExpBox,
116+
OpType.ClExpr,
116117
OpType.WASM,
117118
}
118119

@@ -365,17 +366,7 @@ def _available_devices(
365366
:param api_handler: Instance of API handler
366367
:return: Dictionaries of machine name and number of qubits.
367368
"""
368-
id_token = api_handler.login()
369-
if api_handler.online:
370-
res = requests.get(
371-
f"{api_handler.url}machine/?config=true",
372-
headers={"Authorization": id_token},
373-
)
374-
api_handler._response_check(res, "get machine list")
375-
jr = res.json()
376-
else:
377-
jr = api_handler._get_machine_list() # type: ignore
378-
return jr # type: ignore
369+
return api_handler.get_machine_list()
379370

380371
@classmethod
381372
def _dict_to_backendinfo(

0 commit comments

Comments
 (0)