Skip to content

Examples#

Index > ControlCatalog > Examples

Auto-generated documentation for ControlCatalog type annotations stubs module mypy-boto3-controlcatalog.

Client#

Implicit type annotations#

Can be used with boto3-stubs[controlcatalog] package installed.

Write your ControlCatalog code as usual, type checking and code completion should work out of the box.

# ControlCatalogClient usage example

from boto3.session import Session


session = Session()

client = session.client("controlcatalog")  # (1)
result = client.list_common_controls()  # (2)
  1. client: ControlCatalogClient
  2. result: ListCommonControlsResponseTypeDef
# ListCommonControlsPaginator usage example

from boto3.session import Session


session = Session()
client = session.client("controlcatalog")  # (1)

paginator = client.get_paginator("list_common_controls")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: ControlCatalogClient
  2. paginator: ListCommonControlsPaginator
  3. item: ListCommonControlsResponseTypeDef

Explicit type annotations#

With boto3-stubs-lite[controlcatalog] or a standalone mypy_boto3_controlcatalog package, you have to explicitly specify client: ControlCatalogClient 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.

# ControlCatalogClient usage example with type annotations

from boto3.session import Session

from mypy_boto3_controlcatalog.client import ControlCatalogClient
from mypy_boto3_controlcatalog.type_defs import ListCommonControlsResponseTypeDef
from mypy_boto3_controlcatalog.type_defs import ListCommonControlsRequestRequestTypeDef


session = Session()

client: ControlCatalogClient = session.client("controlcatalog")

kwargs: ListCommonControlsRequestRequestTypeDef = {...}
result: ListCommonControlsResponseTypeDef = client.list_common_controls(**kwargs)
# ListCommonControlsPaginator usage example with type annotations

from boto3.session import Session

from mypy_boto3_controlcatalog.client import ControlCatalogClient
from mypy_boto3_controlcatalog.paginator import ListCommonControlsPaginator
from mypy_boto3_controlcatalog.type_defs import ListCommonControlsResponseTypeDef


session = Session()
client: ControlCatalogClient = session.client("controlcatalog")

paginator: ListCommonControlsPaginator = client.get_paginator("list_common_controls")
for item in paginator.paginate(...):
    item: ListCommonControlsResponseTypeDef
    print(item)