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.get_control()  # (2)
  1. client: ControlCatalogClient
  2. result: GetControlResponseTypeDef
# 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 GetControlResponseTypeDef
from mypy_boto3_controlcatalog.type_defs import GetControlRequestRequestTypeDef


session = Session()

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

kwargs: GetControlRequestRequestTypeDef = {...}
result: GetControlResponseTypeDef = client.get_control(**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)