From b21f61bb82afcab28d560944098310e9f748765a Mon Sep 17 00:00:00 2001 From: chen_wei <109205133+chensgit169@users.noreply.github.com> Date: Fri, 28 Jul 2023 22:00:52 +0800 Subject: [PATCH 1/4] Update instruction.py fix dict typing unsupported in py3.8 --- src/quafu/elements/quantum_element/instruction.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/quafu/elements/quantum_element/instruction.py b/src/quafu/elements/quantum_element/instruction.py index 1ccb6db..e431121 100644 --- a/src/quafu/elements/quantum_element/instruction.py +++ b/src/quafu/elements/quantum_element/instruction.py @@ -17,7 +17,7 @@ PosType = Union[int, List[int]] -ParaType = dict[str, Union[float, int]] +ParaType = Union[float, int] class Instruction(ABC): From 59fcf88d96094dfa4ebf811999a40f9ae8464743 Mon Sep 17 00:00:00 2001 From: chen_wei <109205133+chensgit169@users.noreply.github.com> Date: Fri, 28 Jul 2023 22:02:35 +0800 Subject: [PATCH 2/4] Update tasks.py fix token missing in Task.retrieve() --- src/quafu/tasks/tasks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/quafu/tasks/tasks.py b/src/quafu/tasks/tasks.py index e9a7761..4674e53 100644 --- a/src/quafu/tasks/tasks.py +++ b/src/quafu/tasks/tasks.py @@ -229,7 +229,7 @@ def retrieve(self, taskid: str) -> ExecResult: data = {"task_id": taskid} url = User.exec_recall_api - headers = {'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8', 'api_token': self.token} + headers = {'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8', 'api_token': self.user.api_token} res = requests.post(url, headers=headers, data=data) res_dict = json.loads(res.text) From 77d01254c6f3300a27363a17373747faac876cd0 Mon Sep 17 00:00:00 2001 From: chen_wei <109205133+chensgit169@users.noreply.github.com> Date: Fri, 28 Jul 2023 22:17:57 +0800 Subject: [PATCH 3/4] Update tasks.py patch to fix api-token out-of-date problem --- src/quafu/tasks/tasks.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/quafu/tasks/tasks.py b/src/quafu/tasks/tasks.py index e9a7761..56f20fd 100644 --- a/src/quafu/tasks/tasks.py +++ b/src/quafu/tasks/tasks.py @@ -29,7 +29,10 @@ class Task(object): """ def __init__(self, user=User()): + # update api-token, a patch to be deleted in the future + user._api_token = user._load_account_token() self.user = user + self.shots = 1000 self.tomo = False self.compile = True From 4654f9232d5d5f076dffc25e0d03ec4141b590f2 Mon Sep 17 00:00:00 2001 From: chen_wei <109205133+chensgit169@users.noreply.github.com> Date: Fri, 28 Jul 2023 22:19:27 +0800 Subject: [PATCH 4/4] Update backends.py patch to fix api-token out-of-date problem --- src/quafu/backends/backends.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/quafu/backends/backends.py b/src/quafu/backends/backends.py index 4158116..ccb18a6 100644 --- a/src/quafu/backends/backends.py +++ b/src/quafu/backends/backends.py @@ -19,7 +19,8 @@ def __init__(self, backend_info: dict): # self.task_in_queue = backend_info["task_in_queue"] def get_chip_info(self, user=User()): - api_token = user.api_token + # update api-token, a patch to be deleted in the future + api_token = user._load_account_token() data = {"system_name": self.name.lower()} headers = {"api_token": api_token} chip_info = requests.post(url=User.chip_api, data=data,