Skip to content

Commit a9ffc9f

Browse files
committed
linting
1 parent 1104f81 commit a9ffc9f

File tree

1 file changed

+33
-13
lines changed

1 file changed

+33
-13
lines changed

aws_lambda/aws_lambda.py

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@
77
import os
88
import sys
99
import time
10+
from collections import defaultdict
1011
from imp import load_source
1112
from shutil import copy
12-
from shutil import copyfile, copytree
13+
from shutil import copyfile
14+
from shutil import copytree
1315
from tempfile import mkdtemp
14-
from collections import defaultdict
1516

1617
import boto3
1718
import botocore
@@ -26,7 +27,7 @@
2627

2728

2829
ARN_PREFIXES = {
29-
'us-gov-west-1': 'aws-us-gov'
30+
'us-gov-west-1': 'aws-us-gov',
3031
}
3132

3233
log = logging.getLogger(__name__)
@@ -247,11 +248,18 @@ def build(src, requirements=False, local_package=None):
247248
else output_filename
248249
)
249250

250-
# Allow definition of source code directories we want to build into our zipped package.
251+
# Allow definition of source code directories we want to build into our
252+
# zipped package.
251253
build_config = defaultdict(**cfg.get('build', {}))
252254
build_source_directories = build_config.get('source_directories', '')
253-
build_source_directories = build_source_directories if build_source_directories is not None else ''
254-
source_directories = [d.strip() for d in build_source_directories.split(',')]
255+
build_source_directories = (
256+
build_source_directories
257+
if build_source_directories is not None
258+
else ''
259+
)
260+
source_directories = [
261+
d.strip() for d in build_source_directories.split(',')
262+
]
255263

256264
files = []
257265
for filename in os.listdir(src):
@@ -407,7 +415,10 @@ def create_function(cfg, path_to_zip_file):
407415
aws_secret_access_key = cfg.get('aws_secret_access_key')
408416

409417
account_id = get_account_id(aws_access_key_id, aws_secret_access_key)
410-
role = get_role_name(cfg.get('region'), account_id, cfg.get('role', 'lambda_basic_execution'))
418+
role = get_role_name(
419+
cfg.get('region'), account_id,
420+
cfg.get('role', 'lambda_basic_execution'),
421+
)
411422

412423
client = get_client(
413424
'lambda', aws_access_key_id, aws_secret_access_key,
@@ -454,7 +465,10 @@ def update_function(cfg, path_to_zip_file):
454465
aws_secret_access_key = cfg.get('aws_secret_access_key')
455466

456467
account_id = get_account_id(aws_access_key_id, aws_secret_access_key)
457-
role = get_role_name(cfg.get('region'), account_id, cfg.get('role', 'lambda_basic_execution'))
468+
role = get_role_name(
469+
cfg.get('region'), account_id,
470+
cfg.get('role', 'lambda_basic_execution'),
471+
)
458472

459473
client = get_client(
460474
'lambda', aws_access_key_id, aws_secret_access_key,
@@ -541,12 +555,18 @@ def function_exists(cfg, function_name):
541555
cfg.get('region'),
542556
)
543557

544-
# Need to loop through until we get all of the lambda functions returned. It appears
545-
# to be only returning 50 functions at a time.
558+
# Need to loop through until we get all of the lambda functions returned.
559+
# It appears to be only returning 50 functions at a time.
546560
functions = []
547561
functions_resp = client.list_functions()
548-
functions.extend([f['FunctionName'] for f in functions_resp.get('Functions', [])])
562+
functions.extend([
563+
f['FunctionName'] for f in functions_resp.get('Functions', [])
564+
])
549565
while('NextMarker' in functions_resp):
550-
functions_resp = client.list_functions(Marker=functions_resp.get('NextMarker'))
551-
functions.extend([f['FunctionName'] for f in functions_resp.get('Functions', [])])
566+
functions_resp = client.list_functions(
567+
Marker=functions_resp.get('NextMarker'),
568+
)
569+
functions.extend([
570+
f['FunctionName'] for f in functions_resp.get('Functions', [])
571+
])
552572
return function_name in functions

0 commit comments

Comments
 (0)