Skip to content

Examples#

Index > Detective > Examples

Auto-generated documentation for Detective type annotations stubs module mypy-boto3-detective.

Client#

Implicit type annotations#

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

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

# DetectiveClient usage example

from boto3.session import Session


session = Session()

client = session.client("detective")  # (1)
result = client.accept_invitation()  # (2)
  1. client: DetectiveClient
  2. result: EmptyResponseMetadataTypeDef

Explicit type annotations#

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

# DetectiveClient usage example with type annotations

from boto3.session import Session

from mypy_boto3_detective.client import DetectiveClient
from mypy_boto3_detective.type_defs import EmptyResponseMetadataTypeDef
from mypy_boto3_detective.type_defs import AcceptInvitationRequestRequestTypeDef


session = Session()

client: DetectiveClient = session.client("detective")

kwargs: AcceptInvitationRequestRequestTypeDef = {...}
result: EmptyResponseMetadataTypeDef = client.accept_invitation(**kwargs)