Skip to content

Examples#

Index > CodeCatalyst > Examples

Auto-generated documentation for CodeCatalyst type annotations stubs module mypy-boto3-codecatalyst.

Client#

Implicit type annotations#

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

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

Client method usage example#

# CodeCatalystClient usage example

from boto3.session import Session


session = Session()

client = session.client("codecatalyst")  # (1)
result = client.create_access_token()  # (2)
  1. client: CodeCatalystClient
  2. result: CreateAccessTokenResponseTypeDef

Paginator usage example#

# ListAccessTokensPaginator usage example

from boto3.session import Session


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

paginator = client.get_paginator("list_access_tokens")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: CodeCatalystClient
  2. paginator: ListAccessTokensPaginator
  3. item: ListAccessTokensResponseTypeDef

Explicit type annotations#

With boto3-stubs-lite[codecatalyst] or a standalone mypy_boto3_codecatalyst package, you have to explicitly specify client: CodeCatalystClient 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#

# CodeCatalystClient usage example with type annotations

from boto3.session import Session

from mypy_boto3_codecatalyst.client import CodeCatalystClient
from mypy_boto3_codecatalyst.type_defs import CreateAccessTokenResponseTypeDef
from mypy_boto3_codecatalyst.type_defs import CreateAccessTokenRequestTypeDef


session = Session()

client: CodeCatalystClient = session.client("codecatalyst")

kwargs: CreateAccessTokenRequestTypeDef = {...}
result: CreateAccessTokenResponseTypeDef = client.create_access_token(**kwargs)

Paginator usage example#

# ListAccessTokensPaginator usage example with type annotations

from boto3.session import Session

from mypy_boto3_codecatalyst.client import CodeCatalystClient
from mypy_boto3_codecatalyst.paginator import ListAccessTokensPaginator
from mypy_boto3_codecatalyst.type_defs import ListAccessTokensResponseTypeDef


session = Session()
client: CodeCatalystClient = session.client("codecatalyst")

paginator: ListAccessTokensPaginator = client.get_paginator("list_access_tokens")
for item in paginator.paginate(...):
    item: ListAccessTokensResponseTypeDef
    print(item)