Skip to content

Examples#

Index > LookoutforVision > Examples

Auto-generated documentation for LookoutforVision type annotations stubs module mypy-boto3-lookoutvision.

Client#

Implicit type annotations#

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

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

# LookoutforVisionClient usage example

from boto3.session import Session


session = Session()

client = session.client("lookoutvision")  # (1)
result = client.create_dataset()  # (2)
  1. client: LookoutforVisionClient
  2. result: CreateDatasetResponseTypeDef
# ListDatasetEntriesPaginator usage example

from boto3.session import Session


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

paginator = client.get_paginator("list_dataset_entries")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: LookoutforVisionClient
  2. paginator: ListDatasetEntriesPaginator
  3. item: ListDatasetEntriesResponseTypeDef

Explicit type annotations#

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

# LookoutforVisionClient usage example with type annotations

from boto3.session import Session

from mypy_boto3_lookoutvision.client import LookoutforVisionClient
from mypy_boto3_lookoutvision.type_defs import CreateDatasetResponseTypeDef
from mypy_boto3_lookoutvision.type_defs import CreateDatasetRequestRequestTypeDef


session = Session()

client: LookoutforVisionClient = session.client("lookoutvision")

kwargs: CreateDatasetRequestRequestTypeDef = {...}
result: CreateDatasetResponseTypeDef = client.create_dataset(**kwargs)
# ListDatasetEntriesPaginator usage example with type annotations

from boto3.session import Session

from mypy_boto3_lookoutvision.client import LookoutforVisionClient
from mypy_boto3_lookoutvision.paginator import ListDatasetEntriesPaginator
from mypy_boto3_lookoutvision.type_defs import ListDatasetEntriesResponseTypeDef


session = Session()
client: LookoutforVisionClient = session.client("lookoutvision")

paginator: ListDatasetEntriesPaginator = client.get_paginator("list_dataset_entries")
for item in paginator.paginate(...):
    item: ListDatasetEntriesResponseTypeDef
    print(item)