Skip to content

Examples#

Index > Schemas > Examples

Auto-generated documentation for Schemas type annotations stubs module mypy-boto3-schemas.

Client#

Implicit type annotations#

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

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

Client method usage example#

# SchemasClient usage example

from boto3.session import Session


session = Session()

client = session.client("schemas")  # (1)
result = client.create_discoverer()  # (2)
  1. client: SchemasClient
  2. result: CreateDiscovererResponseTypeDef

Paginator usage example#

# ListDiscoverersPaginator usage example

from boto3.session import Session


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

paginator = client.get_paginator("list_discoverers")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: SchemasClient
  2. paginator: ListDiscoverersPaginator
  3. item: ListDiscoverersResponseTypeDef

Waiter usage example#

# CodeBindingExistsWaiter usage example

from boto3.session import Session


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

waiter = client.get_waiter("code_binding_exists")  # (2)
waiter.wait(...)
  1. client: SchemasClient
  2. waiter: CodeBindingExistsWaiter

Explicit type annotations#

With boto3-stubs-lite[schemas] or a standalone mypy_boto3_schemas package, you have to explicitly specify client: SchemasClient 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#

# SchemasClient usage example with type annotations

from boto3.session import Session

from mypy_boto3_schemas.client import SchemasClient
from mypy_boto3_schemas.type_defs import CreateDiscovererResponseTypeDef
from mypy_boto3_schemas.type_defs import CreateDiscovererRequestTypeDef


session = Session()

client: SchemasClient = session.client("schemas")

kwargs: CreateDiscovererRequestTypeDef = {...}
result: CreateDiscovererResponseTypeDef = client.create_discoverer(**kwargs)

Paginator usage example#

# ListDiscoverersPaginator usage example with type annotations

from boto3.session import Session

from mypy_boto3_schemas.client import SchemasClient
from mypy_boto3_schemas.paginator import ListDiscoverersPaginator
from mypy_boto3_schemas.type_defs import ListDiscoverersResponseTypeDef


session = Session()
client: SchemasClient = session.client("schemas")

paginator: ListDiscoverersPaginator = client.get_paginator("list_discoverers")
for item in paginator.paginate(...):
    item: ListDiscoverersResponseTypeDef
    print(item)

Waiter usage example#

# CodeBindingExistsWaiter usage example with type annotations

from boto3.session import Session

from mypy_boto3_schemas.client import SchemasClient
from mypy_boto3_schemas.waiter import CodeBindingExistsWaiter

session = Session()
client: SchemasClient = session.client("schemas")

waiter: CodeBindingExistsWaiter = client.get_waiter("code_binding_exists")
waiter.wait(...)