Skip to content

Commit 335b368

Browse files
committed
format, clarify comment
1 parent 21221bf commit 335b368

1 file changed

Lines changed: 4 additions & 10 deletions

File tree

aws_lambda/aws_lambda.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,6 @@ def get_account_id(aws_access_key_id, aws_secret_access_key):
199199

200200
def get_client(client, aws_access_key_id, aws_secret_access_key, region=None):
201201
"""Shortcut for getting an initialized instance of the boto3 client."""
202-
203202
return boto3.client(
204203
client,
205204
aws_access_key_id=aws_access_key_id,
@@ -210,7 +209,6 @@ def get_client(client, aws_access_key_id, aws_secret_access_key, region=None):
210209

211210
def create_function(cfg, path_to_zip_file, extra_config=None):
212211
"""Register and upload a function to AWS Lambda."""
213-
214212
byte_stream = read_file(path_to_zip_file, binary_file=True)
215213
aws_access_key_id = cfg.get('aws_access_key_id')
216214
aws_secret_access_key = cfg.get('aws_secret_access_key')
@@ -252,7 +250,6 @@ def create_function(cfg, path_to_zip_file, extra_config=None):
252250

253251
def update_function(cfg, path_to_zip_file, extra_config=None):
254252
"""Updates the code of an existing Lambda function"""
255-
256253
byte_stream = read_file(path_to_zip_file, binary_file=True)
257254
aws_access_key_id = cfg.get('aws_access_key_id')
258255
aws_secret_access_key = cfg.get('aws_secret_access_key')
@@ -292,18 +289,17 @@ def update_function(cfg, path_to_zip_file, extra_config=None):
292289
def _client_from_cfg(cfg):
293290
"""
294291
Helper method for the below methods that sets up a lambda client given
295-
a config dictionary containing the relevant AWS key.
292+
a config dictionary containing the relevant AWS keys.
296293
"""
297294
aws_access_key_id = cfg.get('aws_access_key_id')
298295
aws_secret_access_key = cfg.get('aws_secret_access_key')
299296
region = cfg.get('region', 'us-east-1')
300297
return get_client('lambda', aws_access_key_id, aws_secret_access_key,
301-
cfg.get('region'))
298+
region)
302299

303300

304301
def function_exists(cfg, function_name):
305302
"""Check whether a function exists or not"""
306-
307303
client = _client_from_cfg(cfg)
308304
try:
309305
client.get_function(FunctionName=function_name)
@@ -317,7 +313,6 @@ def delete_function(cfg, function_name):
317313
Deletes the given function name from AWS Lambda. First checks that it exists.
318314
Returns True in success, False otherwise
319315
"""
320-
321316
client = _client_from_cfg(cfg)
322317
try:
323318
client.get_function(FunctionName=function_name)
@@ -328,12 +323,12 @@ def delete_function(cfg, function_name):
328323

329324
def invoke_function(cfg, function_name, invocation_type='RequestResponse', event={}):
330325
"""
331-
Invokes the given lambda function using the given client.
326+
Invokes the given lambda function using the given config cfg.
332327
333328
invocation_type is one of 'Event'|'RequestResponse'|'DryRun'. The default
334329
is RequestResponse, which will cause this function to hang until the lambda
335330
is completed. 'Event' triggers the lambda asynchronously. 'DryRun' just
336-
validates paremeters/permissions.
331+
validates parameters/permissions.
337332
338333
event is a dictionary containing the arguments needed for this lambda. For
339334
example if your lambda is expecting fields 'a' and 'b' in the 'event' that is
@@ -345,7 +340,6 @@ def invoke_function(cfg, function_name, invocation_type='RequestResponse', event
345340
346341
Returns decoded response in success, None otherwise
347342
"""
348-
349343
import json
350344
client = _client_from_cfg(cfg)
351345
try:

0 commit comments

Comments
 (0)