Skip to content

Commit 70f0750

Browse files
authored
Merge pull request #158 from emcpow2/context-type-hinting
AWS Lambda context type hinting
2 parents 3c5894f + fe72ca7 commit 70f0750

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

mangum/adapter.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
from mangum.protocols.http import HTTPCycle
1212
from mangum.exceptions import ConfigurationError
1313

14+
if typing.TYPE_CHECKING: # pragma: no cover
15+
from awslambdaric.lambda_context import LambdaContext
1416

1517
DEFAULT_TEXT_MIME_TYPES = [
1618
"application/json",
@@ -79,7 +81,7 @@ def __post_init__(self, text_mime_types: typing.Optional[typing.List[str]]) -> N
7981
text_mime_types = DEFAULT_TEXT_MIME_TYPES
8082
self.text_mime_types = text_mime_types
8183

82-
def __call__(self, event: dict, context: dict) -> dict:
84+
def __call__(self, event: dict, context: "LambdaContext") -> dict:
8385
self.logger.debug("Event received.")
8486

8587
with ExitStack() as stack:

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ moto
1010
mypy
1111
brotli
1212
brotli-asgi
13+
awslambdaric-stubs
1314
# Docs
1415
mkdocs
1516
mkdocs-material

0 commit comments

Comments
 (0)