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.
Client method usage example#
# CodeGuruProfilerClient usage example
from boto3.session import Session
session = Session()
client = session.client("codeguruprofiler") # (1)
result = client.add_notification_channels() # (2)
- client: CodeGuruProfilerClient
- result: AddNotificationChannelsResponseTypeDef
Paginator usage example#
# 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)
- client: CodeGuruProfilerClient
- paginator: ListProfileTimesPaginator
- 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.
Client method usage example#
# 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 AddNotificationChannelsRequestTypeDef
session = Session()
client: CodeGuruProfilerClient = session.client("codeguruprofiler")
kwargs: AddNotificationChannelsRequestTypeDef = {...}
result: AddNotificationChannelsResponseTypeDef = client.add_notification_channels(**kwargs)
Paginator usage example#
# 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)