Skip to content

refactor(middleware_factory): use standard collections for types #6485

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
2 changes: 1 addition & 1 deletion aws_lambda_powertools/middleware_factory/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
[`Middleware Factory`](../utilities/middleware_factory.md)
"""

from .factory import lambda_handler_decorator
from aws_lambda_powertools.middleware_factory.factory import lambda_handler_decorator

__all__ = ["lambda_handler_decorator"]
5 changes: 4 additions & 1 deletion aws_lambda_powertools/middleware_factory/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import inspect
import logging
import os
from typing import Any, Callable
from typing import TYPE_CHECKING, Any

from aws_lambda_powertools.middleware_factory.exceptions import MiddlewareInvalidArgumentError
from aws_lambda_powertools.shared import constants
Expand All @@ -13,6 +13,9 @@

logger = logging.getLogger(__name__)

if TYPE_CHECKING:
from collections.abc import Callable


# Maintenance: we can't yet provide an accurate return type without ParamSpec etc. see #1066
def lambda_handler_decorator(decorator: Callable | None = None, trace_execution: bool | None = None) -> Callable:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from __future__ import annotations

import json
from typing import Callable
from typing import TYPE_CHECKING

import pytest

Expand All @@ -8,6 +10,9 @@
MiddlewareInvalidArgumentError,
)

if TYPE_CHECKING:
from collections.abc import Callable


@pytest.fixture
def say_hi_middleware() -> Callable:
Expand Down
Loading