Skip to content

Examples#

Index > DataZone > Examples

Auto-generated documentation for DataZone type annotations stubs module mypy-boto3-datazone.

Client#

Implicit type annotations#

Can be used with boto3-stubs[datazone] package installed.

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

# DataZoneClient usage example

from boto3.session import Session


session = Session()

client = session.client("datazone")  # (1)
result = client.accept_predictions()  # (2)
  1. client: DataZoneClient
  2. result: AcceptPredictionsOutputTypeDef
# ListAssetFiltersPaginator usage example

from boto3.session import Session


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

paginator = client.get_paginator("list_asset_filters")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: DataZoneClient
  2. paginator: ListAssetFiltersPaginator
  3. item: ListAssetFiltersOutputTypeDef

Explicit type annotations#

With boto3-stubs-lite[datazone] or a standalone mypy_boto3_datazone package, you have to explicitly specify client: DataZoneClient 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.

# DataZoneClient usage example with type annotations

from boto3.session import Session

from mypy_boto3_datazone.client import DataZoneClient
from mypy_boto3_datazone.type_defs import AcceptPredictionsOutputTypeDef
from mypy_boto3_datazone.type_defs import AcceptPredictionsInputRequestTypeDef


session = Session()

client: DataZoneClient = session.client("datazone")

kwargs: AcceptPredictionsInputRequestTypeDef = {...}
result: AcceptPredictionsOutputTypeDef = client.accept_predictions(**kwargs)
# ListAssetFiltersPaginator usage example with type annotations

from boto3.session import Session

from mypy_boto3_datazone.client import DataZoneClient
from mypy_boto3_datazone.paginator import ListAssetFiltersPaginator
from mypy_boto3_datazone.type_defs import ListAssetFiltersOutputTypeDef


session = Session()
client: DataZoneClient = session.client("datazone")

paginator: ListAssetFiltersPaginator = client.get_paginator("list_asset_filters")
for item in paginator.paginate(...):
    item: ListAssetFiltersOutputTypeDef
    print(item)