Skip to content

Examples#

Index > Braket > Examples

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

Client#

Implicit type annotations#

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

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

# BraketClient usage example

from aioboto3.session import Session


session = Session()

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

from aioboto3.session import Session


session = Session()

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

Explicit type annotations#

With types-aioboto3-lite[braket] or a standalone types_aiobotocore_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 aioboto3.session import Session

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


session = Session()

client: BraketClient
async with session.client("braket") as client:  # (1)
    kwargs: CancelJobRequestRequestTypeDef = {...}  # (2)
    result: CancelJobResponseTypeDef = await client.cancel_job(**kwargs)  # (3)
  1. client: BraketClient
  2. kwargs: CancelJobRequestRequestTypeDef
  3. result: CancelJobResponseTypeDef
# SearchDevicesPaginator usage example with type annotations

from aioboto3.session import Session

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


session = Session()

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