Skip to content

Examples#

Index > PI > Examples

Auto-generated documentation for PI type annotations stubs module types-boto3-pi.

Client#

Implicit type annotations#

Can be used with types-boto3[pi] package installed.

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

Client method usage example#

# PIClient usage example

from boto3.session import Session


session = Session()

client = session.client("pi")  # (1)
result = client.create_performance_analysis_report()  # (2)
  1. client: PIClient
  2. result: CreatePerformanceAnalysisReportResponseTypeDef

Paginator usage example#

# ListPerformanceAnalysisReportRecommendationsPaginator usage example

from boto3.session import Session


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

paginator = client.get_paginator("list_performance_analysis_report_recommendations")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: PIClient
  2. paginator: ListPerformanceAnalysisReportRecommendationsPaginator
  3. item: ListPerformanceAnalysisReportRecommendationsResponseTypeDef

Explicit type annotations#

With types-boto3-lite[pi] or a standalone types_boto3_pi package, you have to explicitly specify client: PIClient 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#

# PIClient usage example with type annotations

from boto3.session import Session

from types_boto3_pi.client import PIClient
from types_boto3_pi.type_defs import CreatePerformanceAnalysisReportResponseTypeDef
from types_boto3_pi.type_defs import CreatePerformanceAnalysisReportRequestTypeDef


session = Session()

client: PIClient = session.client("pi")

kwargs: CreatePerformanceAnalysisReportRequestTypeDef = {...}
result: CreatePerformanceAnalysisReportResponseTypeDef = client.create_performance_analysis_report(**kwargs)

Paginator usage example#

# ListPerformanceAnalysisReportRecommendationsPaginator usage example with type annotations

from boto3.session import Session

from types_boto3_pi.client import PIClient
from types_boto3_pi.paginator import ListPerformanceAnalysisReportRecommendationsPaginator
from types_boto3_pi.type_defs import ListPerformanceAnalysisReportRecommendationsResponseTypeDef


session = Session()
client: PIClient = session.client("pi")

paginator: ListPerformanceAnalysisReportRecommendationsPaginator = client.get_paginator("list_performance_analysis_report_recommendations")
for item in paginator.paginate(...):
    item: ListPerformanceAnalysisReportRecommendationsResponseTypeDef
    print(item)