• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

qiskit-community / qiskit-aqt-provider / 9255177207

27 May 2024 12:52PM UTC coverage: 99.736%. Remained the same
9255177207

push

github

web-flow
Prepare release 1.5.0 (#161)

2267 of 2273 relevant lines covered (99.74%)

3.98 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
/qiskit_aqt_provider/api_models_generated.py
1
# generated by datamodel-codegen:
2
#   filename:  aqt_public.yml
3

4
from __future__ import annotations
4✔
5

6
from enum import Enum
4✔
7
from typing import Annotated, Dict, List, Literal, Optional, Union
4✔
8
from uuid import UUID
4✔
9

10
from pydantic import BaseModel, ConfigDict, Field, RootModel
4✔
11

12

13
class GateR(BaseModel):
4✔
14
    """
4✔
15
    A single-qubit rotation.
16

17
    Describes a rotation of angle θ around axis φ in the equatorial plane of the Bloch sphere.
18

19
    Angles are expressed in units of π.
20
    """
21

22
    model_config = ConfigDict(
4✔
23
        extra="forbid",
24
        frozen=True,
25
    )
26
    operation: Annotated[Literal["R"], Field("R", title="Operation")]
4✔
27
    phi: Annotated[float, Field(ge=0.0, le=2.0, title="Phi")]
4✔
28
    qubit: Annotated[int, Field(ge=0, title="Qubit")]
4✔
29
    theta: Annotated[float, Field(ge=0.0, le=1.0, title="Theta")]
4✔
30

31

32
class Qubit(RootModel[int]):
4✔
33
    model_config = ConfigDict(
4✔
34
        frozen=True,
35
    )
36
    root: Annotated[int, Field(ge=0)]
4✔
37

38

39
class GateRXX(BaseModel):
4✔
40
    """
4✔
41
    A parametric 2-qubits X⊗X gate with angle θ.
42

43
    The angle is expressed in units of π. The gate is maximally entangling
44
    for θ=0.5 (π/2).
45
    """
46

47
    model_config = ConfigDict(
4✔
48
        extra="forbid",
49
        frozen=True,
50
    )
51
    operation: Annotated[Literal["RXX"], Field("RXX", title="Operation")]
4✔
52
    qubits: Annotated[List[Qubit], Field(max_length=2, min_length=2, title="Qubits")]
4✔
53
    theta: Annotated[float, Field(ge=0.0, le=0.5, title="Theta")]
4✔
54

55

56
class GateRZ(BaseModel):
4✔
57
    """
4✔
58
    A single-qubit rotation of angle φ around the Z axis of the Bloch sphere.
59
    """
60

61
    model_config = ConfigDict(
4✔
62
        extra="forbid",
63
        frozen=True,
64
    )
65
    operation: Annotated[Literal["RZ"], Field("RZ", title="Operation")]
4✔
66
    phi: Annotated[float, Field(title="Phi")]
4✔
67
    qubit: Annotated[int, Field(ge=0, title="Qubit")]
4✔
68

69

70
class JobUser(BaseModel):
4✔
71
    model_config = ConfigDict(
4✔
72
        frozen=True,
73
    )
74
    job_id: Annotated[UUID, Field(title="Job Id")]
4✔
75
    """
3✔
76
    Id that uniquely identifies the job. This is used to request results.
77
    """
78
    job_type: Annotated[
4✔
79
        Literal["quantum_circuit"], Field("quantum_circuit", title="Job Type")
80
    ]
81
    label: Annotated[Optional[str], Field(None, title="Label")]
4✔
82
    resource_id: Annotated[str, Field("", title="Resource Id")]
4✔
83
    workspace_id: Annotated[str, Field("", title="Workspace Id")]
4✔
84

85

86
class Measure(BaseModel):
4✔
87
    """
4✔
88
    Measurement operation.
89

90
    The MEASURE operation instructs the resource
91
    to perform a projective measurement of all qubits.
92
    """
93

94
    model_config = ConfigDict(
4✔
95
        extra="forbid",
96
        frozen=True,
97
    )
98
    operation: Annotated[Literal["MEASURE"], Field("MEASURE", title="Operation")]
4✔
99

100

101
class OperationModel(RootModel[Union[GateRZ, GateR, GateRXX, Measure]]):
4✔
102
    model_config = ConfigDict(
4✔
103
        frozen=True,
104
    )
105
    root: Annotated[
4✔
106
        Union[GateRZ, GateR, GateRXX, Measure],
107
        Field(discriminator="operation", title="OperationModel"),
108
    ]
109
    """
4✔
110
    Model for the items in a Circuit.
111

112
    This extra wrapper is introduced to leverage the pydantic
113
    tagged-union parser.
114
    """
115

116

117
class RRCancelled(BaseModel):
4✔
118
    model_config = ConfigDict(
4✔
119
        frozen=True,
120
    )
121
    status: Annotated[Literal["cancelled"], Field("cancelled", title="Status")]
4✔
122

123

124
class RRError(BaseModel):
4✔
125
    model_config = ConfigDict(
4✔
126
        frozen=True,
127
    )
128
    message: Annotated[str, Field(title="Message")]
4✔
129
    status: Annotated[Literal["error"], Field("error", title="Status")]
4✔
130

131

132
class ResultItem(RootModel[int]):
4✔
133
    model_config = ConfigDict(
4✔
134
        frozen=True,
135
    )
136
    root: Annotated[int, Field(ge=0, le=1)]
4✔
137

138

139
class RRFinished(BaseModel):
4✔
140
    """
4✔
141
    Contains the measurement data of a finished circuit.
142
    """
143

144
    model_config = ConfigDict(
4✔
145
        frozen=True,
146
    )
147
    result: Annotated[Dict[str, List[List[ResultItem]]], Field(title="Result")]
4✔
148
    status: Annotated[Literal["finished"], Field("finished", title="Status")]
4✔
149

150

151
class RROngoing(BaseModel):
4✔
152
    model_config = ConfigDict(
4✔
153
        frozen=True,
154
    )
155
    finished_count: Annotated[int, Field(ge=0, title="Finished Count")]
4✔
156
    status: Annotated[Literal["ongoing"], Field("ongoing", title="Status")]
4✔
157

158

159
class RRQueued(BaseModel):
4✔
160
    model_config = ConfigDict(
4✔
161
        frozen=True,
162
    )
163
    status: Annotated[Literal["queued"], Field("queued", title="Status")]
4✔
164

165

166
class Type(Enum):
4✔
167
    simulator = "simulator"
4✔
168
    device = "device"
4✔
169

170

171
class Resource(BaseModel):
4✔
172
    model_config = ConfigDict(
4✔
173
        frozen=True,
174
    )
175
    id: Annotated[str, Field(title="Id")]
4✔
176
    name: Annotated[str, Field(title="Name")]
4✔
177
    type: Annotated[Type, Field(title="Type")]
4✔
178

179

180
class UnknownJob(BaseModel):
4✔
181
    model_config = ConfigDict(
4✔
182
        frozen=True,
183
    )
184
    job_id: Annotated[UUID, Field(title="Job Id")]
4✔
185
    message: Annotated[
4✔
186
        Literal["unknown job_id"], Field("unknown job_id", title="Message")
187
    ]
188

189

190
class ValidationError(BaseModel):
4✔
191
    model_config = ConfigDict(
4✔
192
        frozen=True,
193
    )
194
    loc: Annotated[List[Union[str, int]], Field(title="Location")]
4✔
195
    msg: Annotated[str, Field(title="Message")]
4✔
196
    type: Annotated[str, Field(title="Error Type")]
4✔
197

198

199
class Workspace(BaseModel):
4✔
200
    model_config = ConfigDict(
4✔
201
        frozen=True,
202
    )
203
    id: Annotated[str, Field(title="Id")]
4✔
204
    resources: Annotated[List[Resource], Field(title="Resources")]
4✔
205

206

207
class Circuit(RootModel[List[OperationModel]]):
4✔
208
    """
4✔
209
    Json encoding of a quantum circuit.
210
    """
211

212
    model_config = ConfigDict(
4✔
213
        frozen=True,
214
    )
215
    root: Annotated[
4✔
216
        List[OperationModel],
217
        Field(
218
            examples=[
219
                [
220
                    {"operation": "RZ", "phi": 0.5, "qubit": 0},
221
                    {"operation": "R", "phi": 0.25, "qubit": 1, "theta": 0.5},
222
                    {"operation": "RXX", "qubits": [0, 1], "theta": 0.5},
223
                    {"operation": "MEASURE"},
224
                ]
225
            ],
226
            max_length=10000,
227
            min_length=1,
228
            title="Circuit",
229
        ),
230
    ]
231
    """
4✔
232
    Json encoding of a quantum circuit.
233
    """
234

235

236
class HTTPValidationError(BaseModel):
4✔
237
    model_config = ConfigDict(
4✔
238
        frozen=True,
239
    )
240
    detail: Annotated[Optional[List[ValidationError]], Field(None, title="Detail")]
4✔
241

242

243
class JobResponseRRCancelled(BaseModel):
4✔
244
    model_config = ConfigDict(
4✔
245
        frozen=True,
246
    )
247
    job: JobUser
4✔
248
    response: RRCancelled
4✔
249

250

251
class JobResponseRRError(BaseModel):
4✔
252
    model_config = ConfigDict(
4✔
253
        frozen=True,
254
    )
255
    job: JobUser
4✔
256
    response: RRError
4✔
257

258

259
class JobResponseRRFinished(BaseModel):
4✔
260
    model_config = ConfigDict(
4✔
261
        frozen=True,
262
    )
263
    job: JobUser
4✔
264
    response: RRFinished
4✔
265

266

267
class JobResponseRROngoing(BaseModel):
4✔
268
    model_config = ConfigDict(
4✔
269
        frozen=True,
270
    )
271
    job: JobUser
4✔
272
    response: RROngoing
4✔
273

274

275
class JobResponseRRQueued(BaseModel):
4✔
276
    model_config = ConfigDict(
4✔
277
        frozen=True,
278
    )
279
    job: JobUser
4✔
280
    response: RRQueued
4✔
281

282

283
class QuantumCircuit(BaseModel):
4✔
284
    """
4✔
285
    A quantum circuit-type job that can run on a computing resource.
286
    """
287

288
    model_config = ConfigDict(
4✔
289
        frozen=True,
290
    )
291
    number_of_qubits: Annotated[int, Field(gt=0, title="Number Of Qubits")]
4✔
292
    quantum_circuit: Circuit
4✔
293
    repetitions: Annotated[int, Field(gt=0, title="Repetitions")]
4✔
294

295

296
class QuantumCircuits(BaseModel):
4✔
297
    """
4✔
298
    A collection of quantum circuits representing a single job.
299
    """
300

301
    model_config = ConfigDict(
4✔
302
        frozen=True,
303
    )
304
    circuits: Annotated[List[QuantumCircuit], Field(min_length=1, title="Circuits")]
4✔
305

306

307
class ResultResponse(
4✔
308
    RootModel[
309
        Union[
310
            JobResponseRRQueued,
311
            JobResponseRROngoing,
312
            JobResponseRRFinished,
313
            JobResponseRRError,
314
            JobResponseRRCancelled,
315
            UnknownJob,
316
        ]
317
    ]
318
):
319
    model_config = ConfigDict(
4✔
320
        frozen=True,
321
    )
322
    root: Annotated[
4✔
323
        Union[
324
            JobResponseRRQueued,
325
            JobResponseRROngoing,
326
            JobResponseRRFinished,
327
            JobResponseRRError,
328
            JobResponseRRCancelled,
329
            UnknownJob,
330
        ],
331
        Field(
332
            examples=[
333
                {
334
                    "description": (
335
                        "Job waiting in the queue to be picked up by the Quantum"
336
                        " computer"
337
                    ),
338
                    "summary": "Queued Job",
339
                    "value": {
340
                        "job": {
341
                            "job_id": "ccaa39de-d0f3-4c8b-bdb1-4d74f0c2f450",
342
                            "job_type": "quantum_circuit",
343
                            "label": "Example computation",
344
                            "payload": {
345
                                "circuits": [
346
                                    {
347
                                        "number_of_qubits": 2,
348
                                        "quantum_circuit": [
349
                                            {"operation": "RZ", "phi": 0.5, "qubit": 0},
350
                                            {
351
                                                "operation": "R",
352
                                                "phi": 0.25,
353
                                                "qubit": 1,
354
                                                "theta": 0.5,
355
                                            },
356
                                            {
357
                                                "operation": "RXX",
358
                                                "qubits": [0, 1],
359
                                                "theta": 0.5,
360
                                            },
361
                                            {"operation": "MEASURE"},
362
                                        ],
363
                                        "repetitions": 5,
364
                                    }
365
                                ]
366
                            },
367
                        },
368
                        "response": {"status": "queued"},
369
                    },
370
                },
371
                {
372
                    "description": (
373
                        "Job that is currently being processed by the Quantum computer"
374
                    ),
375
                    "summary": "Ongoing Job",
376
                    "value": {
377
                        "job": {
378
                            "job_id": "ccaa39de-d0f3-4c8b-bdb1-4d74f0c2f450",
379
                            "job_type": "quantum_circuit",
380
                            "label": "Example computation",
381
                            "payload": {
382
                                "circuits": [
383
                                    {
384
                                        "number_of_qubits": 2,
385
                                        "quantum_circuit": [
386
                                            {"operation": "RZ", "phi": 0.5, "qubit": 0},
387
                                            {
388
                                                "operation": "R",
389
                                                "phi": 0.25,
390
                                                "qubit": 1,
391
                                                "theta": 0.5,
392
                                            },
393
                                            {
394
                                                "operation": "RXX",
395
                                                "qubits": [0, 1],
396
                                                "theta": 0.5,
397
                                            },
398
                                            {"operation": "MEASURE"},
399
                                        ],
400
                                        "repetitions": 5,
401
                                    }
402
                                ]
403
                            },
404
                        },
405
                        "response": {"finished_count": 0, "status": "ongoing"},
406
                    },
407
                },
408
                {
409
                    "description": (
410
                        "Job that created an error while being processed by the Quantum"
411
                        " computer"
412
                    ),
413
                    "summary": "Failed Job",
414
                    "value": {
415
                        "job": {
416
                            "job_id": "ccaa39de-d0f3-4c8b-bdb1-4d74f0c2f450",
417
                            "job_type": "quantum_circuit",
418
                            "label": "Example computation",
419
                            "payload": {
420
                                "circuits": [
421
                                    {
422
                                        "number_of_qubits": 2,
423
                                        "quantum_circuit": [
424
                                            {"operation": "RZ", "phi": 0.5, "qubit": 0},
425
                                            {
426
                                                "operation": "R",
427
                                                "phi": 0.25,
428
                                                "qubit": 1,
429
                                                "theta": 0.5,
430
                                            },
431
                                            {
432
                                                "operation": "RXX",
433
                                                "qubits": [0, 1],
434
                                                "theta": 0.5,
435
                                            },
436
                                            {"operation": "MEASURE"},
437
                                        ],
438
                                        "repetitions": 5,
439
                                    }
440
                                ]
441
                            },
442
                        },
443
                        "response": {
444
                            "message": "detailed error message",
445
                            "status": "error",
446
                        },
447
                    },
448
                },
449
                {
450
                    "description": (
451
                        "Job that has been cancelled by the user, before it could be"
452
                        " processed by the Quantum computer"
453
                    ),
454
                    "summary": "Cancelled Job",
455
                    "value": {
456
                        "job": {
457
                            "job_id": "ccaa39de-d0f3-4c8b-bdb1-4d74f0c2f450",
458
                            "job_type": "quantum_circuit",
459
                            "label": "Example computation",
460
                            "payload": {
461
                                "circuits": [
462
                                    {
463
                                        "number_of_qubits": 2,
464
                                        "quantum_circuit": [
465
                                            {"operation": "RZ", "phi": 0.5, "qubit": 0},
466
                                            {
467
                                                "operation": "R",
468
                                                "phi": 0.25,
469
                                                "qubit": 1,
470
                                                "theta": 0.5,
471
                                            },
472
                                            {
473
                                                "operation": "RXX",
474
                                                "qubits": [0, 1],
475
                                                "theta": 0.5,
476
                                            },
477
                                            {"operation": "MEASURE"},
478
                                        ],
479
                                        "repetitions": 5,
480
                                    }
481
                                ]
482
                            },
483
                        },
484
                        "response": {"status": "cancelled"},
485
                    },
486
                },
487
                {
488
                    "description": (
489
                        "Job that has been successfully processed by a quantum computer"
490
                        " or simulator"
491
                    ),
492
                    "summary": "Finished Job",
493
                    "value": {
494
                        "job": {
495
                            "job_id": "ccaa39de-d0f3-4c8b-bdb1-4d74f0c2f450",
496
                            "job_type": "quantum_circuit",
497
                            "label": "Example computation",
498
                            "payload": {
499
                                "circuits": [
500
                                    {
501
                                        "number_of_qubits": 2,
502
                                        "quantum_circuit": [
503
                                            {"operation": "RZ", "phi": 0.5, "qubit": 0},
504
                                            {
505
                                                "operation": "R",
506
                                                "phi": 0.25,
507
                                                "qubit": 1,
508
                                                "theta": 0.5,
509
                                            },
510
                                            {
511
                                                "operation": "RXX",
512
                                                "qubits": [0, 1],
513
                                                "theta": 0.5,
514
                                            },
515
                                            {"operation": "MEASURE"},
516
                                        ],
517
                                        "repetitions": 5,
518
                                    }
519
                                ]
520
                            },
521
                        },
522
                        "response": {
523
                            "result": {"0": [[1, 0], [1, 1], [0, 0], [1, 1], [1, 1]]},
524
                            "status": "finished",
525
                        },
526
                    },
527
                },
528
                {
529
                    "description": "The supplied job id could not be found",
530
                    "summary": "Unknown Job",
531
                    "value": {
532
                        "job_id": "3aa8b827-4ff0-4a36-b1a6-f9ff6dee59ce",
533
                        "message": "unknown job_id",
534
                    },
535
                },
536
            ],
537
            title="ResultResponse",
538
        ),
539
    ]
540

541

542
class JobSubmission(BaseModel):
4✔
543
    model_config = ConfigDict(
4✔
544
        frozen=True,
545
    )
546
    job_type: Annotated[
4✔
547
        Literal["quantum_circuit"], Field("quantum_circuit", title="Job Type")
548
    ]
549
    label: Annotated[Optional[str], Field(None, title="Label")]
4✔
550
    payload: QuantumCircuits
4✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc