diff --git a/aws_lambda_powertools/utilities/typing/lambda_client_context.py b/aws_lambda_powertools/utilities/typing/lambda_client_context.py index 5c95e385ec5..25276f8eb90 100644 --- a/aws_lambda_powertools/utilities/typing/lambda_client_context.py +++ b/aws_lambda_powertools/utilities/typing/lambda_client_context.py @@ -1,15 +1,18 @@ # -*- coding: utf-8 -*- -from typing import Any, Dict +from __future__ import annotations -from aws_lambda_powertools.utilities.typing.lambda_client_context_mobile_client import ( - LambdaClientContextMobileClient, -) +from typing import TYPE_CHECKING, Any + +if TYPE_CHECKING: + from aws_lambda_powertools.utilities.typing.lambda_client_context_mobile_client import ( + LambdaClientContextMobileClient, + ) class LambdaClientContext(object): _client: LambdaClientContextMobileClient - _custom: Dict[str, Any] - _env: Dict[str, Any] + _custom: dict[str, Any] + _env: dict[str, Any] @property def client(self) -> LambdaClientContextMobileClient: @@ -17,11 +20,11 @@ def client(self) -> LambdaClientContextMobileClient: return self._client @property - def custom(self) -> Dict[str, Any]: + def custom(self) -> dict[str, Any]: """A dict of custom values set by the mobile client application.""" return self._custom @property - def env(self) -> Dict[str, Any]: + def env(self) -> dict[str, Any]: """A dict of environment information provided by the AWS SDK.""" return self._env diff --git a/aws_lambda_powertools/utilities/typing/lambda_context.py b/aws_lambda_powertools/utilities/typing/lambda_context.py index ffa983f3711..3ee8739f710 100644 --- a/aws_lambda_powertools/utilities/typing/lambda_context.py +++ b/aws_lambda_powertools/utilities/typing/lambda_context.py @@ -1,10 +1,15 @@ # -*- coding: utf-8 -*- -from aws_lambda_powertools.utilities.typing.lambda_client_context import ( - LambdaClientContext, -) -from aws_lambda_powertools.utilities.typing.lambda_cognito_identity import ( - LambdaCognitoIdentity, -) +from __future__ import annotations + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from aws_lambda_powertools.utilities.typing.lambda_client_context import ( + LambdaClientContext, + ) + from aws_lambda_powertools.utilities.typing.lambda_cognito_identity import ( + LambdaCognitoIdentity, + ) class LambdaContext(object): @@ -14,10 +19,10 @@ class LambdaContext(object): ------- **A Lambda function using LambdaContext** - >>> from typing import Any, Dict + >>> from typing import Any >>> from aws_lambda_powertools.utilities.typing import LambdaContext >>> - >>> def handler(event: Dict[str, Any], context: LambdaContext) -> Dict[str, Any]: + >>> def handler(event: dict[str, Any], context: LambdaContext) -> dict[str, Any]: >>> # Insert business logic >>> return event