Skip to content

Examples#

Index > EMRServerless > Examples

Auto-generated documentation for EMRServerless type annotations stubs module mypy-boto3-emr-serverless.

Client#

Implicit type annotations#

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

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

Client method usage example#

# EMRServerlessClient usage example

from boto3.session import Session


session = Session()

client = session.client("emr-serverless")  # (1)
result = client.cancel_job_run()  # (2)
  1. client: EMRServerlessClient
  2. result: CancelJobRunResponseTypeDef

Paginator usage example#

# ListApplicationsPaginator usage example

from boto3.session import Session


session = Session()
client = session.client("emr-serverless")  # (1)

paginator = client.get_paginator("list_applications")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: EMRServerlessClient
  2. paginator: ListApplicationsPaginator
  3. item: ListApplicationsResponseTypeDef

Explicit type annotations#

With boto3-stubs-lite[emr-serverless] or a standalone mypy_boto3_emr_serverless package, you have to explicitly specify client: EMRServerlessClient 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#

# EMRServerlessClient usage example with type annotations

from boto3.session import Session

from mypy_boto3_emr_serverless.client import EMRServerlessClient
from mypy_boto3_emr_serverless.type_defs import CancelJobRunResponseTypeDef
from mypy_boto3_emr_serverless.type_defs import CancelJobRunRequestTypeDef


session = Session()

client: EMRServerlessClient = session.client("emr-serverless")

kwargs: CancelJobRunRequestTypeDef = {...}
result: CancelJobRunResponseTypeDef = client.cancel_job_run(**kwargs)

Paginator usage example#

# ListApplicationsPaginator usage example with type annotations

from boto3.session import Session

from mypy_boto3_emr_serverless.client import EMRServerlessClient
from mypy_boto3_emr_serverless.paginator import ListApplicationsPaginator
from mypy_boto3_emr_serverless.type_defs import ListApplicationsResponseTypeDef


session = Session()
client: EMRServerlessClient = session.client("emr-serverless")

paginator: ListApplicationsPaginator = client.get_paginator("list_applications")
for item in paginator.paginate(...):
    item: ListApplicationsResponseTypeDef
    print(item)