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