Skip to content

Commit 872f99c

Browse files
author
Joris Conijn
committed
refactor: replace LambdaEvent with Dict[str, Any]
1 parent 856c6c3 commit 872f99c

File tree

5 files changed

+13
-18
lines changed

5 files changed

+13
-18
lines changed

aws_lambda_powertools/utilities/typing/__init__.py

-2
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@
44
Typing for developer ease in the IDE
55
"""
66

7-
from .event import LambdaEvent
87
from .lambda_context import LambdaContext
98

109
__all__ = [
11-
"LambdaEvent",
1210
"LambdaContext",
1311
]

aws_lambda_powertools/utilities/typing/event.py

-5
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,25 @@
11
# -*- coding: utf-8 -*-
2-
from aws_lambda_powertools.utilities.typing import LambdaEvent
2+
from typing import Any, Dict
3+
34
from aws_lambda_powertools.utilities.typing.lambda_client_context_mobile_client import LambdaClientContextMobileClient
45

56

67
class LambdaClientContext(object):
78
_client: LambdaClientContextMobileClient
8-
_custom: LambdaEvent
9-
_env: LambdaEvent
9+
_custom: Dict[str, Any]
10+
_env: Dict[str, Any]
1011

1112
@property
1213
def client(self) -> LambdaClientContextMobileClient:
1314
"""Client context that's provided to Lambda by the client application."""
1415
return self._client
1516

1617
@property
17-
def custom(self) -> LambdaEvent:
18+
def custom(self) -> Dict[str, Any]:
1819
"""A dict of custom values set by the mobile client application."""
1920
return self._custom
2021

2122
@property
22-
def env(self) -> LambdaEvent:
23+
def env(self) -> Dict[str, Any]:
2324
"""A dict of environment information provided by the AWS SDK."""
2425
return self._env

aws_lambda_powertools/utilities/typing/lambda_context.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ class LambdaContext(object):
1010
-------
1111
**A Lambda function using LambdaContext**
1212
13-
>>> from aws_lambda_powertools.utilities.typing import LambdaEvent, LambdaContext
13+
>>> from aws_lambda_powertools.utilities.typing import LambdaContext
1414
>>>
15-
>>> def handler(event: LambdaEvent, context: LambdaContext) -> LambdaEvent:
15+
>>> def handler(event: Dict[str, Any], context: LambdaContext) -> Dict[str, Any]:
1616
>>> # Insert business logic
1717
>>> return event
1818

docs/content/utilities/typing.mdx

+5-4
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,16 @@ This typing utility provides static typing classes that can be used to ease the
99

1010
![Utilities Typing](../media/utilities_typing.png)
1111

12-
## LambdaEvent and LambdaContext
12+
## LambdaContext
1313

14-
The `LambdaEvent` and the `LambdaContext` typings are typically used in the handler method for the Lambda function.
14+
The `LambdaContext` typing is typically used in the handler method for the Lambda function.
1515

1616
```python:title=index.py
17-
from aws_lambda_powertools.utilities.typing import LambdaEvent, LambdaContext
17+
from typing import Any, Dict
18+
from aws_lambda_powertools.utilities.typing import LambdaContext
1819

1920
# highlight-start
20-
def handler(event: LambdaEvent, context: LambdaContext) -> LambdaEvent:
21+
def handler(event: Dict[str, Any], context: LambdaContext) -> Dict[str, Any]:
2122
# highlight-end
2223
# Insert business logic
2324
return event

0 commit comments

Comments
 (0)