Skip to content

Examples#

Index > mgn > 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.

# mgnClient usage example

from boto3.session import Session


session = Session()

client = session.client("mgn")  # (1)
result = client.archive_application()  # (2)
  1. client: mgnClient
  2. result: ApplicationResponseTypeDef
# DescribeJobLogItemsPaginator 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)
  1. client: mgnClient
  2. paginator: DescribeJobLogItemsPaginator
  3. 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.

# mgnClient usage example with type annotations

from boto3.session import Session

from mypy_boto3_mgn.client import mgnClient
from mypy_boto3_mgn.type_defs import ApplicationResponseTypeDef
from mypy_boto3_mgn.type_defs import ArchiveApplicationRequestRequestTypeDef


session = Session()

client: mgnClient = session.client("mgn")

kwargs: ArchiveApplicationRequestRequestTypeDef = {...}
result: ApplicationResponseTypeDef = client.archive_application(**kwargs)
# DescribeJobLogItemsPaginator usage example with type annotations

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)