Examples#
Index > MachineLearning > Examples
Auto-generated documentation for MachineLearning type annotations stubs module types-boto3-machinelearning.
Client#
Implicit type annotations#
Can be used with types-boto3[machinelearning]
package installed.
Write your MachineLearning
code as usual,
type checking and code completion should work out of the box.
# MachineLearningClient usage example
from boto3.session import Session
session = Session()
client = session.client("machinelearning") # (1)
result = client.add_tags() # (2)
- client: MachineLearningClient
- result: AddTagsOutputTypeDef
# DescribeBatchPredictionsPaginator usage example
from boto3.session import Session
session = Session()
client = session.client("machinelearning") # (1)
paginator = client.get_paginator("describe_batch_predictions") # (2)
for item in paginator.paginate(...):
print(item) # (3)
- client: MachineLearningClient
- paginator: DescribeBatchPredictionsPaginator
- item: DescribeBatchPredictionsOutputTypeDef
# BatchPredictionAvailableWaiter usage example
from boto3.session import Session
session = Session()
client = session.client("machinelearning") # (1)
waiter = client.get_waiter("batch_prediction_available") # (2)
waiter.wait()
- client: MachineLearningClient
- waiter: BatchPredictionAvailableWaiter
Explicit type annotations#
With types-boto3-lite[machinelearning]
or a standalone types_boto3_machinelearning
package, you have to explicitly specify client: MachineLearningClient
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.
# MachineLearningClient usage example with type annotations
from boto3.session import Session
from types_boto3_machinelearning.client import MachineLearningClient
from types_boto3_machinelearning.type_defs import AddTagsOutputTypeDef
from types_boto3_machinelearning.type_defs import AddTagsInputRequestTypeDef
session = Session()
client: MachineLearningClient = session.client("machinelearning")
kwargs: AddTagsInputRequestTypeDef = {...}
result: AddTagsOutputTypeDef = client.add_tags(**kwargs)
# DescribeBatchPredictionsPaginator usage example with type annotations
from boto3.session import Session
from types_boto3_machinelearning.client import MachineLearningClient
from types_boto3_machinelearning.paginator import DescribeBatchPredictionsPaginator
from types_boto3_machinelearning.type_defs import DescribeBatchPredictionsOutputTypeDef
session = Session()
client: MachineLearningClient = session.client("machinelearning")
paginator: DescribeBatchPredictionsPaginator = client.get_paginator("describe_batch_predictions")
for item in paginator.paginate(...):
item: DescribeBatchPredictionsOutputTypeDef
print(item)
# BatchPredictionAvailableWaiter usage example with type annotations
from boto3.session import Session
from types_boto3_machinelearning.client import MachineLearningClient
from types_boto3_machinelearning.waiter import BatchPredictionAvailableWaiter
session = Session()
client: MachineLearningClient = session.client("machinelearning")
waiter: BatchPredictionAvailableWaiter = client.get_waiter("batch_prediction_available")
waiter.wait()