Skip to content

Commit 631b713

Browse files
refactor(batch): use standard collections for types (#6475)
* Using generics types * Using generics types * Using generics types * Using generics types
1 parent b5f6bec commit 631b713

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

aws_lambda_powertools/utilities/batch/base.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import sys
1515
from abc import ABC, abstractmethod
1616
from enum import Enum
17-
from typing import TYPE_CHECKING, Any, Callable, Tuple, Union, overload
17+
from typing import TYPE_CHECKING, Any, Tuple, Union, overload
1818

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

3333
if TYPE_CHECKING:
34+
from collections.abc import Callable
35+
3436
from aws_lambda_powertools.utilities.batch.types import (
3537
PartialItemFailureResponse,
3638
PartialItemFailures,

aws_lambda_powertools/utilities/batch/decorators.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from __future__ import annotations
22

33
import warnings
4-
from typing import TYPE_CHECKING, Any, Awaitable, Callable
4+
from typing import TYPE_CHECKING, Any
55

66
from typing_extensions import deprecated
77

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

1818
if TYPE_CHECKING:
19+
from collections.abc import Awaitable, Callable
20+
1921
from aws_lambda_powertools.utilities.batch.types import PartialItemFailureResponse
2022
from aws_lambda_powertools.utilities.typing import LambdaContext
2123

tests/functional/batch/required_dependencies/test_utilities_batch.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
from __future__ import annotations
2+
13
import json
24
import uuid
35
from random import randint
4-
from typing import Any, Awaitable, Callable, Dict
6+
from typing import TYPE_CHECKING, Any
57

68
import pytest
79

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

31+
if TYPE_CHECKING:
32+
from collections.abc import Awaitable, Callable
33+
2934

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

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

175180
return factory

0 commit comments

Comments
 (0)