qi-compute-api-client 0.4.0__py3-none-any.whl → 0.17.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of qi-compute-api-client might be problematic. Click here for more details.

Files changed (166) hide show
  1. compute_api_client/__init__.py +23 -20
  2. compute_api_client/api/__init__.py +5 -6
  3. compute_api_client/api/algorithms_api.py +1334 -554
  4. compute_api_client/api/backend_api.py +1501 -0
  5. compute_api_client/api/backend_types_api.py +684 -0
  6. compute_api_client/api/batch_jobs_api.py +1937 -0
  7. compute_api_client/api/commits_api.py +1069 -436
  8. compute_api_client/api/files_api.py +1076 -436
  9. compute_api_client/api/final_results_api.py +737 -339
  10. compute_api_client/api/jobs_api.py +1653 -0
  11. compute_api_client/api/languages_api.py +557 -218
  12. compute_api_client/api/members_api.py +1058 -436
  13. compute_api_client/api/metadata_api.py +737 -338
  14. compute_api_client/api/permissions_api.py +1056 -422
  15. compute_api_client/api/projects_api.py +1605 -677
  16. compute_api_client/api/reservations_api.py +1125 -428
  17. compute_api_client/api/results_api.py +739 -338
  18. compute_api_client/api/teams_api.py +568 -221
  19. compute_api_client/api/transactions_api.py +680 -219
  20. compute_api_client/api/users_api.py +1091 -436
  21. compute_api_client/api_client.py +347 -305
  22. compute_api_client/api_response.py +21 -0
  23. compute_api_client/configuration.py +55 -68
  24. compute_api_client/docs/Algorithm.md +20 -3
  25. compute_api_client/docs/AlgorithmIn.md +20 -3
  26. compute_api_client/docs/AlgorithmType.md +0 -1
  27. compute_api_client/docs/AlgorithmsApi.md +78 -77
  28. compute_api_client/docs/Backend.md +33 -0
  29. compute_api_client/docs/BackendApi.md +419 -0
  30. compute_api_client/docs/BackendPatch.md +29 -0
  31. compute_api_client/docs/{RunStatus.md → BackendStatus.md} +1 -2
  32. compute_api_client/docs/BackendType.md +36 -0
  33. compute_api_client/docs/{RuntimeTypesApi.md → BackendTypesApi.md} +58 -31
  34. compute_api_client/docs/BackendWithAuthentication.md +34 -0
  35. compute_api_client/docs/BatchJob.md +38 -0
  36. compute_api_client/docs/BatchJobIn.md +29 -0
  37. compute_api_client/docs/{RuntimeStatus.md → BatchJobStatus.md} +1 -2
  38. compute_api_client/docs/BatchJobsApi.md +524 -0
  39. compute_api_client/docs/Commit.md +18 -1
  40. compute_api_client/docs/CommitIn.md +17 -0
  41. compute_api_client/docs/CommitsApi.md +62 -71
  42. compute_api_client/docs/CompileStage.md +0 -1
  43. compute_api_client/docs/Domain.md +0 -1
  44. compute_api_client/docs/File.md +21 -4
  45. compute_api_client/docs/FileIn.md +21 -4
  46. compute_api_client/docs/FilesApi.md +65 -71
  47. compute_api_client/docs/FinalResult.md +20 -3
  48. compute_api_client/docs/FinalResultIn.md +19 -2
  49. compute_api_client/docs/FinalResultsApi.md +44 -71
  50. compute_api_client/docs/HTTPNotFoundError.md +17 -0
  51. compute_api_client/docs/HTTPValidationError.md +18 -1
  52. compute_api_client/docs/Job.md +36 -0
  53. compute_api_client/docs/JobIn.md +31 -0
  54. compute_api_client/docs/JobPatch.md +28 -0
  55. compute_api_client/docs/{BatchRunStatus.md → JobStatus.md} +1 -2
  56. compute_api_client/docs/{RunsApi.md → JobsApi.md} +137 -122
  57. compute_api_client/docs/Language.md +17 -0
  58. compute_api_client/docs/LanguagesApi.md +30 -12
  59. compute_api_client/docs/LocationInner.md +17 -0
  60. compute_api_client/docs/Member.md +19 -2
  61. compute_api_client/docs/MemberIn.md +19 -2
  62. compute_api_client/docs/MembersApi.md +59 -24
  63. compute_api_client/docs/Metadata.md +20 -3
  64. compute_api_client/docs/MetadataApi.md +49 -33
  65. compute_api_client/docs/MetadataIn.md +19 -2
  66. compute_api_client/docs/Permission.md +17 -0
  67. compute_api_client/docs/PermissionGroup.md +17 -0
  68. compute_api_client/docs/PermissionsApi.md +68 -28
  69. compute_api_client/docs/Project.md +20 -3
  70. compute_api_client/docs/ProjectIn.md +18 -1
  71. compute_api_client/docs/ProjectPatch.md +19 -2
  72. compute_api_client/docs/ProjectsApi.md +84 -36
  73. compute_api_client/docs/Reservation.md +21 -4
  74. compute_api_client/docs/ReservationIn.md +19 -2
  75. compute_api_client/docs/ReservationsApi.md +66 -24
  76. compute_api_client/docs/Result.md +23 -6
  77. compute_api_client/docs/ResultIn.md +19 -2
  78. compute_api_client/docs/ResultsApi.md +40 -74
  79. compute_api_client/docs/Role.md +0 -1
  80. compute_api_client/docs/ShareType.md +0 -1
  81. compute_api_client/docs/Team.md +18 -1
  82. compute_api_client/docs/TeamsApi.md +37 -14
  83. compute_api_client/docs/Transaction.md +21 -4
  84. compute_api_client/docs/TransactionsApi.md +50 -14
  85. compute_api_client/docs/User.md +21 -4
  86. compute_api_client/docs/UserIn.md +17 -0
  87. compute_api_client/docs/UsersApi.md +62 -24
  88. compute_api_client/docs/ValidationError.md +18 -1
  89. compute_api_client/exceptions.py +20 -17
  90. compute_api_client/models/__init__.py +17 -15
  91. compute_api_client/models/algorithm.py +79 -238
  92. compute_api_client/models/algorithm_in.py +77 -205
  93. compute_api_client/models/algorithm_type.py +22 -88
  94. compute_api_client/models/backend.py +100 -0
  95. compute_api_client/models/backend_patch.py +90 -0
  96. compute_api_client/models/backend_status.py +47 -0
  97. compute_api_client/models/backend_type.py +105 -0
  98. compute_api_client/models/backend_with_authentication.py +102 -0
  99. compute_api_client/models/batch_job.py +129 -0
  100. compute_api_client/models/batch_job_in.py +89 -0
  101. compute_api_client/models/batch_job_status.py +48 -0
  102. compute_api_client/models/commit.py +73 -231
  103. compute_api_client/models/commit_in.py +68 -170
  104. compute_api_client/models/compile_stage.py +24 -90
  105. compute_api_client/models/domain.py +23 -89
  106. compute_api_client/models/file.py +75 -289
  107. compute_api_client/models/file_in.py +73 -255
  108. compute_api_client/models/final_result.py +69 -199
  109. compute_api_client/models/final_result_in.py +64 -138
  110. compute_api_client/models/http_not_found_error.py +61 -106
  111. compute_api_client/models/http_validation_error.py +70 -106
  112. compute_api_client/models/job.py +120 -0
  113. compute_api_client/models/job_in.py +99 -0
  114. compute_api_client/models/job_patch.py +88 -0
  115. compute_api_client/models/job_status.py +48 -0
  116. compute_api_client/models/language.py +68 -173
  117. compute_api_client/models/location_inner.py +126 -85
  118. compute_api_client/models/member.py +71 -237
  119. compute_api_client/models/member_in.py +69 -204
  120. compute_api_client/models/metadata.py +69 -199
  121. compute_api_client/models/metadata_in.py +69 -138
  122. compute_api_client/models/permission.py +68 -173
  123. compute_api_client/models/permission_group.py +66 -143
  124. compute_api_client/models/project.py +75 -257
  125. compute_api_client/models/project_in.py +70 -196
  126. compute_api_client/models/project_patch.py +90 -193
  127. compute_api_client/models/reservation.py +80 -291
  128. compute_api_client/models/reservation_in.py +69 -201
  129. compute_api_client/models/result.py +102 -360
  130. compute_api_client/models/result_in.py +96 -293
  131. compute_api_client/models/role.py +22 -88
  132. compute_api_client/models/share_type.py +23 -89
  133. compute_api_client/models/team.py +70 -199
  134. compute_api_client/models/transaction.py +94 -300
  135. compute_api_client/models/user.py +76 -277
  136. compute_api_client/models/user_in.py +74 -244
  137. compute_api_client/models/validation_error.py +74 -161
  138. compute_api_client/rest.py +56 -115
  139. {qi_compute_api_client-0.4.0.dist-info → qi_compute_api_client-0.17.0.dist-info}/METADATA +47 -40
  140. qi_compute_api_client-0.17.0.dist-info/RECORD +142 -0
  141. compute_api_client/api/batch_runs_api.py +0 -862
  142. compute_api_client/api/runs_api.py +0 -723
  143. compute_api_client/api/runtime_api.py +0 -449
  144. compute_api_client/api/runtime_types_api.py +0 -303
  145. compute_api_client/docs/BatchRun.md +0 -21
  146. compute_api_client/docs/BatchRunIn.md +0 -12
  147. compute_api_client/docs/BatchRunsApi.md +0 -600
  148. compute_api_client/docs/Run.md +0 -18
  149. compute_api_client/docs/RunIn.md +0 -13
  150. compute_api_client/docs/Runtime.md +0 -16
  151. compute_api_client/docs/RuntimeApi.md +0 -229
  152. compute_api_client/docs/RuntimeType.md +0 -19
  153. compute_api_client/docs/RuntimeWithAuthentication.md +0 -17
  154. compute_api_client/models/batch_run.py +0 -423
  155. compute_api_client/models/batch_run_in.py +0 -171
  156. compute_api_client/models/batch_run_status.py +0 -114
  157. compute_api_client/models/run.py +0 -345
  158. compute_api_client/models/run_in.py +0 -202
  159. compute_api_client/models/run_status.py +0 -114
  160. compute_api_client/models/runtime.py +0 -290
  161. compute_api_client/models/runtime_status.py +0 -113
  162. compute_api_client/models/runtime_type.py +0 -357
  163. compute_api_client/models/runtime_with_authentication.py +0 -320
  164. qi_compute_api_client-0.4.0.dist-info/RECORD +0 -137
  165. {qi_compute_api_client-0.4.0.dist-info → qi_compute_api_client-0.17.0.dist-info}/LICENSE.md +0 -0
  166. {qi_compute_api_client-0.4.0.dist-info → qi_compute_api_client-0.17.0.dist-info}/WHEEL +0 -0
