Skip to content

Commit e1689fd

Browse files
authored
Support full-result format in Pasqal Result (#762)
Pasqal jobs previously uploaded only a subset of the result (raw counter dict). Now that full results will be uploaded, the output may be wrapped as {"counter": {...}, ...}. Unwrap "counter" when present, falling back to the raw dict for backward compatibility.
1 parent cae08e6 commit e1689fd

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

  • azure-quantum/azure/quantum/target/pasqal

‎azure-quantum/azure/quantum/target/pasqal/result.py‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
]
1111

1212
import json
13-
from typing import Union, Dict, List, TypeVar, cast
13+
from typing import Any, Union, Dict, List, TypeVar, cast
1414

1515
from ...job import Job
1616

@@ -44,7 +44,10 @@ def __init__(self, job: Job) -> None:
4444
f"(status: {job.details.status}."
4545
f"error: {job.details.error_data})"
4646
)
47-
self.data = cast(Dict[str, int], json.loads(job.download_data(job.details.output_data_uri)))
47+
raw = cast(
48+
Dict[str, Any], json.loads(job.download_data(job.details.output_data_uri))
49+
)
50+
self.data = cast(Dict[str, int], raw["counter"] if "counter" in raw else raw)
4851

4952
def __getitem__(self, register_name: str) -> int:
50-
return self.data[register_name]
53+
return self.data[register_name]

0 commit comments

Comments
 (0)