Skip to content

Commit

Permalink
Merge pull request #29 from Alndaly/fix_user
Browse files Browse the repository at this point in the history
fix: 🐛 Fix the init part of User class
  • Loading branch information
Zhaoyilunnn authored Jul 23, 2023
2 parents ba66449 + 24853c4 commit 7fb9389
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/quafu/users/userapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,25 @@ class User(object):
def __init__(self):
self.apitoken = ""
self._url = "http://quafu.baqis.ac.cn/"
self.load_account()


if self.check_account_data():
self.load_account()

self.backends_api = "qbackend/get_backends/"
self.chip_api = "qbackend/scq_get_chip_info/"
self.exec_api = "qbackend/scq_kit/"
self.exec_async_api = "qbackend/scq_kit_asyc/"
self.exec_recall_api = "qbackend/scq_task_recall/"
self.priority = 2

def check_account_data(self):
homedir = get_homedir()
file_dir = homedir + "/.quafu/"
if not os.path.exists(file_dir):
print("Your user information is not configured. Remember to configure it by User.save_apitoken(<your api_token>)")
return False
return True
# TODO: Check if the user's basic data file is formated

def save_apitoken(self, apitoken):
"""
Expand Down

0 comments on commit 7fb9389

Please sign in to comment.