@@ -1,378 +1,120 @@
1
1
  # coding: utf-8
2
2
 
3
3
  """
4
- Compute Job Manager
4
+ Quantum Inspire 2
5
5
 
6
- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
7
 
8
8
  The version of the OpenAPI document: 0.1.0
9
- Generated by: https://openapi-generator.tech
10
- """
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
10
 
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
12
13
 
13
- try:
14
- from inspect import getfullargspec
15
- except ImportError:
16
- from inspect import getargspec as getfullargspec
14
+
15
+ from __future__ import annotations
17
16
  import pprint
18
17
  import re # noqa: F401
19
- import six
20
-
21
- from compute_api_client.configuration import Configuration
22
-
18
+ import json
23
19
 
24
- class Result(object):
25
- """NOTE: This class is auto generated by OpenAPI Generator.
26
- Ref: https://openapi-generator.tech
27
-
28
- Do not edit the class manually.
29
- """
20
+ from datetime import datetime
21
+ from typing import Any, ClassVar, Dict, List, Optional, Union
22
+ from pydantic import BaseModel, StrictFloat, StrictInt
23
+ from pydantic import Field
24
+ from typing_extensions import Annotated
25
+ try:
26
+ from typing import Self
27
+ except ImportError:
28
+ from typing_extensions import Self
30
29
 
