Skip to content

Examples#

Index > EFS > Examples

Auto-generated documentation for EFS type annotations stubs module mypy-boto3-efs.

Client#

Implicit type annotations#

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

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

Client method usage example#

# EFSClient usage example

from boto3.session import Session


session = Session()

client = session.client("efs")  # (1)
result = client.create_access_point()  # (2)
  1. client: EFSClient
  2. result: AccessPointDescriptionResponseTypeDef

Paginator usage example#

# DescribeAccessPointsPaginator usage example

from boto3.session import Session


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

paginator = client.get_paginator("describe_access_points")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: EFSClient
  2. paginator: DescribeAccessPointsPaginator
  3. item: DescribeAccessPointsResponseTypeDef

Explicit type annotations#

With boto3-stubs-lite[efs] or a standalone mypy_boto3_efs package, you have to explicitly specify client: EFSClient 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#

# EFSClient usage example with type annotations

from boto3.session import Session

from mypy_boto3_efs.client import EFSClient
from mypy_boto3_efs.type_defs import AccessPointDescriptionResponseTypeDef
from mypy_boto3_efs.type_defs import CreateAccessPointRequestTypeDef


session = Session()

client: EFSClient = session.client("efs")

kwargs: CreateAccessPointRequestTypeDef = {...}
result: AccessPointDescriptionResponseTypeDef = client.create_access_point(**kwargs)

Paginator usage example#

# DescribeAccessPointsPaginator usage example with type annotations

from boto3.session import Session

from mypy_boto3_efs.client import EFSClient
from mypy_boto3_efs.paginator import DescribeAccessPointsPaginator
from mypy_boto3_efs.type_defs import DescribeAccessPointsResponseTypeDef


session = Session()
client: EFSClient = session.client("efs")

paginator: DescribeAccessPointsPaginator = client.get_paginator("describe_access_points")
for item in paginator.paginate(...):
    item: DescribeAccessPointsResponseTypeDef
    print(item)