Skip to content

Commit 86522d0

Browse files
jlujan-invitaeseratch
authored andcommitted
Fix types in LocalLambdaClient
1 parent 6894239 commit 86522d0

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

slack_bolt/adapter/aws_lambda/chalice_handler.py

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44

55
from chalice.app import Request, Response, Chalice
66
from chalice.config import Config
7-
from chalice.test import (
8-
BaseClient, LambdaContext, InvokeResponse
9-
)
7+
from chalice.test import BaseClient, LambdaContext, InvokeResponse
108

119
from slack_bolt.adapter.aws_lambda.chalice_lazy_listener_runner import (
1210
ChaliceLazyListenerRunner,
@@ -21,18 +19,23 @@
2119

2220
class LocalLambdaClient(BaseClient):
2321
"""Lambda client implementing `invoke` for use when running with Chalice CLI"""
24-
def __init__(self, app, config):
25-
# type: (Chalice, Config) -> None
22+
23+
def __init__(self, app: Chalice, config: Config) -> None:
2624
self._app = app
2725
self._config = config
2826

29-
def invoke(self, FunctionName: str = None, InvocationType: str = "Event", Payload: str = None):
30-
# type: (str, Any) -> InvokeResponse
27+
def invoke(
28+
self,
29+
FunctionName: str = None,
30+
InvocationType: str = "Event",
31+
Payload: str = None,
32+
) -> InvokeResponse:
3133
if Payload is None:
32-
Payload = '{}'
34+
Payload = "{}"
3335
scoped = self._config.scope(self._config.chalice_stage, FunctionName)
3436
lambda_context = LambdaContext(
35-
FunctionName, memory_size=scoped.lambda_memory_size)
37+
FunctionName, memory_size=scoped.lambda_memory_size
38+
)
3639

3740
with self._patched_env_vars(scoped.environment_variables):
3841
response = self._app(json.loads(Payload), lambda_context)
@@ -46,12 +49,11 @@ def __init__(self, app: App, chalice: Chalice): # type: ignore
4649
self.logger = get_bolt_app_logger(app.name, ChaliceSlackRequestHandler)
4750

4851
lambda_client = None
49-
if getenv('AWS_CHALICE_CLI_MODE') == 'true':
52+
if getenv("AWS_CHALICE_CLI_MODE") == "true":
5053
lambda_client = LocalLambdaClient(self.chalice, Config())
5154

5255
self.app.listener_runner.lazy_listener_runner = ChaliceLazyListenerRunner(
53-
logger=self.logger,
54-
lambda_client=lambda_client
56+
logger=self.logger, lambda_client=lambda_client
5557
)
5658

5759
if self.app.oauth_flow is not None:

0 commit comments

Comments
 (0)