Skip to content

Examples#

Index > ServerlessApplicationRepository > Examples

Auto-generated documentation for ServerlessApplicationRepository type annotations stubs module mypy-boto3-serverlessrepo.

Client#

Implicit type annotations#

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

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

# ServerlessApplicationRepositoryClient usage example

from boto3.session import Session


session = Session()

client = session.client("serverlessrepo")  # (1)
result = client.create_application()  # (2)
  1. client: ServerlessApplicationRepositoryClient
  2. result: CreateApplicationResponseTypeDef
# ListApplicationDependenciesPaginator usage example

from boto3.session import Session


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

paginator = client.get_paginator("list_application_dependencies")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: ServerlessApplicationRepositoryClient
  2. paginator: ListApplicationDependenciesPaginator
  3. item: ListApplicationDependenciesResponseTypeDef

Explicit type annotations#

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

# ServerlessApplicationRepositoryClient usage example with type annotations

from boto3.session import Session

from mypy_boto3_serverlessrepo.client import ServerlessApplicationRepositoryClient
from mypy_boto3_serverlessrepo.type_defs import CreateApplicationResponseTypeDef
from mypy_boto3_serverlessrepo.type_defs import CreateApplicationRequestRequestTypeDef


session = Session()

client: ServerlessApplicationRepositoryClient = session.client("serverlessrepo")

kwargs: CreateApplicationRequestRequestTypeDef = {...}
result: CreateApplicationResponseTypeDef = client.create_application(**kwargs)
# ListApplicationDependenciesPaginator usage example with type annotations

from boto3.session import Session

from mypy_boto3_serverlessrepo.client import ServerlessApplicationRepositoryClient
from mypy_boto3_serverlessrepo.paginator import ListApplicationDependenciesPaginator
from mypy_boto3_serverlessrepo.type_defs import ListApplicationDependenciesResponseTypeDef


session = Session()
client: ServerlessApplicationRepositoryClient = session.client("serverlessrepo")

paginator: ListApplicationDependenciesPaginator = client.get_paginator("list_application_dependencies")
for item in paginator.paginate(...):
    item: ListApplicationDependenciesResponseTypeDef
    print(item)