Skip to content

Examples#

Index > Finspace > Examples

Auto-generated documentation for Finspace type annotations stubs module mypy-boto3-finspace.

Client#

Implicit type annotations#

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

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

# FinspaceClient usage example

from boto3.session import Session


session = Session()

client = session.client("finspace")  # (1)
result = client.create_environment()  # (2)
  1. client: FinspaceClient
  2. result: CreateEnvironmentResponseTypeDef
# ListKxEnvironmentsPaginator usage example

from boto3.session import Session


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

paginator = client.get_paginator("list_kx_environments")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: FinspaceClient
  2. paginator: ListKxEnvironmentsPaginator
  3. item: ListKxEnvironmentsResponseTypeDef

Explicit type annotations#

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

# FinspaceClient usage example with type annotations

from boto3.session import Session

from mypy_boto3_finspace.client import FinspaceClient
from mypy_boto3_finspace.type_defs import CreateEnvironmentResponseTypeDef
from mypy_boto3_finspace.type_defs import CreateEnvironmentRequestRequestTypeDef


session = Session()

client: FinspaceClient = session.client("finspace")

kwargs: CreateEnvironmentRequestRequestTypeDef = {...}
result: CreateEnvironmentResponseTypeDef = client.create_environment(**kwargs)
# ListKxEnvironmentsPaginator usage example with type annotations

from boto3.session import Session

from mypy_boto3_finspace.client import FinspaceClient
from mypy_boto3_finspace.paginator import ListKxEnvironmentsPaginator
from mypy_boto3_finspace.type_defs import ListKxEnvironmentsResponseTypeDef


session = Session()
client: FinspaceClient = session.client("finspace")

paginator: ListKxEnvironmentsPaginator = client.get_paginator("list_kx_environments")
for item in paginator.paginate(...):
    item: ListKxEnvironmentsResponseTypeDef
    print(item)