Skip to content

Examples#

Index > Artifact > Examples

Auto-generated documentation for Artifact type annotations stubs module mypy-boto3-artifact.

Client#

Implicit type annotations#

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

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

# ArtifactClient usage example

from boto3.session import Session


session = Session()

client = session.client("artifact")  # (1)
result = client.get_report()  # (2)
  1. client: ArtifactClient
  2. result: GetReportResponseTypeDef
# ListReportsPaginator usage example

from boto3.session import Session


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

paginator = client.get_paginator("list_reports")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: ArtifactClient
  2. paginator: ListReportsPaginator
  3. item: ListReportsResponseTypeDef

Explicit type annotations#

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

# ArtifactClient usage example with type annotations

from boto3.session import Session

from mypy_boto3_artifact.client import ArtifactClient
from mypy_boto3_artifact.type_defs import GetReportResponseTypeDef
from mypy_boto3_artifact.type_defs import GetReportRequestRequestTypeDef


session = Session()

client: ArtifactClient = session.client("artifact")

kwargs: GetReportRequestRequestTypeDef = {...}
result: GetReportResponseTypeDef = client.get_report(**kwargs)
# ListReportsPaginator usage example with type annotations

from boto3.session import Session

from mypy_boto3_artifact.client import ArtifactClient
from mypy_boto3_artifact.paginator import ListReportsPaginator
from mypy_boto3_artifact.type_defs import ListReportsResponseTypeDef


session = Session()
client: ArtifactClient = session.client("artifact")

paginator: ListReportsPaginator = client.get_paginator("list_reports")
for item in paginator.paginate(...):
    item: ListReportsResponseTypeDef
    print(item)