Coverage for src/braket/device_schema/jaqcd_device_action_properties.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 List, Optional
16from pydantic import BaseModel
18from braket.device_schema.device_action_properties import DeviceActionProperties
21class ResultType(BaseModel):
22 """
23 This class provides the result type for a quantum task to return.
25 Attributes:
27 name: name of the result type
28 observables: supported result types for this result type.
29 minShots: min shots for the results
30 maxShots: max shots for the results
32 Examples:
33 >>> import json
34 >>> input_json = {
35 ... "name": "resultType1",
36 ... "observables": ["observable1"],
37 ... "minShots": 0,
38 ... "maxShots": 4,
39 ... }
40 >>> ResultType.parse_raw(json.dumps(input_json))
41 """
43 name: str
44 observables: Optional[List[str]]
45 minShots: Optional[int]
46 maxShots: Optional[int]
49class JaqcdDeviceActionProperties(DeviceActionProperties):
51 """
52 This defines the schema for properties for the actions that can be supported by the
53 jaqcd devices
55 Attributes:
56 supportedOperations: operations supported by the jaqcd action
57 supportedResultTypes: result types that are supported by the jaqcd action.
59 Examples:
60 >>> import json
61 >>> input_json = {
62 ... "actionType": "braket.ir.jaqcd.program",
63 ... "version": ["1.0", "1.1"],
64 ... "supportedOperations": ["x", "y"],
65 ... "supportedResultTypes": [{
66 ... "name": "resultType1",
67 ... "observables": ["observable1"],
68 ... "minShots": 0,
69 ... "maxShots": 4,
70 ... }],
71 ... }
72 >>> JaqcdDeviceActionProperties.parse_raw(json.dumps(input_json))
74 """
76 supportedOperations: List[str]
77 supportedResultTypes: Optional[List[ResultType]]