Skip to content

Examples#

Index > NeptuneGraph > Examples

Auto-generated documentation for NeptuneGraph type annotations stubs module mypy-boto3-neptune-graph.

Client#

Implicit type annotations#

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

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

# NeptuneGraphClient usage example

from boto3.session import Session


session = Session()

client = session.client("neptune-graph")  # (1)
result = client.cancel_import_task()  # (2)
  1. client: NeptuneGraphClient
  2. result: CancelImportTaskOutputTypeDef
# ListGraphSnapshotsPaginator usage example

from boto3.session import Session


session = Session()
client = session.client("neptune-graph")  # (1)

paginator = client.get_paginator("list_graph_snapshots")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: NeptuneGraphClient
  2. paginator: ListGraphSnapshotsPaginator
  3. item: ListGraphSnapshotsOutputTypeDef
# GraphAvailableWaiter usage example

from boto3.session import Session


session = Session()
client = session.client("neptune-graph")  # (1)

waiter = client.get_waiter("graph_available")  # (2)
waiter.wait()
  1. client: NeptuneGraphClient
  2. waiter: GraphAvailableWaiter

Explicit type annotations#

With boto3-stubs-lite[neptune-graph] or a standalone mypy_boto3_neptune_graph package, you have to explicitly specify client: NeptuneGraphClient 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.

# NeptuneGraphClient usage example with type annotations

from boto3.session import Session

from mypy_boto3_neptune_graph.client import NeptuneGraphClient
from mypy_boto3_neptune_graph.type_defs import CancelImportTaskOutputTypeDef
from mypy_boto3_neptune_graph.type_defs import CancelImportTaskInputRequestTypeDef


session = Session()

client: NeptuneGraphClient = session.client("neptune-graph")

kwargs: CancelImportTaskInputRequestTypeDef = {...}
result: CancelImportTaskOutputTypeDef = client.cancel_import_task(**kwargs)
# ListGraphSnapshotsPaginator usage example with type annotations

from boto3.session import Session

from mypy_boto3_neptune_graph.client import NeptuneGraphClient
from mypy_boto3_neptune_graph.paginator import ListGraphSnapshotsPaginator
from mypy_boto3_neptune_graph.type_defs import ListGraphSnapshotsOutputTypeDef


session = Session()
client: NeptuneGraphClient = session.client("neptune-graph")

paginator: ListGraphSnapshotsPaginator = client.get_paginator("list_graph_snapshots")
for item in paginator.paginate(...):
    item: ListGraphSnapshotsOutputTypeDef
    print(item)
# GraphAvailableWaiter usage example with type annotations

from boto3.session import Session

from mypy_boto3_neptune_graph.client import NeptuneGraphClient
from mypy_boto3_neptune_graph.waiter import GraphAvailableWaiter

session = Session()
client: NeptuneGraphClient = session.client("neptune-graph")

waiter: GraphAvailableWaiter = client.get_waiter("graph_available")
waiter.wait()