Skip to content

Commit 0bd6994

Browse files
committed
Fix typing
1 parent 8109d2a commit 0bd6994

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

aws_lambda_powertools/utilities/idempotency/idempotency.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,11 @@ def handler(event, context):
9393
config = config or IdempotencyConfig()
9494

9595
if hasattr(context, "state"):
96-
# Extract lambda_context from DurableContext for idempotency tracking
97-
config.register_lambda_context(context.lambda_context)
98-
is_replay = len(context.state.operations) > 1
96+
# Extract lambda_context from DurableContext
97+
durable_context = cast("DurableContext", context)
98+
config.register_lambda_context(durable_context.lambda_context)
99+
# Note: state.operations is accessed via duck typing at runtime
100+
is_replay = len(durable_context.state.operations) > 1 # type: ignore[attr-defined]
99101
else:
100102
# Standard LambdaContext
101103
config.register_lambda_context(context)

0 commit comments

Comments
 (0)