Skip to content

Examples#

Index > CloudDirectory > Examples

Auto-generated documentation for CloudDirectory type annotations stubs module mypy-boto3-clouddirectory.

Client#

Implicit type annotations#

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

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

Client method usage example#

# CloudDirectoryClient usage example

from boto3.session import Session


session = Session()

client = session.client("clouddirectory")  # (1)
result = client.apply_schema()  # (2)
  1. client: CloudDirectoryClient
  2. result: ApplySchemaResponseTypeDef

Paginator usage example#

# ListAppliedSchemaArnsPaginator usage example

from boto3.session import Session


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

paginator = client.get_paginator("list_applied_schema_arns")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: CloudDirectoryClient
  2. paginator: ListAppliedSchemaArnsPaginator
  3. item: ListAppliedSchemaArnsResponseTypeDef

Explicit type annotations#

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

Client method usage example#

# CloudDirectoryClient usage example with type annotations

from boto3.session import Session

from mypy_boto3_clouddirectory.client import CloudDirectoryClient
from mypy_boto3_clouddirectory.type_defs import ApplySchemaResponseTypeDef
from mypy_boto3_clouddirectory.type_defs import ApplySchemaRequestTypeDef


session = Session()

client: CloudDirectoryClient = session.client("clouddirectory")

kwargs: ApplySchemaRequestTypeDef = {...}
result: ApplySchemaResponseTypeDef = client.apply_schema(**kwargs)

Paginator usage example#

# ListAppliedSchemaArnsPaginator usage example with type annotations

from boto3.session import Session

from mypy_boto3_clouddirectory.client import CloudDirectoryClient
from mypy_boto3_clouddirectory.paginator import ListAppliedSchemaArnsPaginator
from mypy_boto3_clouddirectory.type_defs import ListAppliedSchemaArnsResponseTypeDef


session = Session()
client: CloudDirectoryClient = session.client("clouddirectory")

paginator: ListAppliedSchemaArnsPaginator = client.get_paginator("list_applied_schema_arns")
for item in paginator.paginate(...):
    item: ListAppliedSchemaArnsResponseTypeDef
    print(item)