Examples#
Index > MigrationHub > Examples
Auto-generated documentation for MigrationHub type annotations stubs module mypy-boto3-mgh.
Client#
Implicit type annotations#
Can be used with boto3-stubs[mgh]
package installed.
Write your MigrationHub
code as usual,
type checking and code completion should work out of the box.
Client method usage example#
# MigrationHubClient usage example
from boto3.session import Session
session = Session()
client = session.client("mgh") # (1)
result = client.describe_application_state() # (2)
- client: MigrationHubClient
- result: DescribeApplicationStateResultTypeDef
Paginator usage example#
# ListApplicationStatesPaginator usage example
from boto3.session import Session
session = Session()
client = session.client("mgh") # (1)
paginator = client.get_paginator("list_application_states") # (2)
for item in paginator.paginate(...):
print(item) # (3)
- client: MigrationHubClient
- paginator: ListApplicationStatesPaginator
- item: ListApplicationStatesResultTypeDef
Explicit type annotations#
With boto3-stubs-lite[mgh]
or a standalone mypy_boto3_mgh
package, you have to explicitly specify client: MigrationHubClient
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#
# MigrationHubClient usage example with type annotations
from boto3.session import Session
from mypy_boto3_mgh.client import MigrationHubClient
from mypy_boto3_mgh.type_defs import DescribeApplicationStateResultTypeDef
from mypy_boto3_mgh.type_defs import DescribeApplicationStateRequestTypeDef
session = Session()
client: MigrationHubClient = session.client("mgh")
kwargs: DescribeApplicationStateRequestTypeDef = {...}
result: DescribeApplicationStateResultTypeDef = client.describe_application_state(**kwargs)
Paginator usage example#
# ListApplicationStatesPaginator usage example with type annotations
from boto3.session import Session
from mypy_boto3_mgh.client import MigrationHubClient
from mypy_boto3_mgh.paginator import ListApplicationStatesPaginator
from mypy_boto3_mgh.type_defs import ListApplicationStatesResultTypeDef
session = Session()
client: MigrationHubClient = session.client("mgh")
paginator: ListApplicationStatesPaginator = client.get_paginator("list_application_states")
for item in paginator.paginate(...):
item: ListApplicationStatesResultTypeDef
print(item)