Hide keyboard shortcuts

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. 

13 

14from typing import Dict 

15 

16from pydantic import BaseModel 

17 

18from braket.device_schema.device_action_properties import DeviceActionProperties, DeviceActionType 

19from braket.device_schema.device_service_properties_v1 import DeviceServiceProperties 

20 

21 

22class DeviceCapabilities(BaseModel): 

23 """ 

24 DeviceCapabilities are the properties specific to device, this schema defines what is common 

25 across all the devices 

26 

27 Attributes: 

28 service: properties which are common to the braket service 

29 action: Map of the action to its properties 

30 deviceParameters: It is the json schema of the deviceParameters for each device. for 

31 example the deviceParameter for IonqDeviceCapabilities will be 

32 IonqDeviceParameters.json_schema() 

33 

34 Examples: 

35 >>> import json 

36 >>> input_json = { 

37 ... "service": { 

38 ... "braketSchemaHeader": { 

39 ... "name": "braket.device_schema.device_service_properties", 

40 ... "version": "1", 

41 ... }, 

42 ... "executionWindows": [ 

43 ... { 

44 ... "executionDay": "Everyday", 

45 ... "windowStartHour": "1966280412345.6789", 

46 ... "windowEndHour": "1966280414345.6789", 

47 ... } 

48 ... ], 

49 ... "shotsRange": [1, 10], 

50 ... "deviceCost": { 

51 ... "price": 0.25, 

52 ... "unit": "minute" 

53 ... }, 

54 ... "deviceDocumentation": { 

55 ... "imageUrl": "image_url", 

56 ... "summary": "Summary on the device", 

57 ... "externalDocumentationUrl": "exter doc link", 

58 ... }, 

59 ... "deviceLocation": "us-east-1" 

60 ... }, 

61 ... "action": { 

62 ... "braket.ir.jaqcd.program": { 

63 ... "actionType": "braket.ir.jaqcd.program", 

64 ... "version": ["1.0", "1.1"], 

65 ... } 

66 ... }, 

67 ... "deviceParameters": {#Schema of specific device parameter instance}, 

68 ... } 

69 >>> DeviceCapabilities.parse_raw(json.dumps(input_json)) 

70 """ 

71 

72 service: DeviceServiceProperties 

73 action: Dict[DeviceActionType, DeviceActionProperties] 

74 deviceParameters: dict