44
55from chalice .app import Request , Response , Chalice
66from chalice .config import Config
7- from chalice .test import (
8- BaseClient , LambdaContext , InvokeResponse
9- )
7+ from chalice .test import BaseClient , LambdaContext , InvokeResponse
108
119from slack_bolt .adapter .aws_lambda .chalice_lazy_listener_runner import (
1210 ChaliceLazyListenerRunner ,
2119
2220class 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