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