30
+ class Result(BaseModel):
31
31
  """
32
- Attributes:
33
- openapi_types (dict): The key is attribute name
34
- and the value is attribute type.
35
- attribute_map (dict): The key is attribute name
36
- and the value is json key in definition.
37
- """
38
- openapi_types = {
39
- 'created_on': 'datetime',
40
- 'id': 'int',
41
- 'number_of_qubits': 'int',
42
- 'execution_time_in_seconds': 'float',
43
- 'shots_requested': 'int',
44
- 'shots_done': 'int',
45
- 'results': 'object',
46
- 'metadata_id': 'int',
47
- 'run_id': 'int'
32
+ Result
33
+ """ # noqa: E501
34
+ id: StrictInt
35
+ created_on: datetime
36
+ job_id: StrictInt
37
+ metadata_id: StrictInt
38
+ number_of_qubits: Annotated[int, Field(strict=True, ge=-32768)]
39
+ execution_time_in_seconds: Union[StrictFloat, StrictInt]
40
+ shots_requested: Optional[StrictInt]
41
+ shots_done: Optional[StrictInt]
42
+ results: Optional[Union[str, Any]]
43
+ __properties: ClassVar[List[str]] = ["id", "created_on", "job_id", "metadata_id", "number_of_qubits", "execution_time_in_seconds", "shots_requested", "shots_done", "results"]
44
+
45
+ model_config = {
46
+ "populate_by_name": True,
47
+ "validate_assignment": True
48
48
  }
49
49
 
50
- attribute_map = {
51
- 'created_on': 'created_on',
52
- 'id': 'id',
53
- 'number_of_qubits': 'number_of_qubits',
54
- 'execution_time_in_seconds': 'execution_time_in_seconds',
55
- 'shots_requested': 'shots_requested',
56
- 'shots_done': 'shots_done',
57
- 'results': 'results',
58
- 'metadata_id': 'metadata_id',
59
- 'run_id': 'run_id'
60
- }
61
-
62
- def __init__(self, created_on=None, id=None, number_of_qubits=None, execution_time_in_seconds=None, shots_requested=None, shots_done=None, results=None, metadata_id=None, run_id=None, local_vars_configuration=None): # noqa: E501
63
- """Result - a model defined in OpenAPI""" # noqa: E501
64
- if local_vars_configuration is None:
65
- local_vars_configuration = Configuration.get_default_copy()
66
- self.local_vars_configuration = local_vars_configuration
67
-
68
- self._created_on = None
69
- self._id = None
70
- self._number_of_qubits = None
71
- self._execution_time_in_seconds = None
72
- self._shots_requested = None
73
- self._shots_done = None
74
- self._results = None
75
- self._metadata_id = None
76
- self._run_id = None
77
- self.discriminator = None
78
-
79
- self.created_on = created_on
80
- self.id = id
81
- self.number_of_qubits = number_of_qubits
82
- self.execution_time_in_seconds = execution_time_in_seconds
83
- self.shots_requested = shots_requested
84
- self.shots_done = shots_done
85
- self.results = results
86
- self.metadata_id = metadata_id
87
- self.run_id = run_id
88
-
89
- @property
90
- def created_on(self):
91
- """Gets the created_on of this Result. # noqa: E501
92
-
93
-
94
- :return: The created_on of this Result. # noqa: E501
95
- :rtype: datetime
96
- """
97
- return self._created_on
98
-
99
- @created_on.setter
100
- def created_on(self, created_on):
101
- """Sets the created_on of this Result.
102
-
103
-
104
- :param created_on: The created_on of this Result. # noqa: E501
105
- :type created_on: datetime
106
- """
107
- if self.local_vars_configuration.client_side_validation and created_on is None: # noqa: E501
108
- raise ValueError("Invalid value for `created_on`, must not be `None`") # noqa: E501
109
-
110
- self._created_on = created_on
111
-
112
- @property
113
- def id(self):
114
- """Gets the id of this Result. # noqa: E501
115
-
116
-
117
- :return: The id of this Result. # noqa: E501
118
- :rtype: int
119
- """
120
- return self._id
121
-
122
- @id.setter
123
- def id(self, id):
124
- """Sets the id of this Result.
125
-
126
-
127
- :param id: The id of this Result. # noqa: E501
128
- :type id: int
129
- """
130
- if self.local_vars_configuration.client_side_validation and id is None: # noqa: E501
131
- raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501
132
- if (self.local_vars_configuration.client_side_validation and
133
- id is not None and id > 2147483647): # noqa: E501
134
- raise ValueError("Invalid value for `id`, must be a value less than or equal to `2147483647`") # noqa: E501
135
- if (self.local_vars_configuration.client_side_validation and
136
- id is not None and id < 1): # noqa: E501
137
- raise ValueError("Invalid value for `id`, must be a value greater than or equal to `1`") # noqa: E501
138
-
139
- self._id = id
140
-
141
- @property
142
- def number_of_qubits(self):
143
- """Gets the number_of_qubits of this Result. # noqa: E501
144
-
145
-
146
- :return: The number_of_qubits of this Result. # noqa: E501
147
- :rtype: int
148
- """
149
- return self._number_of_qubits
150
-
151
- @number_of_qubits.setter
152
- def number_of_qubits(self, number_of_qubits):
153
- """Sets the number_of_qubits of this Result.
154
-
155
-
156
- :param number_of_qubits: The number_of_qubits of this Result. # noqa: E501
157
- :type number_of_qubits: int
158
- """
159
- if self.local_vars_configuration.client_side_validation and number_of_qubits is None: # noqa: E501
160
- raise ValueError("Invalid value for `number_of_qubits`, must not be `None`") # noqa: E501
161
- if (self.local_vars_configuration.client_side_validation and
162
- number_of_qubits is not None and number_of_qubits > 32767): # noqa: E501
163
- raise ValueError("Invalid value for `number_of_qubits`, must be a value less than or equal to `32767`") # noqa: E501
164
- if (self.local_vars_configuration.client_side_validation and
165
- number_of_qubits is not None and number_of_qubits < -32768): # noqa: E501
166
- raise ValueError("Invalid value for `number_of_qubits`, must be a value greater than or equal to `-32768`") # noqa: E501
167
-
168
- self._number_of_qubits = number_of_qubits
169
-
170
- @property
171
- def execution_time_in_seconds(self):
172
- """Gets the execution_time_in_seconds of this Result. # noqa: E501
173
-
174
-
175
- :return: The execution_time_in_seconds of this Result. # noqa: E501
176
- :rtype: float
177
- """
178
- return self._execution_time_in_seconds
179
-
180
- @execution_time_in_seconds.setter
181
- def execution_time_in_seconds(self, execution_time_in_seconds):
182
- """Sets the execution_time_in_seconds of this Result.
183
-
184
-
185
- :param execution_time_in_seconds: The execution_time_in_seconds of this Result. # noqa: E501
186
- :type execution_time_in_seconds: float
187
- """
188
- if self.local_vars_configuration.client_side_validation and execution_time_in_seconds is None: # noqa: E501
189
- raise ValueError("Invalid value for `execution_time_in_seconds`, must not be `None`") # noqa: E501
190
-
191
- self._execution_time_in_seconds = execution_time_in_seconds
192
-
193
- @property
194
- def shots_requested(self):
195
- """Gets the shots_requested of this Result. # noqa: E501
196
-
197
-
198
- :return: The shots_requested of this Result. # noqa: E501
199
- :rtype: int
200
- """
201
- return self._shots_requested
202
-
203
- @shots_requested.setter
204
- def shots_requested(self, shots_requested):
205
- """Sets the shots_requested of this Result.
206
-
207
-
208
- :param shots_requested: The shots_requested of this Result. # noqa: E501
209
- :type shots_requested: int
210
- """
211
- if (self.local_vars_configuration.client_side_validation and
212
- shots_requested is not None and shots_requested > 2147483647): # noqa: E501
213
- raise ValueError("Invalid value for `shots_requested`, must be a value less than or equal to `2147483647`") # noqa: E501
214
- if (self.local_vars_configuration.client_side_validation and
215
- shots_requested is not None and shots_requested < -2147483648): # noqa: E501
216
- raise ValueError("Invalid value for `shots_requested`, must be a value greater than or equal to `-2147483648`") # noqa: E501
217
-
218
- self._shots_requested = shots_requested
219
-
220
- @property
221
- def shots_done(self):
222
- """Gets the shots_done of this Result. # noqa: E501
223
-
224
-
225
- :return: The shots_done of this Result. # noqa: E501
226
- :rtype: int
227
- """
228
- return self._shots_done
229
-
230
- @shots_done.setter
231
- def shots_done(self, shots_done):
232
- """Sets the shots_done of this Result.
233
-
234
-
235
- :param shots_done: The shots_done of this Result. # noqa: E501
236
- :type shots_done: int
237
- """
238
- if (self.local_vars_configuration.client_side_validation and
239
- shots_done is not None and shots_done > 2147483647): # noqa: E501
240
- raise ValueError("Invalid value for `shots_done`, must be a value less than or equal to `2147483647`") # noqa: E501
241
- if (self.local_vars_configuration.client_side_validation and
242
- shots_done is not None and shots_done < -2147483648): # noqa: E501
243
- raise ValueError("Invalid value for `shots_done`, must be a value greater than or equal to `-2147483648`") # noqa: E501
244
-
245
- self._shots_done = shots_done
246
-
247
- @property
248
- def results(self):
249
- """Gets the results of this Result. # noqa: E501
250
-
251
-
252
- :return: The results of this Result. # noqa: E501
253
- :rtype: object
254
- """
255
- return self._results
256
-
257
- @results.setter
258
- def results(self, results):
259
- """Sets the results of this Result.
260
-
261
-
262
- :param results: The results of this Result. # noqa: E501
263
- :type results: object
264
- """
265
-
266
- self._results = results
267
-
268
- @property
269
- def metadata_id(self):
270
- """Gets the metadata_id of this Result. # noqa: E501
271
-
272
-
273
- :return: The metadata_id of this Result. # noqa: E501
274
- :rtype: int
275
- """
276
- return self._metadata_id
277
-
278
- @metadata_id.setter
279
- def metadata_id(self, metadata_id):
280
- """Sets the metadata_id of this Result.
281
-
282
-
283
- :param metadata_id: The metadata_id of this Result. # noqa: E501
284
- :type metadata_id: int
285
- """
286
- if self.local_vars_configuration.client_side_validation and metadata_id is None: # noqa: E501
287
- raise ValueError("Invalid value for `metadata_id`, must not be `None`") # noqa: E501
288
- if (self.local_vars_configuration.client_side_validation and
289
- metadata_id is not None and metadata_id > 2147483647): # noqa: E501
290
- raise ValueError("Invalid value for `metadata_id`, must be a value less than or equal to `2147483647`") # noqa: E501
291
- if (self.local_vars_configuration.client_side_validation and
292
- metadata_id is not None and metadata_id < 1): # noqa: E501
293
- raise ValueError("Invalid value for `metadata_id`, must be a value greater than or equal to `1`") # noqa: E501
294
-
295
- self._metadata_id = metadata_id
296
-
297
- @property
298
- def run_id(self):
299
- """Gets the run_id of this Result. # noqa: E501
300
-
301
-
302
- :return: The run_id of this Result. # noqa: E501
303
- :rtype: int
304
- """
305
- return self._run_id
306
-
307
- @run_id.setter
308
- def run_id(self, run_id):
309
- """Sets the run_id of this Result.
310
-
311
-
312
- :param run_id: The run_id of this Result. # noqa: E501
313
- :type run_id: int
314
- """
315
- if self.local_vars_configuration.client_side_validation and run_id is None: # noqa: E501
316
- raise ValueError("Invalid value for `run_id`, must not be `None`") # noqa: E501
317
- if (self.local_vars_configuration.client_side_validation and
318
- run_id is not None and run_id > 2147483647): # noqa: E501
319
- raise ValueError("Invalid value for `run_id`, must be a value less than or equal to `2147483647`") # noqa: E501
320
- if (self.local_vars_configuration.client_side_validation and
321
- run_id is not None and run_id < 1): # noqa: E501
322
- raise ValueError("Invalid value for `run_id`, must be a value greater than or equal to `1`") # noqa: E501
323
-
324
- self._run_id = run_id
325
-
326
- def to_dict(self, serialize=False):
327
- """Returns the model properties as a dict"""
328
- result = {}
329
-
330
- def convert(x):
331
- if hasattr(x, "to_dict"):
332
- args = getfullargspec(x.to_dict).args
333
- if len(args) == 1:
334
- return x.to_dict()
335
- else:
336
- return x.to_dict(serialize)
337
- else:
338
- return x
339
-
340
- for attr, _ in six.iteritems(self.openapi_types):
341
- value = getattr(self, attr)
342
- attr = self.attribute_map.get(attr, attr) if serialize else attr
343
- if isinstance(value, list):
344
- result[attr] = list(map(
345
- lambda x: convert(x),
346
- value
347
- ))
348
- elif isinstance(value, dict):
349
- result[attr] = dict(map(
350
- lambda item: (item[0], convert(item[1])),
351
- value.items()
352
- ))
353
- else:
354
- result[attr] = convert(value)
355
-
356
- return result
357
-
358
- def to_str(self):
359
- """Returns the string representation of the model"""
360
- return pprint.pformat(self.to_dict())
361
-
362
- def __repr__(self):
363
- """For `print` and `pprint`"""
364
- return self.to_str()
365
-
366
- def __eq__(self, other):
367
- """Returns true if both objects are equal"""
368
- if not isinstance(other, Result):
369
- return False
370
50
 
371
- return self.to_dict() == other.to_dict()
51
+ def to_str(self) -> str:
52
+ """Returns the string representation of the model using alias"""
53
+ return pprint.pformat(self.model_dump(by_alias=True))
54
+
55
+ def to_json(self) -> str:
56
+ """Returns the JSON representation of the model using alias"""
57
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
58
+ return json.dumps(self.to_dict())
59
+
60
+ @classmethod
61
+ def from_json(cls, json_str: str) -> Self:
62
+ """Create an instance of Result from a JSON string"""
63
+ return cls.from_dict(json.loads(json_str))
64
+
65
+ def to_dict(self) -> Dict[str, Any]:
66
+ """Return the dictionary representation of the model using alias.
67
+
68
+ This has the following differences from calling pydantic's
69
+ `self.model_dump(by_alias=True)`:
70
+
71
+ * `None` is only added to the output dict for nullable fields that
72
+ were set at model initialization. Other fields with value `None`
73
+ are ignored.
74
+ """
75
+ _dict = self.model_dump(
76
+ by_alias=True,
77
+ exclude={
78
+ },
79
+ exclude_none=True,
80
+ )
81
+ # set to None if shots_requested (nullable) is None
82
+ # and model_fields_set contains the field
83
+ if self.shots_requested is None and "shots_requested" in self.model_fields_set:
84
+ _dict['shots_requested'] = None
85
+
86
+ # set to None if shots_done (nullable) is None
87
+ # and model_fields_set contains the field
88
+ if self.shots_done is None and "shots_done" in self.model_fields_set:
89
+ _dict['shots_done'] = None
90
+
91
+ # set to None if results (nullable) is None
92
+ # and model_fields_set contains the field
93
+ if self.results is None and "results" in self.model_fields_set:
94
+ _dict['results'] = None
95
+
96
+ return _dict
97
+
98
+ @classmethod
99
+ def from_dict(cls, obj: Dict) -> Self:
100
+ """Create an instance of Result from a dict"""
101
+ if obj is None:
102
+ return None
103
+
104
+ if not isinstance(obj, dict):
105
+ return cls.model_validate(obj)
106
+
107
+ _obj = cls.model_validate({
108
+ "id": obj.get("id"),
109
+ "created_on": obj.get("created_on"),
110
+ "job_id": obj.get("job_id"),
111
+ "metadata_id": obj.get("metadata_id"),
112
+ "number_of_qubits": obj.get("number_of_qubits"),
113
+ "execution_time_in_seconds": obj.get("execution_time_in_seconds"),
114
+ "shots_requested": obj.get("shots_requested"),
115
+ "shots_done": obj.get("shots_done"),
116
+ "results": obj.get("results")
117
+ })
118
+ return _obj
372
119
 
373
- def __ne__(self, other):
374
- """Returns true if both objects are not equal"""
375
- if not isinstance(other, Result):
376
- return True
377
120
 
378
- return self.to_dict() != other.to_dict()