1515
1616from typing import Union , Optional
1717
18+ from scaleway_qaas_client import QaaSClient , QaaSPlatform
19+
1820from .scaleway_session import ScalewaySession
19- from .scaleway_client import QaaSClient
2021
2122
2223class ScalewayDevice (cirq .devices .Device ):
2324 def __init__ (
2425 self ,
2526 client : QaaSClient ,
26- id : str ,
27- name : str ,
28- version : str ,
29- num_qubits : int ,
30- metadata : Optional [str ],
27+ platform : QaaSPlatform ,
3128 ) -> None :
3229 self .__id = id
3330 self .__client = client
34- self .__version = version
35- self .__num_qubits = num_qubits
36- self .__name = name
37- self .__metadata = metadata
31+ self .__platform = platform
3832
3933 def __repr__ (self ) -> str :
4034 return f"<ScalewayDevice(name={ self .__name } ,num_qubits={ self .__num_qubits } ,platform_id={ self .id } )>"
@@ -46,7 +40,7 @@ def id(self) -> str:
4640 Returns:
4741 str: The UUID of the platform.
4842 """
49- return self .__id
43+ return self .__platform . id
5044
5145 @property
5246 def availability (self ) -> str :
@@ -55,9 +49,9 @@ def availability(self) -> str:
5549 Returns:
5650 str: the current availability statys of the session. Can be either: available, shortage or scarce
5751 """
58- resp = self .__client .get_platform (self .__id )
52+ platform = self .__client .get_platform (self .__platform . id )
5953
60- return resp . get ( " availability" )
54+ return platform . availability
6155
6256 @property
6357 def name (self ) -> str :
@@ -66,7 +60,7 @@ def name(self) -> str:
6660 Returns:
6761 str: the name of the platform.
6862 """
69- return self .__name
63+ return self .__platform . name
7064
7165 @property
7266 def num_qubits (self ) -> int :
@@ -76,7 +70,7 @@ def num_qubits(self) -> int:
7670 Returns:
7771 int: the estimated amount of maximum number of runnable qubits.
7872 """
79- return self .__num_qubits
73+ return self .__platform . max_qubit_count
8074
8175 @property
8276 def version (self ):
@@ -85,13 +79,13 @@ def version(self):
8579 Returns:
8680 str: the platform's version.
8781 """
88- return self .__version
82+ return self .__platform . version
8983
9084 def create_session (
9185 self ,
9286 name : Optional [str ] = "qsim-session-from-cirq" ,
9387 deduplication_id : Optional [str ] = "qsim-session-from-cirq" ,
94- max_duration : Union [int , str ] = "1h " ,
88+ max_duration : Union [int , str ] = "59m " ,
9589 max_idle_duration : Union [int , str ] = "20m" ,
9690 ) -> ScalewaySession :
9791 """Create a new device session to run job against.
0 commit comments