Skip to content

Examples#

Index > Braket > Examples

Auto-generated documentation for Braket type annotations stubs module types-boto3-braket.

Client#

Implicit type annotations#

Can be used with types-boto3[braket] package installed.

Write your Braket code as usual, type checking and code completion should work out of the box.

# BraketClient usage example

from boto3.session import Session


session = Session()

client = session.client("braket")  # (1)
result = client.cancel_job()  # (2)
  1. client: BraketClient
  2. result: CancelJobResponseTypeDef
# SearchDevicesPaginator usage example

from boto3.session import Session


session = Session()
client = session.client("braket")  # (1)

paginator = client.get_paginator("search_devices")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: BraketClient
  2. paginator: SearchDevicesPaginator
  3. item: SearchDevicesResponseTypeDef

Explicit type annotations#

With types-boto3-lite[braket] or a standalone types_boto3_braket package, you have to explicitly specify client: BraketClient type annotation.

All other type annotations are optional, as types should be discovered automatically. However, these type annotations can be helpful in your functions and methods.

# BraketClient usage example with type annotations

from boto3.session import Session

from types_boto3_braket.client import BraketClient
from types_boto3_braket.type_defs import CancelJobResponseTypeDef
from types_boto3_braket.type_defs import CancelJobRequestRequestTypeDef


session = Session()

client: BraketClient = session.client("braket")

kwargs: CancelJobRequestRequestTypeDef = {...}
result: CancelJobResponseTypeDef = client.cancel_job(**kwargs)
# SearchDevicesPaginator usage example with type annotations

from boto3.session import Session

from types_boto3_braket.client import BraketClient
from types_boto3_braket.paginator import SearchDevicesPaginator
from types_boto3_braket.type_defs import SearchDevicesResponseTypeDef


session = Session()
client: BraketClient = session.client("braket")

paginator: SearchDevicesPaginator = client.get_paginator("search_devices")
for item in paginator.paginate(...):
    item: SearchDevicesResponseTypeDef
    print(item)