Skip to content

Examples#

Index > CleanRoomsML > Examples

Auto-generated documentation for CleanRoomsML type annotations stubs module mypy-boto3-cleanroomsml.

Client#

Implicit type annotations#

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

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

# CleanRoomsMLClient usage example

from boto3.session import Session


session = Session()

client = session.client("cleanroomsml")  # (1)
result = client.create_audience_model()  # (2)
  1. client: CleanRoomsMLClient
  2. result: CreateAudienceModelResponseTypeDef
# ListAudienceExportJobsPaginator usage example

from boto3.session import Session


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

paginator = client.get_paginator("list_audience_export_jobs")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: CleanRoomsMLClient
  2. paginator: ListAudienceExportJobsPaginator
  3. item: ListAudienceExportJobsResponseTypeDef

Explicit type annotations#

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

# CleanRoomsMLClient usage example with type annotations

from boto3.session import Session

from mypy_boto3_cleanroomsml.client import CleanRoomsMLClient
from mypy_boto3_cleanroomsml.type_defs import CreateAudienceModelResponseTypeDef
from mypy_boto3_cleanroomsml.type_defs import CreateAudienceModelRequestRequestTypeDef


session = Session()

client: CleanRoomsMLClient = session.client("cleanroomsml")

kwargs: CreateAudienceModelRequestRequestTypeDef = {...}
result: CreateAudienceModelResponseTypeDef = client.create_audience_model(**kwargs)
# ListAudienceExportJobsPaginator usage example with type annotations

from boto3.session import Session

from mypy_boto3_cleanroomsml.client import CleanRoomsMLClient
from mypy_boto3_cleanroomsml.paginator import ListAudienceExportJobsPaginator
from mypy_boto3_cleanroomsml.type_defs import ListAudienceExportJobsResponseTypeDef


session = Session()
client: CleanRoomsMLClient = session.client("cleanroomsml")

paginator: ListAudienceExportJobsPaginator = client.get_paginator("list_audience_export_jobs")
for item in paginator.paginate(...):
    item: ListAudienceExportJobsResponseTypeDef
    print(item)