Skip to content

refactor(idempotency): use standard collections for types #6487

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion aws_lambda_powertools/utilities/idempotency/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import datetime
import logging
from copy import deepcopy
from typing import TYPE_CHECKING, Any, Callable
from typing import TYPE_CHECKING, Any

from aws_lambda_powertools.utilities.idempotency.exceptions import (
IdempotencyAlreadyInProgressError,
Expand All @@ -29,6 +29,8 @@
)

if TYPE_CHECKING:
from collections.abc import Callable

from aws_lambda_powertools.utilities.idempotency.config import (
IdempotencyConfig,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import os
import warnings
from inspect import isclass
from typing import TYPE_CHECKING, Any, Callable, cast
from typing import TYPE_CHECKING, Any, cast

from aws_lambda_powertools.middleware_factory import lambda_handler_decorator
from aws_lambda_powertools.shared import constants
Expand All @@ -23,6 +23,8 @@
)

if TYPE_CHECKING:
from collections.abc import Callable

from aws_lambda_powertools.utilities.idempotency.persistence.base import (
BasePersistenceLayer,
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
from __future__ import annotations

from typing import Any, Callable
from typing import TYPE_CHECKING, Any

from aws_lambda_powertools.utilities.idempotency.serialization.base import BaseIdempotencySerializer

if TYPE_CHECKING:
from collections.abc import Callable


class CustomDictSerializer(BaseIdempotencySerializer):
def __init__(self, to_dict: Callable[[Any], dict], from_dict: Callable[[dict], Any]):
Expand Down
2 changes: 2 additions & 0 deletions tests/functional/idempotency/_boto3/conftest.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import datetime
import json
from decimal import Decimal
Expand Down
2 changes: 2 additions & 0 deletions tests/unit/idempotency/test_dynamodb_persistence.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

from dataclasses import dataclass

from aws_lambda_powertools.utilities.idempotency import DynamoDBPersistenceLayer
Expand Down
Loading