Coverage for src/braket/device_schema/simulators/gate_model_simulator_device_capabilities_v1.py : 100%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1# Copyright 2019-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2#
3# Licensed under the Apache License, Version 2.0 (the "License"). You
4# may not use this file except in compliance with the License. A copy of
5# the License is located at
6#
7# http://aws.amazon.com/apache2.0/
8#
9# or in the "license" file accompanying this file. This file is
10# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11# ANY KIND, either express or implied. See the License for the specific
12# language governing permissions and limitations under the License.
14from typing import Dict
16from pydantic import Field
18from braket.device_schema.device_action_properties import DeviceActionType
19from braket.device_schema.device_capabilities import DeviceCapabilities
20from braket.device_schema.jaqcd_device_action_properties import JaqcdDeviceActionProperties
21from braket.device_schema.simulators.gate_model_simulator_device_parameters_v1 import (
22 GateModelSimulatorDeviceParameters,
23)
24from braket.device_schema.simulators.gate_model_simulator_paradigm_properties_v1 import (
25 GateModelSimulatorParadigmProperties,
26)
27from braket.schema_common import BraketSchemaBase, BraketSchemaHeader
30class GateModelSimulatorDeviceCapabilities(BraketSchemaBase, DeviceCapabilities):
31 """
32 This defines the capabilities of a simulator device.
34 Attributes:
35 action: Actions that a simulator device can support
36 paradigm: Paradigm properties of a simulator
38 Examples:
39 >>> import json
40 >>> input_json = {
41 ... "braketSchemaHeader": {
42 ... "name": "braket.device_schema.simulators.gate_model_simulator_device_capabilities",
43 ... "version": "1",
44 ... },
45 ... "service": {
46 ... "braketSchemaHeader": {
47 ... "name": "braket.device_schema.device_service_properties",
48 ... "version": "1",
49 ... },
50 ... "executionWindows": [
51 ... {
52 ... "executionDay": "Everyday",
53 ... "windowStartHour": "1966280412345.6789",
54 ... "windowEndHour": "1966280414345.6789",
55 ... }
56 ... ],
57 ... "shotsRange": [1, 10],
58 ... "deviceCost": {
59 ... "price": 0.25,
60 ... "unit": "minute"
61 ... },
62 ... "deviceDocumentation": {
63 ... "imageUrl": "image_url",
64 ... "summary": "Summary on the device",
65 ... "externalDocumentationUrl": "exter doc link",
66 ... },
67 ... "deviceLocation": "us-east-1"
68 ... },
69 ... "action": {
70 ... "braket.ir.jaqcd.program": {
71 ... "actionType": "braket.ir.jaqcd.program",
72 ... "version": ["1.0", "1.1"],
73 ... "supportedOperations": ["x", "y"],
74 ... "supportedResultTypes":[{
75 ... "name": "resultType1",
76 ... "observables": ["observable1"],
77 ... "minShots": 0,
78 ... "maxShots": 4,
79 ... }],
80 ... }
81 ... },
82 ... "paradigm": {
83 ... "braketSchemaHeader": {
84 ... "name": "braket.device_schema.simulators.gate_model_simulator_paradigm_properties",
85 ... "version": "1",
86 ... },
87 ... "qubitCount": 31
88 ... },
89 ... "deviceParameters": {GateModelSimulatorDeviceParameters.schema_json()},
90 ... }
91 >>> GateModelSimulatorDeviceCapabilities.parse_raw_schema(json.dumps(input_json))
93 """
95 _PROGRAM_HEADER = BraketSchemaHeader(
96 name="braket.device_schema.simulators.gate_model_simulator_device_capabilities", version="1"
97 )
98 braketSchemaHeader: BraketSchemaHeader = Field(default=_PROGRAM_HEADER, const=_PROGRAM_HEADER)
99 action: Dict[DeviceActionType, JaqcdDeviceActionProperties]
100 paradigm: GateModelSimulatorParadigmProperties