Examples#
Index > ElasticInference > Examples
Auto-generated documentation for ElasticInference type annotations stubs module types-boto3-elastic-inference.
Client#
Implicit type annotations#
Can be used with types-boto3[elastic-inference]
package installed.
Write your ElasticInference
code as usual,
type checking and code completion should work out of the box.
# ElasticInferenceClient usage example
from boto3.session import Session
session = Session()
client = session.client("elastic-inference") # (1)
result = client.describe_accelerator_offerings() # (2)
- client: ElasticInferenceClient
- result: DescribeAcceleratorOfferingsResponseTypeDef
# DescribeAcceleratorsPaginator usage example
from boto3.session import Session
session = Session()
client = session.client("elastic-inference") # (1)
paginator = client.get_paginator("describe_accelerators") # (2)
for item in paginator.paginate(...):
print(item) # (3)
- client: ElasticInferenceClient
- paginator: DescribeAcceleratorsPaginator
- item: DescribeAcceleratorsResponseTypeDef
Explicit type annotations#
With types-boto3-lite[elastic-inference]
or a standalone types_boto3_elastic_inference
package, you have to explicitly specify client: ElasticInferenceClient
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.
# ElasticInferenceClient usage example with type annotations
from boto3.session import Session
from types_boto3_elastic_inference.client import ElasticInferenceClient
from types_boto3_elastic_inference.type_defs import DescribeAcceleratorOfferingsResponseTypeDef
from types_boto3_elastic_inference.type_defs import DescribeAcceleratorOfferingsRequestRequestTypeDef
session = Session()
client: ElasticInferenceClient = session.client("elastic-inference")
kwargs: DescribeAcceleratorOfferingsRequestRequestTypeDef = {...}
result: DescribeAcceleratorOfferingsResponseTypeDef = client.describe_accelerator_offerings(**kwargs)
# DescribeAcceleratorsPaginator usage example with type annotations
from boto3.session import Session
from types_boto3_elastic_inference.client import ElasticInferenceClient
from types_boto3_elastic_inference.paginator import DescribeAcceleratorsPaginator
from types_boto3_elastic_inference.type_defs import DescribeAcceleratorsResponseTypeDef
session = Session()
client: ElasticInferenceClient = session.client("elastic-inference")
paginator: DescribeAcceleratorsPaginator = client.get_paginator("describe_accelerators")
for item in paginator.paginate(...):
item: DescribeAcceleratorsResponseTypeDef
print(item)