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.
# CloudDirectoryClient usage example
from boto3.session import Session
session = Session()
client = session.client("clouddirectory") # (1)
result = client.apply_schema() # (2)
- client: CloudDirectoryClient
- result: ApplySchemaResponseTypeDef
# 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)
- client: CloudDirectoryClient
- paginator: ListAppliedSchemaArnsPaginator
- 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.
# 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 ApplySchemaRequestRequestTypeDef
session = Session()
client: CloudDirectoryClient = session.client("clouddirectory")
kwargs: ApplySchemaRequestRequestTypeDef = {...}
result: ApplySchemaResponseTypeDef = client.apply_schema(**kwargs)
# 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)