Skip to content

refactor(batch): use standard collections for types #6475

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 5 commits into from
Apr 15, 2025
Merged
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/batch/base.py
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@
import sys
from abc import ABC, abstractmethod
from enum import Enum
from typing import TYPE_CHECKING, Any, Callable, Tuple, Union, overload
from typing import TYPE_CHECKING, Any, Tuple, Union, overload

from aws_lambda_powertools.shared import constants
from aws_lambda_powertools.utilities.batch.exceptions import (
@@ -31,6 +31,8 @@
from aws_lambda_powertools.utilities.data_classes.sqs_event import SQSRecord

if TYPE_CHECKING:
from collections.abc import Callable

from aws_lambda_powertools.utilities.batch.types import (
PartialItemFailureResponse,
PartialItemFailures,
4 changes: 3 additions & 1 deletion aws_lambda_powertools/utilities/batch/decorators.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

import warnings
from typing import TYPE_CHECKING, Any, Awaitable, Callable
from typing import TYPE_CHECKING, Any

from typing_extensions import deprecated

@@ -16,6 +16,8 @@
from aws_lambda_powertools.warnings import PowertoolsDeprecationWarning

if TYPE_CHECKING:
from collections.abc import Awaitable, Callable

from aws_lambda_powertools.utilities.batch.types import PartialItemFailureResponse
from aws_lambda_powertools.utilities.typing import LambdaContext

Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
from __future__ import annotations

import json
import uuid
from random import randint
from typing import Any, Awaitable, Callable, Dict
from typing import TYPE_CHECKING, Any

import pytest

@@ -26,6 +28,9 @@
from aws_lambda_powertools.warnings import PowertoolsDeprecationWarning
from tests.functional.utils import b64_to_str, str_to_b64

if TYPE_CHECKING:
from collections.abc import Awaitable, Callable


@pytest.fixture(scope="module")
def sqs_event_fifo_factory() -> Callable:
@@ -169,7 +174,7 @@ def handler(record: DynamoDBRecord):

@pytest.fixture(scope="module")
def order_event_factory() -> Callable:
def factory(item: Dict) -> str:
def factory(item: dict[str, Any]) -> str:
return json.dumps({"item": item})

return factory