Skip to content

Examples#

Index > CodeGuruProfiler > Examples

Auto-generated documentation for CodeGuruProfiler type annotations stubs module mypy-boto3-codeguruprofiler.

Client#

Implicit type annotations#

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

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

# CodeGuruProfilerClient usage example

from boto3.session import Session


session = Session()

client = session.client("codeguruprofiler")  # (1)
result = client.add_notification_channels()  # (2)
  1. client: CodeGuruProfilerClient
  2. result: AddNotificationChannelsResponseTypeDef
# ListProfileTimesPaginator usage example

from boto3.session import Session


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

paginator = client.get_paginator("list_profile_times")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: CodeGuruProfilerClient
  2. paginator: ListProfileTimesPaginator
  3. item: ListProfileTimesResponseTypeDef

Explicit type annotations#

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

# CodeGuruProfilerClient usage example with type annotations

from boto3.session import Session

from mypy_boto3_codeguruprofiler.client import CodeGuruProfilerClient
from mypy_boto3_codeguruprofiler.type_defs import AddNotificationChannelsResponseTypeDef
from mypy_boto3_codeguruprofiler.type_defs import AddNotificationChannelsRequestRequestTypeDef


session = Session()

client: CodeGuruProfilerClient = session.client("codeguruprofiler")

kwargs: AddNotificationChannelsRequestRequestTypeDef = {...}
result: AddNotificationChannelsResponseTypeDef = client.add_notification_channels(**kwargs)
# ListProfileTimesPaginator usage example with type annotations

from boto3.session import Session

from mypy_boto3_codeguruprofiler.client import CodeGuruProfilerClient
from mypy_boto3_codeguruprofiler.paginator import ListProfileTimesPaginator
from mypy_boto3_codeguruprofiler.type_defs import ListProfileTimesResponseTypeDef


session = Session()
client: CodeGuruProfilerClient = session.client("codeguruprofiler")

paginator: ListProfileTimesPaginator = client.get_paginator("list_profile_times")
for item in paginator.paginate(...):
    item: ListProfileTimesResponseTypeDef
    print(item)