Skip to content

Commit

Permalink
Avoid mutable default arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
longzhi committed Jan 16, 2017
1 parent a5889b4 commit b1b7813
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions zappa/zappa.py
Original file line number Diff line number Diff line change
Expand Up @@ -629,14 +629,16 @@ def remove_from_s3(self, file_name, bucket_name):
##

def create_lambda_function(self, bucket, s3_key, function_name, handler, description="Zappa Deployment",
timeout=30, memory_size=512, publish=True, vpc_config=None, environment_variables={}):
timeout=30, memory_size=512, publish=True, vpc_config=None, environment_variables=None):
"""
Given a bucket and key of a valid Lambda-zip, a function name and a handler, register that Lambda function.
"""
if not vpc_config:
vpc_config = {}
if not self.credentials_arn:
self.get_credentials_arn()
if not environment_variables:
environment_variables = {}

response = self.lambda_client.create_function(
FunctionName=function_name,
Expand Down Expand Up @@ -673,7 +675,7 @@ def update_lambda_function(self, bucket, s3_key, function_name, publish=True):
return response['FunctionArn']

def update_lambda_configuration(self, lambda_arn, function_name, handler, description="Zappa Deployment",
timeout=30, memory_size=512, publish=True, vpc_config=None, environment_variables={}):
timeout=30, memory_size=512, publish=True, vpc_config=None, environment_variables=None):
"""
Given an existing function ARN, update the configuration variables.
"""
Expand All @@ -683,6 +685,8 @@ def update_lambda_configuration(self, lambda_arn, function_name, handler, descri
vpc_config = {}
if not self.credentials_arn:
self.get_credentials_arn()
if not environment_variables:
environment_variables = {}

response = self.lambda_client.update_function_configuration(
FunctionName=function_name,
Expand Down

0 comments on commit b1b7813

Please sign in to comment.