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.

Client method usage example#

# 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

Paginator usage example#

# 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.

Client method usage example#

# 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 CreateDatasetRequestTypeDef


session = Session()

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

kwargs: CreateDatasetRequestTypeDef = {...}
result: CreateDatasetResponseTypeDef = client.create_dataset(**kwargs)

Paginator usage example#

# 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)