Skip to content

refactor(typing): add from __future__ import annotations #4985

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 1 commit into from
Aug 15, 2024
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
19 changes: 11 additions & 8 deletions aws_lambda_powertools/utilities/typing/lambda_client_context.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,30 @@
# -*- 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:
"""Client context that's provided to Lambda by the client application."""
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
21 changes: 13 additions & 8 deletions aws_lambda_powertools/utilities/typing/lambda_context.py
Original file line number Diff line number Diff line change
@@ -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):
Expand All @@ -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

Expand Down
Loading