Examples#
Index > RecycleBin > Examples
Auto-generated documentation for RecycleBin type annotations stubs module mypy-boto3-rbin.
Client#
Implicit type annotations#
Can be used with boto3-stubs[rbin]
package installed.
Write your RecycleBin
code as usual,
type checking and code completion should work out of the box.
Client method usage example#
# RecycleBinClient usage example
from boto3.session import Session
session = Session()
client = session.client("rbin") # (1)
result = client.create_rule() # (2)
- client: RecycleBinClient
- result: CreateRuleResponseTypeDef
Paginator usage example#
# ListRulesPaginator usage example
from boto3.session import Session
session = Session()
client = session.client("rbin") # (1)
paginator = client.get_paginator("list_rules") # (2)
for item in paginator.paginate(...):
print(item) # (3)
- client: RecycleBinClient
- paginator: ListRulesPaginator
- item: ListRulesResponseTypeDef
Explicit type annotations#
With boto3-stubs-lite[rbin]
or a standalone mypy_boto3_rbin
package, you have to explicitly specify client: RecycleBinClient
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#
# RecycleBinClient usage example with type annotations
from boto3.session import Session
from mypy_boto3_rbin.client import RecycleBinClient
from mypy_boto3_rbin.type_defs import CreateRuleResponseTypeDef
from mypy_boto3_rbin.type_defs import CreateRuleRequestTypeDef
session = Session()
client: RecycleBinClient = session.client("rbin")
kwargs: CreateRuleRequestTypeDef = {...}
result: CreateRuleResponseTypeDef = client.create_rule(**kwargs)
Paginator usage example#
# ListRulesPaginator usage example with type annotations
from boto3.session import Session
from mypy_boto3_rbin.client import RecycleBinClient
from mypy_boto3_rbin.paginator import ListRulesPaginator
from mypy_boto3_rbin.type_defs import ListRulesResponseTypeDef
session = Session()
client: RecycleBinClient = session.client("rbin")
paginator: ListRulesPaginator = client.get_paginator("list_rules")
for item in paginator.paginate(...):
item: ListRulesResponseTypeDef
print(item)