Skip to content

Examples#

Index > ResourceExplorer > Examples

Auto-generated documentation for ResourceExplorer type annotations stubs module mypy-boto3-resource-explorer-2.

Client#

Implicit type annotations#

Can be used with boto3-stubs[resource-explorer-2] package installed.

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

# ResourceExplorerClient usage example

from boto3.session import Session


session = Session()

client = session.client("resource-explorer-2")  # (1)
result = client.associate_default_view()  # (2)
  1. client: ResourceExplorerClient
  2. result: AssociateDefaultViewOutputTypeDef
# ListIndexesForMembersPaginator usage example

from boto3.session import Session


session = Session()
client = session.client("resource-explorer-2")  # (1)

paginator = client.get_paginator("list_indexes_for_members")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: ResourceExplorerClient
  2. paginator: ListIndexesForMembersPaginator
  3. item: ListIndexesForMembersOutputTypeDef

Explicit type annotations#

With boto3-stubs-lite[resource-explorer-2] or a standalone mypy_boto3_resource_explorer_2 package, you have to explicitly specify client: ResourceExplorerClient 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.

# ResourceExplorerClient usage example with type annotations

from boto3.session import Session

from mypy_boto3_resource_explorer_2.client import ResourceExplorerClient
from mypy_boto3_resource_explorer_2.type_defs import AssociateDefaultViewOutputTypeDef
from mypy_boto3_resource_explorer_2.type_defs import AssociateDefaultViewInputRequestTypeDef


session = Session()

client: ResourceExplorerClient = session.client("resource-explorer-2")

kwargs: AssociateDefaultViewInputRequestTypeDef = {...}
result: AssociateDefaultViewOutputTypeDef = client.associate_default_view(**kwargs)
# ListIndexesForMembersPaginator usage example with type annotations

from boto3.session import Session

from mypy_boto3_resource_explorer_2.client import ResourceExplorerClient
from mypy_boto3_resource_explorer_2.paginator import ListIndexesForMembersPaginator
from mypy_boto3_resource_explorer_2.type_defs import ListIndexesForMembersOutputTypeDef


session = Session()
client: ResourceExplorerClient = session.client("resource-explorer-2")

paginator: ListIndexesForMembersPaginator = client.get_paginator("list_indexes_for_members")
for item in paginator.paginate(...):
    item: ListIndexesForMembersOutputTypeDef
    print(item)