partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
Zappa.create_handler_venv
Takes the installed zappa and brings it into a fresh virtualenv-like folder. All dependencies are then downloaded.
zappa/core.py
def create_handler_venv(self): """ Takes the installed zappa and brings it into a fresh virtualenv-like folder. All dependencies are then downloaded. """ import subprocess # We will need the currenv venv to pull Zappa from current_venv = self.get_current_venv() ...
def create_handler_venv(self): """ Takes the installed zappa and brings it into a fresh virtualenv-like folder. All dependencies are then downloaded. """ import subprocess # We will need the currenv venv to pull Zappa from current_venv = self.get_current_venv() ...
[ "Takes", "the", "installed", "zappa", "and", "brings", "it", "into", "a", "fresh", "virtualenv", "-", "like", "folder", ".", "All", "dependencies", "are", "then", "downloaded", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L391-L437
[ "def", "create_handler_venv", "(", "self", ")", ":", "import", "subprocess", "# We will need the currenv venv to pull Zappa from", "current_venv", "=", "self", ".", "get_current_venv", "(", ")", "# Make a new folder for the handler packages", "ve_path", "=", "os", ".", "pat...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
Zappa.get_current_venv
Returns the path to the current virtualenv
zappa/core.py
def get_current_venv(): """ Returns the path to the current virtualenv """ if 'VIRTUAL_ENV' in os.environ: venv = os.environ['VIRTUAL_ENV'] elif os.path.exists('.python-version'): # pragma: no cover try: subprocess.check_output(['pyenv', '...
def get_current_venv(): """ Returns the path to the current virtualenv """ if 'VIRTUAL_ENV' in os.environ: venv = os.environ['VIRTUAL_ENV'] elif os.path.exists('.python-version'): # pragma: no cover try: subprocess.check_output(['pyenv', '...
[ "Returns", "the", "path", "to", "the", "current", "virtualenv" ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L441-L461
[ "def", "get_current_venv", "(", ")", ":", "if", "'VIRTUAL_ENV'", "in", "os", ".", "environ", ":", "venv", "=", "os", ".", "environ", "[", "'VIRTUAL_ENV'", "]", "elif", "os", ".", "path", ".", "exists", "(", "'.python-version'", ")", ":", "# pragma: no cove...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
Zappa.create_lambda_zip
Create a Lambda-ready zip file of the current virtualenvironment and working directory. Returns path to that file.
zappa/core.py
def create_lambda_zip( self, prefix='lambda_package', handler_file=None, slim_handler=False, minify=True, exclude=None, use_precompiled_packages=True, ...
def create_lambda_zip( self, prefix='lambda_package', handler_file=None, slim_handler=False, minify=True, exclude=None, use_precompiled_packages=True, ...
[ "Create", "a", "Lambda", "-", "ready", "zip", "file", "of", "the", "current", "virtualenvironment", "and", "working", "directory", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L463-L760
[ "def", "create_lambda_zip", "(", "self", ",", "prefix", "=", "'lambda_package'", ",", "handler_file", "=", "None", ",", "slim_handler", "=", "False", ",", "minify", "=", "True", ",", "exclude", "=", "None", ",", "use_precompiled_packages", "=", "True", ",", ...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
Zappa.extract_lambda_package
Extracts the lambda package into a given path. Assumes the package exists in lambda packages.
zappa/core.py
def extract_lambda_package(self, package_name, path): """ Extracts the lambda package into a given path. Assumes the package exists in lambda packages. """ lambda_package = lambda_packages[package_name][self.runtime] # Trash the local version to help with package space saving ...
def extract_lambda_package(self, package_name, path): """ Extracts the lambda package into a given path. Assumes the package exists in lambda packages. """ lambda_package = lambda_packages[package_name][self.runtime] # Trash the local version to help with package space saving ...
[ "Extracts", "the", "lambda", "package", "into", "a", "given", "path", ".", "Assumes", "the", "package", "exists", "in", "lambda", "packages", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L762-L773
[ "def", "extract_lambda_package", "(", "self", ",", "package_name", ",", "path", ")", ":", "lambda_package", "=", "lambda_packages", "[", "package_name", "]", "[", "self", ".", "runtime", "]", "# Trash the local version to help with package space saving", "shutil", ".", ...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
Zappa.get_installed_packages
Returns a dict of installed packages that Zappa cares about.
zappa/core.py
def get_installed_packages(site_packages, site_packages_64): """ Returns a dict of installed packages that Zappa cares about. """ import pkg_resources package_to_keep = [] if os.path.isdir(site_packages): package_to_keep += os.listdir(site_packages) i...
def get_installed_packages(site_packages, site_packages_64): """ Returns a dict of installed packages that Zappa cares about. """ import pkg_resources package_to_keep = [] if os.path.isdir(site_packages): package_to_keep += os.listdir(site_packages) i...
[ "Returns", "a", "dict", "of", "installed", "packages", "that", "Zappa", "cares", "about", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L776-L795
[ "def", "get_installed_packages", "(", "site_packages", ",", "site_packages_64", ")", ":", "import", "pkg_resources", "package_to_keep", "=", "[", "]", "if", "os", ".", "path", ".", "isdir", "(", "site_packages", ")", ":", "package_to_keep", "+=", "os", ".", "l...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
Zappa.have_correct_lambda_package_version
Checks if a given package version binary should be copied over from lambda packages. package_name should be lower-cased version of package name.
zappa/core.py
def have_correct_lambda_package_version(self, package_name, package_version): """ Checks if a given package version binary should be copied over from lambda packages. package_name should be lower-cased version of package name. """ lambda_package_details = lambda_packages.get(pack...
def have_correct_lambda_package_version(self, package_name, package_version): """ Checks if a given package version binary should be copied over from lambda packages. package_name should be lower-cased version of package name. """ lambda_package_details = lambda_packages.get(pack...
[ "Checks", "if", "a", "given", "package", "version", "binary", "should", "be", "copied", "over", "from", "lambda", "packages", ".", "package_name", "should", "be", "lower", "-", "cased", "version", "of", "package", "name", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L797-L812
[ "def", "have_correct_lambda_package_version", "(", "self", ",", "package_name", ",", "package_version", ")", ":", "lambda_package_details", "=", "lambda_packages", ".", "get", "(", "package_name", ",", "{", "}", ")", ".", "get", "(", "self", ".", "runtime", ")",...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
Zappa.download_url_with_progress
Downloads a given url in chunks and writes to the provided stream (can be any io stream). Displays the progress bar for the download.
zappa/core.py
def download_url_with_progress(url, stream, disable_progress): """ Downloads a given url in chunks and writes to the provided stream (can be any io stream). Displays the progress bar for the download. """ resp = requests.get(url, timeout=float(os.environ.get('PIP_TIMEOUT', 2)), s...
def download_url_with_progress(url, stream, disable_progress): """ Downloads a given url in chunks and writes to the provided stream (can be any io stream). Displays the progress bar for the download. """ resp = requests.get(url, timeout=float(os.environ.get('PIP_TIMEOUT', 2)), s...
[ "Downloads", "a", "given", "url", "in", "chunks", "and", "writes", "to", "the", "provided", "stream", "(", "can", "be", "any", "io", "stream", ")", ".", "Displays", "the", "progress", "bar", "for", "the", "download", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L822-L836
[ "def", "download_url_with_progress", "(", "url", ",", "stream", ",", "disable_progress", ")", ":", "resp", "=", "requests", ".", "get", "(", "url", ",", "timeout", "=", "float", "(", "os", ".", "environ", ".", "get", "(", "'PIP_TIMEOUT'", ",", "2", ")", ...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
Zappa.get_cached_manylinux_wheel
Gets the locally stored version of a manylinux wheel. If one does not exist, the function downloads it.
zappa/core.py
def get_cached_manylinux_wheel(self, package_name, package_version, disable_progress=False): """ Gets the locally stored version of a manylinux wheel. If one does not exist, the function downloads it. """ cached_wheels_dir = os.path.join(tempfile.gettempdir(), 'cached_wheels') if...
def get_cached_manylinux_wheel(self, package_name, package_version, disable_progress=False): """ Gets the locally stored version of a manylinux wheel. If one does not exist, the function downloads it. """ cached_wheels_dir = os.path.join(tempfile.gettempdir(), 'cached_wheels') if...
[ "Gets", "the", "locally", "stored", "version", "of", "a", "manylinux", "wheel", ".", "If", "one", "does", "not", "exist", "the", "function", "downloads", "it", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L838-L864
[ "def", "get_cached_manylinux_wheel", "(", "self", ",", "package_name", ",", "package_version", ",", "disable_progress", "=", "False", ")", ":", "cached_wheels_dir", "=", "os", ".", "path", ".", "join", "(", "tempfile", ".", "gettempdir", "(", ")", ",", "'cache...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
Zappa.get_manylinux_wheel_url
For a given package name, returns a link to the download URL, else returns None. Related: https://github.com/Miserlou/Zappa/issues/398 Examples here: https://gist.github.com/perrygeo/9545f94eaddec18a65fd7b56880adbae This function downloads metadata JSON of `package_name` from Pypi ...
zappa/core.py
def get_manylinux_wheel_url(self, package_name, package_version): """ For a given package name, returns a link to the download URL, else returns None. Related: https://github.com/Miserlou/Zappa/issues/398 Examples here: https://gist.github.com/perrygeo/9545f94eaddec18a65fd7b5688...
def get_manylinux_wheel_url(self, package_name, package_version): """ For a given package name, returns a link to the download URL, else returns None. Related: https://github.com/Miserlou/Zappa/issues/398 Examples here: https://gist.github.com/perrygeo/9545f94eaddec18a65fd7b5688...
[ "For", "a", "given", "package", "name", "returns", "a", "link", "to", "the", "download", "URL", "else", "returns", "None", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L866-L909
[ "def", "get_manylinux_wheel_url", "(", "self", ",", "package_name", ",", "package_version", ")", ":", "cached_pypi_info_dir", "=", "os", ".", "path", ".", "join", "(", "tempfile", ".", "gettempdir", "(", ")", ",", "'cached_pypi_info'", ")", "if", "not", "os", ...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
Zappa.upload_to_s3
r""" Given a file, upload it to S3. Credentials should be stored in environment variables or ~/.aws/credentials (%USERPROFILE%\.aws\credentials on Windows). Returns True on success, false on failure.
zappa/core.py
def upload_to_s3(self, source_path, bucket_name, disable_progress=False): r""" Given a file, upload it to S3. Credentials should be stored in environment variables or ~/.aws/credentials (%USERPROFILE%\.aws\credentials on Windows). Returns True on success, false on failure. """ ...
def upload_to_s3(self, source_path, bucket_name, disable_progress=False): r""" Given a file, upload it to S3. Credentials should be stored in environment variables or ~/.aws/credentials (%USERPROFILE%\.aws\credentials on Windows). Returns True on success, false on failure. """ ...
[ "r", "Given", "a", "file", "upload", "it", "to", "S3", ".", "Credentials", "should", "be", "stored", "in", "environment", "variables", "or", "~", "/", ".", "aws", "/", "credentials", "(", "%USERPROFILE%", "\\", ".", "aws", "\\", "credentials", "on", "Win...
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L915-L973
[ "def", "upload_to_s3", "(", "self", ",", "source_path", ",", "bucket_name", ",", "disable_progress", "=", "False", ")", ":", "try", ":", "self", ".", "s3_client", ".", "head_bucket", "(", "Bucket", "=", "bucket_name", ")", "except", "botocore", ".", "excepti...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
Zappa.copy_on_s3
Copies src file to destination within a bucket.
zappa/core.py
def copy_on_s3(self, src_file_name, dst_file_name, bucket_name): """ Copies src file to destination within a bucket. """ try: self.s3_client.head_bucket(Bucket=bucket_name) except botocore.exceptions.ClientError as e: # pragma: no cover # If a client erro...
def copy_on_s3(self, src_file_name, dst_file_name, bucket_name): """ Copies src file to destination within a bucket. """ try: self.s3_client.head_bucket(Bucket=bucket_name) except botocore.exceptions.ClientError as e: # pragma: no cover # If a client erro...
[ "Copies", "src", "file", "to", "destination", "within", "a", "bucket", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L975-L1000
[ "def", "copy_on_s3", "(", "self", ",", "src_file_name", ",", "dst_file_name", ",", "bucket_name", ")", ":", "try", ":", "self", ".", "s3_client", ".", "head_bucket", "(", "Bucket", "=", "bucket_name", ")", "except", "botocore", ".", "exceptions", ".", "Clien...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
Zappa.remove_from_s3
Given a file name and a bucket, remove it from S3. There's no reason to keep the file hosted on S3 once its been made into a Lambda function, so we can delete it from S3. Returns True on success, False on failure.
zappa/core.py
def remove_from_s3(self, file_name, bucket_name): """ Given a file name and a bucket, remove it from S3. There's no reason to keep the file hosted on S3 once its been made into a Lambda function, so we can delete it from S3. Returns True on success, False on failure. """ ...
def remove_from_s3(self, file_name, bucket_name): """ Given a file name and a bucket, remove it from S3. There's no reason to keep the file hosted on S3 once its been made into a Lambda function, so we can delete it from S3. Returns True on success, False on failure. """ ...
[ "Given", "a", "file", "name", "and", "a", "bucket", "remove", "it", "from", "S3", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L1002-L1024
[ "def", "remove_from_s3", "(", "self", ",", "file_name", ",", "bucket_name", ")", ":", "try", ":", "self", ".", "s3_client", ".", "head_bucket", "(", "Bucket", "=", "bucket_name", ")", "except", "botocore", ".", "exceptions", ".", "ClientError", "as", "e", ...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
Zappa.create_lambda_function
Given a bucket and key (or a local path) of a valid Lambda-zip, a function name and a handler, register that Lambda function.
zappa/core.py
def create_lambda_function( self, bucket=None, function_name=None, handler=None, s3_key=None, description='Zappa Deployment', ti...
def create_lambda_function( self, bucket=None, function_name=None, handler=None, s3_key=None, description='Zappa Deployment', ti...
[ "Given", "a", "bucket", "and", "key", "(", "or", "a", "local", "path", ")", "of", "a", "valid", "Lambda", "-", "zip", "a", "function", "name", "and", "a", "handler", "register", "that", "Lambda", "function", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L1030-L1109
[ "def", "create_lambda_function", "(", "self", ",", "bucket", "=", "None", ",", "function_name", "=", "None", ",", "handler", "=", "None", ",", "s3_key", "=", "None", ",", "description", "=", "'Zappa Deployment'", ",", "timeout", "=", "30", ",", "memory_size"...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
Zappa.update_lambda_function
Given a bucket and key (or a local path) of a valid Lambda-zip, a function name and a handler, update that Lambda function's code. Optionally, delete previous versions if they exceed the optional limit.
zappa/core.py
def update_lambda_function(self, bucket, function_name, s3_key=None, publish=True, local_zip=None, num_revisions=None): """ Given a bucket and key (or a local path) of a valid Lambda-zip, a function name and a handler, update that Lambda function's code. Optionally, delete previous versions if t...
def update_lambda_function(self, bucket, function_name, s3_key=None, publish=True, local_zip=None, num_revisions=None): """ Given a bucket and key (or a local path) of a valid Lambda-zip, a function name and a handler, update that Lambda function's code. Optionally, delete previous versions if t...
[ "Given", "a", "bucket", "and", "key", "(", "or", "a", "local", "path", ")", "of", "a", "valid", "Lambda", "-", "zip", "a", "function", "name", "and", "a", "handler", "update", "that", "Lambda", "function", "s", "code", ".", "Optionally", "delete", "pre...
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L1111-L1172
[ "def", "update_lambda_function", "(", "self", ",", "bucket", ",", "function_name", ",", "s3_key", "=", "None", ",", "publish", "=", "True", ",", "local_zip", "=", "None", ",", "num_revisions", "=", "None", ")", ":", "print", "(", "\"Updating Lambda function co...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
Zappa.update_lambda_configuration
Given an existing function ARN, update the configuration variables.
zappa/core.py
def update_lambda_configuration( self, lambda_arn, function_name, handler, description='Zappa Deployment', timeout=30...
def update_lambda_configuration( self, lambda_arn, function_name, handler, description='Zappa Deployment', timeout=30...
[ "Given", "an", "existing", "function", "ARN", "update", "the", "configuration", "variables", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L1174-L1232
[ "def", "update_lambda_configuration", "(", "self", ",", "lambda_arn", ",", "function_name", ",", "handler", ",", "description", "=", "'Zappa Deployment'", ",", "timeout", "=", "30", ",", "memory_size", "=", "512", ",", "publish", "=", "True", ",", "vpc_config", ...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
Zappa.invoke_lambda_function
Directly invoke a named Lambda function with a payload. Returns the response.
zappa/core.py
def invoke_lambda_function( self, function_name, payload, invocation_type='Event', log_type='Tail', client_context=None, qualifi...
def invoke_lambda_function( self, function_name, payload, invocation_type='Event', log_type='Tail', client_context=None, qualifi...
[ "Directly", "invoke", "a", "named", "Lambda", "function", "with", "a", "payload", ".", "Returns", "the", "response", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L1234-L1251
[ "def", "invoke_lambda_function", "(", "self", ",", "function_name", ",", "payload", ",", "invocation_type", "=", "'Event'", ",", "log_type", "=", "'Tail'", ",", "client_context", "=", "None", ",", "qualifier", "=", "None", ")", ":", "return", "self", ".", "l...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
Zappa.rollback_lambda_function_version
Rollback the lambda function code 'versions_back' number of revisions. Returns the Function ARN.
zappa/core.py
def rollback_lambda_function_version(self, function_name, versions_back=1, publish=True): """ Rollback the lambda function code 'versions_back' number of revisions. Returns the Function ARN. """ response = self.lambda_client.list_versions_by_function(FunctionName=function_name) ...
def rollback_lambda_function_version(self, function_name, versions_back=1, publish=True): """ Rollback the lambda function code 'versions_back' number of revisions. Returns the Function ARN. """ response = self.lambda_client.list_versions_by_function(FunctionName=function_name) ...
[ "Rollback", "the", "lambda", "function", "code", "versions_back", "number", "of", "revisions", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L1253-L1278
[ "def", "rollback_lambda_function_version", "(", "self", ",", "function_name", ",", "versions_back", "=", "1", ",", "publish", "=", "True", ")", ":", "response", "=", "self", ".", "lambda_client", ".", "list_versions_by_function", "(", "FunctionName", "=", "functio...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
Zappa.get_lambda_function
Returns the lambda function ARN, given a name This requires the "lambda:GetFunction" role.
zappa/core.py
def get_lambda_function(self, function_name): """ Returns the lambda function ARN, given a name This requires the "lambda:GetFunction" role. """ response = self.lambda_client.get_function( FunctionName=function_name) return response['Configuration']['Func...
def get_lambda_function(self, function_name): """ Returns the lambda function ARN, given a name This requires the "lambda:GetFunction" role. """ response = self.lambda_client.get_function( FunctionName=function_name) return response['Configuration']['Func...
[ "Returns", "the", "lambda", "function", "ARN", "given", "a", "name" ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L1280-L1288
[ "def", "get_lambda_function", "(", "self", ",", "function_name", ")", ":", "response", "=", "self", ".", "lambda_client", ".", "get_function", "(", "FunctionName", "=", "function_name", ")", "return", "response", "[", "'Configuration'", "]", "[", "'FunctionArn'", ...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
Zappa.get_lambda_function_versions
Simply returns the versions available for a Lambda function, given a function name.
zappa/core.py
def get_lambda_function_versions(self, function_name): """ Simply returns the versions available for a Lambda function, given a function name. """ try: response = self.lambda_client.list_versions_by_function( FunctionName=function_name ) ...
def get_lambda_function_versions(self, function_name): """ Simply returns the versions available for a Lambda function, given a function name. """ try: response = self.lambda_client.list_versions_by_function( FunctionName=function_name ) ...
[ "Simply", "returns", "the", "versions", "available", "for", "a", "Lambda", "function", "given", "a", "function", "name", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L1290-L1301
[ "def", "get_lambda_function_versions", "(", "self", ",", "function_name", ")", ":", "try", ":", "response", "=", "self", ".", "lambda_client", ".", "list_versions_by_function", "(", "FunctionName", "=", "function_name", ")", "return", "response", ".", "get", "(", ...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
Zappa.deploy_lambda_alb
The `zappa deploy` functionality for ALB infrastructure.
zappa/core.py
def deploy_lambda_alb( self, lambda_arn, lambda_name, alb_vpc_config, timeout ): """ The `zappa deploy` functionality for ALB infrastructure. """ if n...
def deploy_lambda_alb( self, lambda_arn, lambda_name, alb_vpc_config, timeout ): """ The `zappa deploy` functionality for ALB infrastructure. """ if n...
[ "The", "zappa", "deploy", "functionality", "for", "ALB", "infrastructure", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L1320-L1432
[ "def", "deploy_lambda_alb", "(", "self", ",", "lambda_arn", ",", "lambda_name", ",", "alb_vpc_config", ",", "timeout", ")", ":", "if", "not", "alb_vpc_config", ":", "raise", "EnvironmentError", "(", "'When creating an ALB, alb_vpc_config must be filled out in zappa_settings...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
Zappa.undeploy_lambda_alb
The `zappa undeploy` functionality for ALB infrastructure.
zappa/core.py
def undeploy_lambda_alb(self, lambda_name): """ The `zappa undeploy` functionality for ALB infrastructure. """ print("Undeploying ALB infrastructure...") # Locate and delete alb/lambda permissions try: # https://boto3.amazonaws.com/v1/documentation/api/latest...
def undeploy_lambda_alb(self, lambda_name): """ The `zappa undeploy` functionality for ALB infrastructure. """ print("Undeploying ALB infrastructure...") # Locate and delete alb/lambda permissions try: # https://boto3.amazonaws.com/v1/documentation/api/latest...
[ "The", "zappa", "undeploy", "functionality", "for", "ALB", "infrastructure", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L1434-L1518
[ "def", "undeploy_lambda_alb", "(", "self", ",", "lambda_name", ")", ":", "print", "(", "\"Undeploying ALB infrastructure...\"", ")", "# Locate and delete alb/lambda permissions", "try", ":", "# https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/lambda.html#Lambd...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
Zappa.create_api_gateway_routes
Create the API Gateway for this Zappa deployment. Returns the new RestAPI CF resource.
zappa/core.py
def create_api_gateway_routes( self, lambda_arn, api_name=None, api_key_required=False, authorization_type='NONE', authorizer=None, ...
def create_api_gateway_routes( self, lambda_arn, api_name=None, api_key_required=False, authorization_type='NONE', authorizer=None, ...
[ "Create", "the", "API", "Gateway", "for", "this", "Zappa", "deployment", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L1525-L1616
[ "def", "create_api_gateway_routes", "(", "self", ",", "lambda_arn", ",", "api_name", "=", "None", ",", "api_key_required", "=", "False", ",", "authorization_type", "=", "'NONE'", ",", "authorizer", "=", "None", ",", "cors_options", "=", "None", ",", "description...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
Zappa.create_authorizer
Create Authorizer for API gateway
zappa/core.py
def create_authorizer(self, restapi, uri, authorizer): """ Create Authorizer for API gateway """ authorizer_type = authorizer.get("type", "TOKEN").upper() identity_validation_expression = authorizer.get('validation_expression', None) authorizer_resource = troposphere.api...
def create_authorizer(self, restapi, uri, authorizer): """ Create Authorizer for API gateway """ authorizer_type = authorizer.get("type", "TOKEN").upper() identity_validation_expression = authorizer.get('validation_expression', None) authorizer_resource = troposphere.api...
[ "Create", "Authorizer", "for", "API", "gateway" ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L1618-L1645
[ "def", "create_authorizer", "(", "self", ",", "restapi", ",", "uri", ",", "authorizer", ")", ":", "authorizer_type", "=", "authorizer", ".", "get", "(", "\"type\"", ",", "\"TOKEN\"", ")", ".", "upper", "(", ")", "identity_validation_expression", "=", "authoriz...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
Zappa.create_and_setup_methods
Set up the methods, integration responses and method responses for a given API Gateway resource.
zappa/core.py
def create_and_setup_methods( self, restapi, resource, api_key_required, uri, authorization_type, ...
def create_and_setup_methods( self, restapi, resource, api_key_required, uri, authorization_type, ...
[ "Set", "up", "the", "methods", "integration", "responses", "and", "method", "responses", "for", "a", "given", "API", "Gateway", "resource", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L1647-L1689
[ "def", "create_and_setup_methods", "(", "self", ",", "restapi", ",", "resource", ",", "api_key_required", ",", "uri", ",", "authorization_type", ",", "authorizer_resource", ",", "depth", ")", ":", "for", "method_name", "in", "self", ".", "http_methods", ":", "me...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
Zappa.create_and_setup_cors
Set up the methods, integration responses and method responses for a given API Gateway resource.
zappa/core.py
def create_and_setup_cors(self, restapi, resource, uri, depth, config): """ Set up the methods, integration responses and method responses for a given API Gateway resource. """ if config is True: config = {} method_name = "OPTIONS" method = troposphere.apigate...
def create_and_setup_cors(self, restapi, resource, uri, depth, config): """ Set up the methods, integration responses and method responses for a given API Gateway resource. """ if config is True: config = {} method_name = "OPTIONS" method = troposphere.apigate...
[ "Set", "up", "the", "methods", "integration", "responses", "and", "method", "responses", "for", "a", "given", "API", "Gateway", "resource", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L1691-L1749
[ "def", "create_and_setup_cors", "(", "self", ",", "restapi", ",", "resource", ",", "uri", ",", "depth", ",", "config", ")", ":", "if", "config", "is", "True", ":", "config", "=", "{", "}", "method_name", "=", "\"OPTIONS\"", "method", "=", "troposphere", ...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
Zappa.deploy_api_gateway
Deploy the API Gateway! Return the deployed API URL.
zappa/core.py
def deploy_api_gateway( self, api_id, stage_name, stage_description="", description="", cache_cluster_enabled=False, cache_cluster_size='0.5', ...
def deploy_api_gateway( self, api_id, stage_name, stage_description="", description="", cache_cluster_enabled=False, cache_cluster_size='0.5', ...
[ "Deploy", "the", "API", "Gateway!" ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L1751-L1797
[ "def", "deploy_api_gateway", "(", "self", ",", "api_id", ",", "stage_name", ",", "stage_description", "=", "\"\"", ",", "description", "=", "\"\"", ",", "cache_cluster_enabled", "=", "False", ",", "cache_cluster_size", "=", "'0.5'", ",", "variables", "=", "None"...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
Zappa.remove_binary_support
Remove binary support
zappa/core.py
def remove_binary_support(self, api_id, cors=False): """ Remove binary support """ response = self.apigateway_client.get_rest_api( restApiId=api_id ) if "binaryMediaTypes" in response and "*/*" in response["binaryMediaTypes"]: self.apigateway_clien...
def remove_binary_support(self, api_id, cors=False): """ Remove binary support """ response = self.apigateway_client.get_rest_api( restApiId=api_id ) if "binaryMediaTypes" in response and "*/*" in response["binaryMediaTypes"]: self.apigateway_clien...
[ "Remove", "binary", "support" ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L1840-L1877
[ "def", "remove_binary_support", "(", "self", ",", "api_id", ",", "cors", "=", "False", ")", ":", "response", "=", "self", ".", "apigateway_client", ".", "get_rest_api", "(", "restApiId", "=", "api_id", ")", "if", "\"binaryMediaTypes\"", "in", "response", "and"...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
Zappa.add_api_compression
Add Rest API compression
zappa/core.py
def add_api_compression(self, api_id, min_compression_size): """ Add Rest API compression """ self.apigateway_client.update_rest_api( restApiId=api_id, patchOperations=[ { 'op': 'replace', 'path': '/minimumCo...
def add_api_compression(self, api_id, min_compression_size): """ Add Rest API compression """ self.apigateway_client.update_rest_api( restApiId=api_id, patchOperations=[ { 'op': 'replace', 'path': '/minimumCo...
[ "Add", "Rest", "API", "compression" ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L1879-L1892
[ "def", "add_api_compression", "(", "self", ",", "api_id", ",", "min_compression_size", ")", ":", "self", ".", "apigateway_client", ".", "update_rest_api", "(", "restApiId", "=", "api_id", ",", "patchOperations", "=", "[", "{", "'op'", ":", "'replace'", ",", "'...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
Zappa.get_api_keys
Generator that allows to iterate per API keys associated to an api_id and a stage_name.
zappa/core.py
def get_api_keys(self, api_id, stage_name): """ Generator that allows to iterate per API keys associated to an api_id and a stage_name. """ response = self.apigateway_client.get_api_keys(limit=500) stage_key = '{}/{}'.format(api_id, stage_name) for api_key in response.get...
def get_api_keys(self, api_id, stage_name): """ Generator that allows to iterate per API keys associated to an api_id and a stage_name. """ response = self.apigateway_client.get_api_keys(limit=500) stage_key = '{}/{}'.format(api_id, stage_name) for api_key in response.get...
[ "Generator", "that", "allows", "to", "iterate", "per", "API", "keys", "associated", "to", "an", "api_id", "and", "a", "stage_name", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L1908-L1916
[ "def", "get_api_keys", "(", "self", ",", "api_id", ",", "stage_name", ")", ":", "response", "=", "self", ".", "apigateway_client", ".", "get_api_keys", "(", "limit", "=", "500", ")", "stage_key", "=", "'{}/{}'", ".", "format", "(", "api_id", ",", "stage_na...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
Zappa.create_api_key
Create new API key and link it with an api_id and a stage_name
zappa/core.py
def create_api_key(self, api_id, stage_name): """ Create new API key and link it with an api_id and a stage_name """ response = self.apigateway_client.create_api_key( name='{}_{}'.format(stage_name, api_id), description='Api Key for {}'.format(api_id), ...
def create_api_key(self, api_id, stage_name): """ Create new API key and link it with an api_id and a stage_name """ response = self.apigateway_client.create_api_key( name='{}_{}'.format(stage_name, api_id), description='Api Key for {}'.format(api_id), ...
[ "Create", "new", "API", "key", "and", "link", "it", "with", "an", "api_id", "and", "a", "stage_name" ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L1918-L1933
[ "def", "create_api_key", "(", "self", ",", "api_id", ",", "stage_name", ")", ":", "response", "=", "self", ".", "apigateway_client", ".", "create_api_key", "(", "name", "=", "'{}_{}'", ".", "format", "(", "stage_name", ",", "api_id", ")", ",", "description",...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
Zappa.remove_api_key
Remove a generated API key for api_id and stage_name
zappa/core.py
def remove_api_key(self, api_id, stage_name): """ Remove a generated API key for api_id and stage_name """ response = self.apigateway_client.get_api_keys( limit=1, nameQuery='{}_{}'.format(stage_name, api_id) ) for api_key in response.get('items'):...
def remove_api_key(self, api_id, stage_name): """ Remove a generated API key for api_id and stage_name """ response = self.apigateway_client.get_api_keys( limit=1, nameQuery='{}_{}'.format(stage_name, api_id) ) for api_key in response.get('items'):...
[ "Remove", "a", "generated", "API", "key", "for", "api_id", "and", "stage_name" ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L1935-L1946
[ "def", "remove_api_key", "(", "self", ",", "api_id", ",", "stage_name", ")", ":", "response", "=", "self", ".", "apigateway_client", ".", "get_api_keys", "(", "limit", "=", "1", ",", "nameQuery", "=", "'{}_{}'", ".", "format", "(", "stage_name", ",", "api_...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
Zappa.add_api_stage_to_api_key
Add api stage to Api key
zappa/core.py
def add_api_stage_to_api_key(self, api_key, api_id, stage_name): """ Add api stage to Api key """ self.apigateway_client.update_api_key( apiKey=api_key, patchOperations=[ { 'op': 'add', 'path': '/stages', ...
def add_api_stage_to_api_key(self, api_key, api_id, stage_name): """ Add api stage to Api key """ self.apigateway_client.update_api_key( apiKey=api_key, patchOperations=[ { 'op': 'add', 'path': '/stages', ...
[ "Add", "api", "stage", "to", "Api", "key" ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L1948-L1961
[ "def", "add_api_stage_to_api_key", "(", "self", ",", "api_key", ",", "api_id", ",", "stage_name", ")", ":", "self", ".", "apigateway_client", ".", "update_api_key", "(", "apiKey", "=", "api_key", ",", "patchOperations", "=", "[", "{", "'op'", ":", "'add'", "...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
Zappa.get_patch_op
Return an object that describes a change of configuration on the given staging. Setting will be applied on all available HTTP methods.
zappa/core.py
def get_patch_op(self, keypath, value, op='replace'): """ Return an object that describes a change of configuration on the given staging. Setting will be applied on all available HTTP methods. """ if isinstance(value, bool): value = str(value).lower() return {...
def get_patch_op(self, keypath, value, op='replace'): """ Return an object that describes a change of configuration on the given staging. Setting will be applied on all available HTTP methods. """ if isinstance(value, bool): value = str(value).lower() return {...
[ "Return", "an", "object", "that", "describes", "a", "change", "of", "configuration", "on", "the", "given", "staging", ".", "Setting", "will", "be", "applied", "on", "all", "available", "HTTP", "methods", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L1963-L1970
[ "def", "get_patch_op", "(", "self", ",", "keypath", ",", "value", ",", "op", "=", "'replace'", ")", ":", "if", "isinstance", "(", "value", ",", "bool", ")", ":", "value", "=", "str", "(", "value", ")", ".", "lower", "(", ")", "return", "{", "'op'",...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
Zappa.get_rest_apis
Generator that allows to iterate per every available apis.
zappa/core.py
def get_rest_apis(self, project_name): """ Generator that allows to iterate per every available apis. """ all_apis = self.apigateway_client.get_rest_apis( limit=500 ) for api in all_apis['items']: if api['name'] != project_name: co...
def get_rest_apis(self, project_name): """ Generator that allows to iterate per every available apis. """ all_apis = self.apigateway_client.get_rest_apis( limit=500 ) for api in all_apis['items']: if api['name'] != project_name: co...
[ "Generator", "that", "allows", "to", "iterate", "per", "every", "available", "apis", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L1972-L1983
[ "def", "get_rest_apis", "(", "self", ",", "project_name", ")", ":", "all_apis", "=", "self", ".", "apigateway_client", ".", "get_rest_apis", "(", "limit", "=", "500", ")", "for", "api", "in", "all_apis", "[", "'items'", "]", ":", "if", "api", "[", "'name...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
Zappa.undeploy_api_gateway
Delete a deployed REST API Gateway.
zappa/core.py
def undeploy_api_gateway(self, lambda_name, domain_name=None, base_path=None): """ Delete a deployed REST API Gateway. """ print("Deleting API Gateway..") api_id = self.get_api_id(lambda_name) if domain_name: # XXX - Remove Route53 smartly here? ...
def undeploy_api_gateway(self, lambda_name, domain_name=None, base_path=None): """ Delete a deployed REST API Gateway. """ print("Deleting API Gateway..") api_id = self.get_api_id(lambda_name) if domain_name: # XXX - Remove Route53 smartly here? ...
[ "Delete", "a", "deployed", "REST", "API", "Gateway", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L1985-L2014
[ "def", "undeploy_api_gateway", "(", "self", ",", "lambda_name", ",", "domain_name", "=", "None", ",", "base_path", "=", "None", ")", ":", "print", "(", "\"Deleting API Gateway..\"", ")", "api_id", "=", "self", ".", "get_api_id", "(", "lambda_name", ")", "if", ...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
Zappa.update_stage_config
Update CloudWatch metrics configuration.
zappa/core.py
def update_stage_config( self, project_name, stage_name, cloudwatch_log_level, cloudwatch_data_trace, cloudwatch_metrics_enabled ...
def update_stage_config( self, project_name, stage_name, cloudwatch_log_level, cloudwatch_data_trace, cloudwatch_metrics_enabled ...
[ "Update", "CloudWatch", "metrics", "configuration", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L2016-L2038
[ "def", "update_stage_config", "(", "self", ",", "project_name", ",", "stage_name", ",", "cloudwatch_log_level", ",", "cloudwatch_data_trace", ",", "cloudwatch_metrics_enabled", ")", ":", "if", "cloudwatch_log_level", "not", "in", "self", ".", "cloudwatch_log_levels", ":...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
Zappa.delete_stack
Delete the CF stack managed by Zappa.
zappa/core.py
def delete_stack(self, name, wait=False): """ Delete the CF stack managed by Zappa. """ try: stack = self.cf_client.describe_stacks(StackName=name)['Stacks'][0] except: # pragma: no cover print('No Zappa stack named {0}'.format(name)) return Fa...
def delete_stack(self, name, wait=False): """ Delete the CF stack managed by Zappa. """ try: stack = self.cf_client.describe_stacks(StackName=name)['Stacks'][0] except: # pragma: no cover print('No Zappa stack named {0}'.format(name)) return Fa...
[ "Delete", "the", "CF", "stack", "managed", "by", "Zappa", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L2076-L2096
[ "def", "delete_stack", "(", "self", ",", "name", ",", "wait", "=", "False", ")", ":", "try", ":", "stack", "=", "self", ".", "cf_client", ".", "describe_stacks", "(", "StackName", "=", "name", ")", "[", "'Stacks'", "]", "[", "0", "]", "except", ":", ...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
Zappa.create_stack_template
Build the entire CF stack. Just used for the API Gateway, but could be expanded in the future.
zappa/core.py
def create_stack_template( self, lambda_arn, lambda_name, api_key_required, iam_authorization, authorizer, cors_options=None, ...
def create_stack_template( self, lambda_arn, lambda_name, api_key_required, iam_authorization, authorizer, cors_options=None, ...
[ "Build", "the", "entire", "CF", "stack", ".", "Just", "used", "for", "the", "API", "Gateway", "but", "could", "be", "expanded", "in", "the", "future", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L2098-L2140
[ "def", "create_stack_template", "(", "self", ",", "lambda_arn", ",", "lambda_name", ",", "api_key_required", ",", "iam_authorization", ",", "authorizer", ",", "cors_options", "=", "None", ",", "description", "=", "None", ",", "endpoint_configuration", "=", "None", ...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
Zappa.update_stack
Update or create the CF stack managed by Zappa.
zappa/core.py
def update_stack(self, name, working_bucket, wait=False, update_only=False, disable_progress=False): """ Update or create the CF stack managed by Zappa. """ capabilities = [] template = name + '-template-' + str(int(time.time())) + '.json' with open(template, 'wb') as ou...
def update_stack(self, name, working_bucket, wait=False, update_only=False, disable_progress=False): """ Update or create the CF stack managed by Zappa. """ capabilities = [] template = name + '-template-' + str(int(time.time())) + '.json' with open(template, 'wb') as ou...
[ "Update", "or", "create", "the", "CF", "stack", "managed", "by", "Zappa", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L2142-L2237
[ "def", "update_stack", "(", "self", ",", "name", ",", "working_bucket", ",", "wait", "=", "False", ",", "update_only", "=", "False", ",", "disable_progress", "=", "False", ")", ":", "capabilities", "=", "[", "]", "template", "=", "name", "+", "'-template-'...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
Zappa.stack_outputs
Given a name, describes CloudFront stacks and returns dict of the stack Outputs , else returns an empty dict.
zappa/core.py
def stack_outputs(self, name): """ Given a name, describes CloudFront stacks and returns dict of the stack Outputs , else returns an empty dict. """ try: stack = self.cf_client.describe_stacks(StackName=name)['Stacks'][0] return {x['OutputKey']: x['OutputV...
def stack_outputs(self, name): """ Given a name, describes CloudFront stacks and returns dict of the stack Outputs , else returns an empty dict. """ try: stack = self.cf_client.describe_stacks(StackName=name)['Stacks'][0] return {x['OutputKey']: x['OutputV...
[ "Given", "a", "name", "describes", "CloudFront", "stacks", "and", "returns", "dict", "of", "the", "stack", "Outputs", "else", "returns", "an", "empty", "dict", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L2239-L2248
[ "def", "stack_outputs", "(", "self", ",", "name", ")", ":", "try", ":", "stack", "=", "self", ".", "cf_client", ".", "describe_stacks", "(", "StackName", "=", "name", ")", "[", "'Stacks'", "]", "[", "0", "]", "return", "{", "x", "[", "'OutputKey'", "...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
Zappa.get_api_url
Given a lambda_name and stage_name, return a valid API URL.
zappa/core.py
def get_api_url(self, lambda_name, stage_name): """ Given a lambda_name and stage_name, return a valid API URL. """ api_id = self.get_api_id(lambda_name) if api_id: return "https://{}.execute-api.{}.amazonaws.com/{}".format(api_id, self.boto_session.region_name, stage...
def get_api_url(self, lambda_name, stage_name): """ Given a lambda_name and stage_name, return a valid API URL. """ api_id = self.get_api_id(lambda_name) if api_id: return "https://{}.execute-api.{}.amazonaws.com/{}".format(api_id, self.boto_session.region_name, stage...
[ "Given", "a", "lambda_name", "and", "stage_name", "return", "a", "valid", "API", "URL", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L2251-L2259
[ "def", "get_api_url", "(", "self", ",", "lambda_name", ",", "stage_name", ")", ":", "api_id", "=", "self", ".", "get_api_id", "(", "lambda_name", ")", "if", "api_id", ":", "return", "\"https://{}.execute-api.{}.amazonaws.com/{}\"", ".", "format", "(", "api_id", ...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
Zappa.get_api_id
Given a lambda_name, return the API id.
zappa/core.py
def get_api_id(self, lambda_name): """ Given a lambda_name, return the API id. """ try: response = self.cf_client.describe_stack_resource(StackName=lambda_name, LogicalResourceId='Api') return response[...
def get_api_id(self, lambda_name): """ Given a lambda_name, return the API id. """ try: response = self.cf_client.describe_stack_resource(StackName=lambda_name, LogicalResourceId='Api') return response[...
[ "Given", "a", "lambda_name", "return", "the", "API", "id", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L2261-L2282
[ "def", "get_api_id", "(", "self", ",", "lambda_name", ")", ":", "try", ":", "response", "=", "self", ".", "cf_client", ".", "describe_stack_resource", "(", "StackName", "=", "lambda_name", ",", "LogicalResourceId", "=", "'Api'", ")", "return", "response", "[",...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
Zappa.create_domain_name
Creates the API GW domain and returns the resulting DNS name.
zappa/core.py
def create_domain_name(self, domain_name, certificate_name, certificate_body=None, certificate_private_key=None, certificate_chain=None, certificate_arn=None,...
def create_domain_name(self, domain_name, certificate_name, certificate_body=None, certificate_private_key=None, certificate_chain=None, certificate_arn=None,...
[ "Creates", "the", "API", "GW", "domain", "and", "returns", "the", "resulting", "DNS", "name", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L2284-L2326
[ "def", "create_domain_name", "(", "self", ",", "domain_name", ",", "certificate_name", ",", "certificate_body", "=", "None", ",", "certificate_private_key", "=", "None", ",", "certificate_chain", "=", "None", ",", "certificate_arn", "=", "None", ",", "lambda_name", ...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
Zappa.update_route53_records
Updates Route53 Records following GW domain creation
zappa/core.py
def update_route53_records(self, domain_name, dns_name): """ Updates Route53 Records following GW domain creation """ zone_id = self.get_hosted_zone_id_for_domain(domain_name) is_apex = self.route53.get_hosted_zone(Id=zone_id)['HostedZone']['Name'][:-1] == domain_name if...
def update_route53_records(self, domain_name, dns_name): """ Updates Route53 Records following GW domain creation """ zone_id = self.get_hosted_zone_id_for_domain(domain_name) is_apex = self.route53.get_hosted_zone(Id=zone_id)['HostedZone']['Name'][:-1] == domain_name if...
[ "Updates", "Route53", "Records", "following", "GW", "domain", "creation" ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L2328-L2377
[ "def", "update_route53_records", "(", "self", ",", "domain_name", ",", "dns_name", ")", ":", "zone_id", "=", "self", ".", "get_hosted_zone_id_for_domain", "(", "domain_name", ")", "is_apex", "=", "self", ".", "route53", ".", "get_hosted_zone", "(", "Id", "=", ...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
Zappa.update_domain_name
This updates your certificate information for an existing domain, with similar arguments to boto's update_domain_name API Gateway api. It returns the resulting new domain information including the new certificate's ARN if created during this process. Previously, this method involved do...
zappa/core.py
def update_domain_name(self, domain_name, certificate_name=None, certificate_body=None, certificate_private_key=None, certificate_chain=None, certificate_arn=...
def update_domain_name(self, domain_name, certificate_name=None, certificate_body=None, certificate_private_key=None, certificate_chain=None, certificate_arn=...
[ "This", "updates", "your", "certificate", "information", "for", "an", "existing", "domain", "with", "similar", "arguments", "to", "boto", "s", "update_domain_name", "API", "Gateway", "api", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L2379-L2429
[ "def", "update_domain_name", "(", "self", ",", "domain_name", ",", "certificate_name", "=", "None", ",", "certificate_body", "=", "None", ",", "certificate_private_key", "=", "None", ",", "certificate_chain", "=", "None", ",", "certificate_arn", "=", "None", ",", ...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
Zappa.update_domain_base_path_mapping
Update domain base path mapping on API Gateway if it was changed
zappa/core.py
def update_domain_base_path_mapping(self, domain_name, lambda_name, stage, base_path): """ Update domain base path mapping on API Gateway if it was changed """ api_id = self.get_api_id(lambda_name) if not api_id: print("Warning! Can't update base path mapping!") ...
def update_domain_base_path_mapping(self, domain_name, lambda_name, stage, base_path): """ Update domain base path mapping on API Gateway if it was changed """ api_id = self.get_api_id(lambda_name) if not api_id: print("Warning! Can't update base path mapping!") ...
[ "Update", "domain", "base", "path", "mapping", "on", "API", "Gateway", "if", "it", "was", "changed" ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L2431-L2458
[ "def", "update_domain_base_path_mapping", "(", "self", ",", "domain_name", ",", "lambda_name", ",", "stage", ",", "base_path", ")", ":", "api_id", "=", "self", ".", "get_api_id", "(", "lambda_name", ")", "if", "not", "api_id", ":", "print", "(", "\"Warning! Ca...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
Zappa.get_all_zones
Same behaviour of list_host_zones, but transparently handling pagination.
zappa/core.py
def get_all_zones(self): """Same behaviour of list_host_zones, but transparently handling pagination.""" zones = {'HostedZones': []} new_zones = self.route53.list_hosted_zones(MaxItems='100') while new_zones['IsTruncated']: zones['HostedZones'] += new_zones['HostedZones'] ...
def get_all_zones(self): """Same behaviour of list_host_zones, but transparently handling pagination.""" zones = {'HostedZones': []} new_zones = self.route53.list_hosted_zones(MaxItems='100') while new_zones['IsTruncated']: zones['HostedZones'] += new_zones['HostedZones'] ...
[ "Same", "behaviour", "of", "list_host_zones", "but", "transparently", "handling", "pagination", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L2460-L2470
[ "def", "get_all_zones", "(", "self", ")", ":", "zones", "=", "{", "'HostedZones'", ":", "[", "]", "}", "new_zones", "=", "self", ".", "route53", ".", "list_hosted_zones", "(", "MaxItems", "=", "'100'", ")", "while", "new_zones", "[", "'IsTruncated'", "]", ...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
Zappa.get_domain_name
Scan our hosted zones for the record of a given name. Returns the record entry, else None.
zappa/core.py
def get_domain_name(self, domain_name, route53=True): """ Scan our hosted zones for the record of a given name. Returns the record entry, else None. """ # Make sure api gateway domain is present try: self.apigateway_client.get_domain_name(domainName=domain_n...
def get_domain_name(self, domain_name, route53=True): """ Scan our hosted zones for the record of a given name. Returns the record entry, else None. """ # Make sure api gateway domain is present try: self.apigateway_client.get_domain_name(domainName=domain_n...
[ "Scan", "our", "hosted", "zones", "for", "the", "record", "of", "a", "given", "name", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L2472-L2513
[ "def", "get_domain_name", "(", "self", ",", "domain_name", ",", "route53", "=", "True", ")", ":", "# Make sure api gateway domain is present", "try", ":", "self", ".", "apigateway_client", ".", "get_domain_name", "(", "domainName", "=", "domain_name", ")", "except",...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
Zappa.get_credentials_arn
Given our role name, get and set the credentials_arn.
zappa/core.py
def get_credentials_arn(self): """ Given our role name, get and set the credentials_arn. """ role = self.iam.Role(self.role_name) self.credentials_arn = role.arn return role, self.credentials_arn
def get_credentials_arn(self): """ Given our role name, get and set the credentials_arn. """ role = self.iam.Role(self.role_name) self.credentials_arn = role.arn return role, self.credentials_arn
[ "Given", "our", "role", "name", "get", "and", "set", "the", "credentials_arn", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L2519-L2526
[ "def", "get_credentials_arn", "(", "self", ")", ":", "role", "=", "self", ".", "iam", ".", "Role", "(", "self", ".", "role_name", ")", "self", ".", "credentials_arn", "=", "role", ".", "arn", "return", "role", ",", "self", ".", "credentials_arn" ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
Zappa.create_iam_roles
Create and defines the IAM roles and policies necessary for Zappa. If the IAM role already exists, it will be updated if necessary.
zappa/core.py
def create_iam_roles(self): """ Create and defines the IAM roles and policies necessary for Zappa. If the IAM role already exists, it will be updated if necessary. """ attach_policy_obj = json.loads(self.attach_policy) assume_policy_obj = json.loads(self.assume_policy) ...
def create_iam_roles(self): """ Create and defines the IAM roles and policies necessary for Zappa. If the IAM role already exists, it will be updated if necessary. """ attach_policy_obj = json.loads(self.attach_policy) assume_policy_obj = json.loads(self.assume_policy) ...
[ "Create", "and", "defines", "the", "IAM", "roles", "and", "policies", "necessary", "for", "Zappa", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L2528-L2581
[ "def", "create_iam_roles", "(", "self", ")", ":", "attach_policy_obj", "=", "json", ".", "loads", "(", "self", ".", "attach_policy", ")", "assume_policy_obj", "=", "json", ".", "loads", "(", "self", ".", "assume_policy", ")", "if", "self", ".", "extra_permis...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
Zappa._clear_policy
Remove obsolete policy statements to prevent policy from bloating over the limit after repeated updates.
zappa/core.py
def _clear_policy(self, lambda_name): """ Remove obsolete policy statements to prevent policy from bloating over the limit after repeated updates. """ try: policy_response = self.lambda_client.get_policy( FunctionName=lambda_name ) if p...
def _clear_policy(self, lambda_name): """ Remove obsolete policy statements to prevent policy from bloating over the limit after repeated updates. """ try: policy_response = self.lambda_client.get_policy( FunctionName=lambda_name ) if p...
[ "Remove", "obsolete", "policy", "statements", "to", "prevent", "policy", "from", "bloating", "over", "the", "limit", "after", "repeated", "updates", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L2583-L2606
[ "def", "_clear_policy", "(", "self", ",", "lambda_name", ")", ":", "try", ":", "policy_response", "=", "self", ".", "lambda_client", ".", "get_policy", "(", "FunctionName", "=", "lambda_name", ")", "if", "policy_response", "[", "'ResponseMetadata'", "]", "[", ...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
Zappa.create_event_permission
Create permissions to link to an event. Related: http://docs.aws.amazon.com/lambda/latest/dg/with-s3-example-configure-event-source.html
zappa/core.py
def create_event_permission(self, lambda_name, principal, source_arn): """ Create permissions to link to an event. Related: http://docs.aws.amazon.com/lambda/latest/dg/with-s3-example-configure-event-source.html """ logger.debug('Adding new permission to invoke Lambda function: ...
def create_event_permission(self, lambda_name, principal, source_arn): """ Create permissions to link to an event. Related: http://docs.aws.amazon.com/lambda/latest/dg/with-s3-example-configure-event-source.html """ logger.debug('Adding new permission to invoke Lambda function: ...
[ "Create", "permissions", "to", "link", "to", "an", "event", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L2612-L2631
[ "def", "create_event_permission", "(", "self", ",", "lambda_name", ",", "principal", ",", "source_arn", ")", ":", "logger", ".", "debug", "(", "'Adding new permission to invoke Lambda function: {}'", ".", "format", "(", "lambda_name", ")", ")", "permission_response", ...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
Zappa.schedule_events
Given a Lambda ARN, name and a list of events, schedule this as CloudWatch Events. 'events' is a list of dictionaries, where the dict must contains the string of a 'function' and the string of the event 'expression', and an optional 'name' and 'description'. Expressions can be in rate or cron ...
zappa/core.py
def schedule_events(self, lambda_arn, lambda_name, events, default=True): """ Given a Lambda ARN, name and a list of events, schedule this as CloudWatch Events. 'events' is a list of dictionaries, where the dict must contains the string of a 'function' and the string of the event 'expre...
def schedule_events(self, lambda_arn, lambda_name, events, default=True): """ Given a Lambda ARN, name and a list of events, schedule this as CloudWatch Events. 'events' is a list of dictionaries, where the dict must contains the string of a 'function' and the string of the event 'expre...
[ "Given", "a", "Lambda", "ARN", "name", "and", "a", "list", "of", "events", "schedule", "this", "as", "CloudWatch", "Events", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L2633-L2771
[ "def", "schedule_events", "(", "self", ",", "lambda_arn", ",", "lambda_name", ",", "events", ",", "default", "=", "True", ")", ":", "# The stream sources - DynamoDB, Kinesis and SQS - are working differently than the other services (pull vs push)", "# and do not require event permi...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
Zappa.get_event_name
Returns an AWS-valid Lambda event name.
zappa/core.py
def get_event_name(lambda_name, name): """ Returns an AWS-valid Lambda event name. """ return '{prefix:.{width}}-{postfix}'.format(prefix=lambda_name, width=max(0, 63 - len(name)), postfix=name)[:64]
def get_event_name(lambda_name, name): """ Returns an AWS-valid Lambda event name. """ return '{prefix:.{width}}-{postfix}'.format(prefix=lambda_name, width=max(0, 63 - len(name)), postfix=name)[:64]
[ "Returns", "an", "AWS", "-", "valid", "Lambda", "event", "name", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L2790-L2795
[ "def", "get_event_name", "(", "lambda_name", ",", "name", ")", ":", "return", "'{prefix:.{width}}-{postfix}'", ".", "format", "(", "prefix", "=", "lambda_name", ",", "width", "=", "max", "(", "0", ",", "63", "-", "len", "(", "name", ")", ")", ",", "postf...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
Zappa.get_hashed_rule_name
Returns an AWS-valid CloudWatch rule name using a digest of the event name, lambda name, and function. This allows support for rule names that may be longer than the 64 char limit.
zappa/core.py
def get_hashed_rule_name(event, function, lambda_name): """ Returns an AWS-valid CloudWatch rule name using a digest of the event name, lambda name, and function. This allows support for rule names that may be longer than the 64 char limit. """ event_name = event.get('name', func...
def get_hashed_rule_name(event, function, lambda_name): """ Returns an AWS-valid CloudWatch rule name using a digest of the event name, lambda name, and function. This allows support for rule names that may be longer than the 64 char limit. """ event_name = event.get('name', func...
[ "Returns", "an", "AWS", "-", "valid", "CloudWatch", "rule", "name", "using", "a", "digest", "of", "the", "event", "name", "lambda", "name", "and", "function", ".", "This", "allows", "support", "for", "rule", "names", "that", "may", "be", "longer", "than", ...
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L2798-L2805
[ "def", "get_hashed_rule_name", "(", "event", ",", "function", ",", "lambda_name", ")", ":", "event_name", "=", "event", ".", "get", "(", "'name'", ",", "function", ")", "name_hash", "=", "hashlib", ".", "sha1", "(", "'{}-{}'", ".", "format", "(", "lambda_n...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
Zappa.delete_rule
Delete a CWE rule. This deletes them, but they will still show up in the AWS console. Annoying.
zappa/core.py
def delete_rule(self, rule_name): """ Delete a CWE rule. This deletes them, but they will still show up in the AWS console. Annoying. """ logger.debug('Deleting existing rule {}'.format(rule_name)) # All targets must be removed before # we can actually...
def delete_rule(self, rule_name): """ Delete a CWE rule. This deletes them, but they will still show up in the AWS console. Annoying. """ logger.debug('Deleting existing rule {}'.format(rule_name)) # All targets must be removed before # we can actually...
[ "Delete", "a", "CWE", "rule", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L2807-L2836
[ "def", "delete_rule", "(", "self", ",", "rule_name", ")", ":", "logger", ".", "debug", "(", "'Deleting existing rule {}'", ".", "format", "(", "rule_name", ")", ")", "# All targets must be removed before", "# we can actually delete the rule.", "try", ":", "targets", "...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
Zappa.get_event_rule_names_for_lambda
Get all of the rule names associated with a lambda function.
zappa/core.py
def get_event_rule_names_for_lambda(self, lambda_arn): """ Get all of the rule names associated with a lambda function. """ response = self.events_client.list_rule_names_by_target(TargetArn=lambda_arn) rule_names = response['RuleNames'] # Iterate when the results are pagi...
def get_event_rule_names_for_lambda(self, lambda_arn): """ Get all of the rule names associated with a lambda function. """ response = self.events_client.list_rule_names_by_target(TargetArn=lambda_arn) rule_names = response['RuleNames'] # Iterate when the results are pagi...
[ "Get", "all", "of", "the", "rule", "names", "associated", "with", "a", "lambda", "function", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L2838-L2849
[ "def", "get_event_rule_names_for_lambda", "(", "self", ",", "lambda_arn", ")", ":", "response", "=", "self", ".", "events_client", ".", "list_rule_names_by_target", "(", "TargetArn", "=", "lambda_arn", ")", "rule_names", "=", "response", "[", "'RuleNames'", "]", "...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
Zappa.get_event_rules_for_lambda
Get all of the rule details associated with this function.
zappa/core.py
def get_event_rules_for_lambda(self, lambda_arn): """ Get all of the rule details associated with this function. """ rule_names = self.get_event_rule_names_for_lambda(lambda_arn=lambda_arn) return [self.events_client.describe_rule(Name=r) for r in rule_names]
def get_event_rules_for_lambda(self, lambda_arn): """ Get all of the rule details associated with this function. """ rule_names = self.get_event_rule_names_for_lambda(lambda_arn=lambda_arn) return [self.events_client.describe_rule(Name=r) for r in rule_names]
[ "Get", "all", "of", "the", "rule", "details", "associated", "with", "this", "function", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L2851-L2856
[ "def", "get_event_rules_for_lambda", "(", "self", ",", "lambda_arn", ")", ":", "rule_names", "=", "self", ".", "get_event_rule_names_for_lambda", "(", "lambda_arn", "=", "lambda_arn", ")", "return", "[", "self", ".", "events_client", ".", "describe_rule", "(", "Na...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
Zappa.unschedule_events
Given a list of events, unschedule these CloudWatch Events. 'events' is a list of dictionaries, where the dict must contains the string of a 'function' and the string of the event 'expression', and an optional 'name' and 'description'.
zappa/core.py
def unschedule_events(self, events, lambda_arn=None, lambda_name=None, excluded_source_services=None): excluded_source_services = excluded_source_services or [] """ Given a list of events, unschedule these CloudWatch Events. 'events' is a list of dictionaries, where the dict must contai...
def unschedule_events(self, events, lambda_arn=None, lambda_name=None, excluded_source_services=None): excluded_source_services = excluded_source_services or [] """ Given a list of events, unschedule these CloudWatch Events. 'events' is a list of dictionaries, where the dict must contai...
[ "Given", "a", "list", "of", "events", "unschedule", "these", "CloudWatch", "Events", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L2858-L2895
[ "def", "unschedule_events", "(", "self", ",", "events", ",", "lambda_arn", "=", "None", ",", "lambda_name", "=", "None", ",", "excluded_source_services", "=", "None", ")", ":", "excluded_source_services", "=", "excluded_source_services", "or", "[", "]", "self", ...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
Zappa.create_async_sns_topic
Create the SNS-based async topic.
zappa/core.py
def create_async_sns_topic(self, lambda_name, lambda_arn): """ Create the SNS-based async topic. """ topic_name = get_topic_name(lambda_name) # Create SNS topic topic_arn = self.sns_client.create_topic( Name=topic_name)['TopicArn'] # Create subscriptio...
def create_async_sns_topic(self, lambda_name, lambda_arn): """ Create the SNS-based async topic. """ topic_name = get_topic_name(lambda_name) # Create SNS topic topic_arn = self.sns_client.create_topic( Name=topic_name)['TopicArn'] # Create subscriptio...
[ "Create", "the", "SNS", "-", "based", "async", "topic", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L2901-L2931
[ "def", "create_async_sns_topic", "(", "self", ",", "lambda_name", ",", "lambda_arn", ")", ":", "topic_name", "=", "get_topic_name", "(", "lambda_name", ")", "# Create SNS topic", "topic_arn", "=", "self", ".", "sns_client", ".", "create_topic", "(", "Name", "=", ...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
Zappa.remove_async_sns_topic
Remove the async SNS topic.
zappa/core.py
def remove_async_sns_topic(self, lambda_name): """ Remove the async SNS topic. """ topic_name = get_topic_name(lambda_name) removed_arns = [] for sub in self.sns_client.list_subscriptions()['Subscriptions']: if topic_name in sub['TopicArn']: se...
def remove_async_sns_topic(self, lambda_name): """ Remove the async SNS topic. """ topic_name = get_topic_name(lambda_name) removed_arns = [] for sub in self.sns_client.list_subscriptions()['Subscriptions']: if topic_name in sub['TopicArn']: se...
[ "Remove", "the", "async", "SNS", "topic", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L2933-L2943
[ "def", "remove_async_sns_topic", "(", "self", ",", "lambda_name", ")", ":", "topic_name", "=", "get_topic_name", "(", "lambda_name", ")", "removed_arns", "=", "[", "]", "for", "sub", "in", "self", ".", "sns_client", ".", "list_subscriptions", "(", ")", "[", ...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
Zappa.create_async_dynamodb_table
Create the DynamoDB table for async task return values
zappa/core.py
def create_async_dynamodb_table(self, table_name, read_capacity, write_capacity): """ Create the DynamoDB table for async task return values """ try: dynamodb_table = self.dynamodb_client.describe_table(TableName=table_name) return False, dynamodb_table #...
def create_async_dynamodb_table(self, table_name, read_capacity, write_capacity): """ Create the DynamoDB table for async task return values """ try: dynamodb_table = self.dynamodb_client.describe_table(TableName=table_name) return False, dynamodb_table #...
[ "Create", "the", "DynamoDB", "table", "for", "async", "task", "return", "values" ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L2960-L2997
[ "def", "create_async_dynamodb_table", "(", "self", ",", "table_name", ",", "read_capacity", ",", "write_capacity", ")", ":", "try", ":", "dynamodb_table", "=", "self", ".", "dynamodb_client", ".", "describe_table", "(", "TableName", "=", "table_name", ")", "return...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
Zappa.fetch_logs
Fetch the CloudWatch logs for a given Lambda name.
zappa/core.py
def fetch_logs(self, lambda_name, filter_pattern='', limit=10000, start_time=0): """ Fetch the CloudWatch logs for a given Lambda name. """ log_name = '/aws/lambda/' + lambda_name streams = self.logs_client.describe_log_streams( logGroupName=log_name, desc...
def fetch_logs(self, lambda_name, filter_pattern='', limit=10000, start_time=0): """ Fetch the CloudWatch logs for a given Lambda name. """ log_name = '/aws/lambda/' + lambda_name streams = self.logs_client.describe_log_streams( logGroupName=log_name, desc...
[ "Fetch", "the", "CloudWatch", "logs", "for", "a", "given", "Lambda", "name", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L3010-L3049
[ "def", "fetch_logs", "(", "self", ",", "lambda_name", ",", "filter_pattern", "=", "''", ",", "limit", "=", "10000", ",", "start_time", "=", "0", ")", ":", "log_name", "=", "'/aws/lambda/'", "+", "lambda_name", "streams", "=", "self", ".", "logs_client", "....
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
Zappa.remove_log_group
Filter all log groups that match the name given in log_filter.
zappa/core.py
def remove_log_group(self, group_name): """ Filter all log groups that match the name given in log_filter. """ print("Removing log group: {}".format(group_name)) try: self.logs_client.delete_log_group(logGroupName=group_name) except botocore.exceptions.ClientE...
def remove_log_group(self, group_name): """ Filter all log groups that match the name given in log_filter. """ print("Removing log group: {}".format(group_name)) try: self.logs_client.delete_log_group(logGroupName=group_name) except botocore.exceptions.ClientE...
[ "Filter", "all", "log", "groups", "that", "match", "the", "name", "given", "in", "log_filter", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L3051-L3059
[ "def", "remove_log_group", "(", "self", ",", "group_name", ")", ":", "print", "(", "\"Removing log group: {}\"", ".", "format", "(", "group_name", ")", ")", "try", ":", "self", ".", "logs_client", ".", "delete_log_group", "(", "logGroupName", "=", "group_name", ...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
Zappa.remove_api_gateway_logs
Removed all logs that are assigned to a given rest api id.
zappa/core.py
def remove_api_gateway_logs(self, project_name): """ Removed all logs that are assigned to a given rest api id. """ for rest_api in self.get_rest_apis(project_name): for stage in self.apigateway_client.get_stages(restApiId=rest_api['id'])['item']: self.remove_...
def remove_api_gateway_logs(self, project_name): """ Removed all logs that are assigned to a given rest api id. """ for rest_api in self.get_rest_apis(project_name): for stage in self.apigateway_client.get_stages(restApiId=rest_api['id'])['item']: self.remove_...
[ "Removed", "all", "logs", "that", "are", "assigned", "to", "a", "given", "rest", "api", "id", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L3067-L3073
[ "def", "remove_api_gateway_logs", "(", "self", ",", "project_name", ")", ":", "for", "rest_api", "in", "self", ".", "get_rest_apis", "(", "project_name", ")", ":", "for", "stage", "in", "self", ".", "apigateway_client", ".", "get_stages", "(", "restApiId", "="...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
Zappa.get_hosted_zone_id_for_domain
Get the Hosted Zone ID for a given domain.
zappa/core.py
def get_hosted_zone_id_for_domain(self, domain): """ Get the Hosted Zone ID for a given domain. """ all_zones = self.get_all_zones() return self.get_best_match_zone(all_zones, domain)
def get_hosted_zone_id_for_domain(self, domain): """ Get the Hosted Zone ID for a given domain. """ all_zones = self.get_all_zones() return self.get_best_match_zone(all_zones, domain)
[ "Get", "the", "Hosted", "Zone", "ID", "for", "a", "given", "domain", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L3079-L3085
[ "def", "get_hosted_zone_id_for_domain", "(", "self", ",", "domain", ")", ":", "all_zones", "=", "self", ".", "get_all_zones", "(", ")", "return", "self", ".", "get_best_match_zone", "(", "all_zones", ",", "domain", ")" ]
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
Zappa.get_best_match_zone
Return zone id which name is closer matched with domain name.
zappa/core.py
def get_best_match_zone(all_zones, domain): """Return zone id which name is closer matched with domain name.""" # Related: https://github.com/Miserlou/Zappa/issues/459 public_zones = [zone for zone in all_zones['HostedZones'] if not zone['Config']['PrivateZone']] zones = {zone['Name'][...
def get_best_match_zone(all_zones, domain): """Return zone id which name is closer matched with domain name.""" # Related: https://github.com/Miserlou/Zappa/issues/459 public_zones = [zone for zone in all_zones['HostedZones'] if not zone['Config']['PrivateZone']] zones = {zone['Name'][...
[ "Return", "zone", "id", "which", "name", "is", "closer", "matched", "with", "domain", "name", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L3088-L3099
[ "def", "get_best_match_zone", "(", "all_zones", ",", "domain", ")", ":", "# Related: https://github.com/Miserlou/Zappa/issues/459", "public_zones", "=", "[", "zone", "for", "zone", "in", "all_zones", "[", "'HostedZones'", "]", "if", "not", "zone", "[", "'Config'", "...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
Zappa.remove_dns_challenge_txt
Remove DNS challenge TXT.
zappa/core.py
def remove_dns_challenge_txt(self, zone_id, domain, txt_challenge): """ Remove DNS challenge TXT. """ print("Deleting DNS challenge..") resp = self.route53.change_resource_record_sets( HostedZoneId=zone_id, ChangeBatch=self.get_dns_challenge_change_batch('...
def remove_dns_challenge_txt(self, zone_id, domain, txt_challenge): """ Remove DNS challenge TXT. """ print("Deleting DNS challenge..") resp = self.route53.change_resource_record_sets( HostedZoneId=zone_id, ChangeBatch=self.get_dns_challenge_change_batch('...
[ "Remove", "DNS", "challenge", "TXT", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L3113-L3123
[ "def", "remove_dns_challenge_txt", "(", "self", ",", "zone_id", ",", "domain", ",", "txt_challenge", ")", ":", "print", "(", "\"Deleting DNS challenge..\"", ")", "resp", "=", "self", ".", "route53", ".", "change_resource_record_sets", "(", "HostedZoneId", "=", "zo...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
Zappa.load_credentials
Load AWS credentials. An optional boto_session can be provided, but that's usually for testing. An optional profile_name can be provided for config files that have multiple sets of credentials.
zappa/core.py
def load_credentials(self, boto_session=None, profile_name=None): """ Load AWS credentials. An optional boto_session can be provided, but that's usually for testing. An optional profile_name can be provided for config files that have multiple sets of credentials. """ ...
def load_credentials(self, boto_session=None, profile_name=None): """ Load AWS credentials. An optional boto_session can be provided, but that's usually for testing. An optional profile_name can be provided for config files that have multiple sets of credentials. """ ...
[ "Load", "AWS", "credentials", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/core.py#L3161-L3204
[ "def", "load_credentials", "(", "self", ",", "boto_session", "=", "None", ",", "profile_name", "=", "None", ")", ":", "# Automatically load credentials from config or environment", "if", "not", "boto_session", ":", "# If provided, use the supplied profile name.", "if", "pro...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
get_cert_and_update_domain
Main cert installer path.
zappa/letsencrypt.py
def get_cert_and_update_domain( zappa_instance, lambda_name, api_stage, domain=None, manual=False, ): """ Main cert installe...
def get_cert_and_update_domain( zappa_instance, lambda_name, api_stage, domain=None, manual=False, ): """ Main cert installe...
[ "Main", "cert", "installer", "path", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/letsencrypt.py#L47-L112
[ "def", "get_cert_and_update_domain", "(", "zappa_instance", ",", "lambda_name", ",", "api_stage", ",", "domain", "=", "None", ",", "manual", "=", "False", ",", ")", ":", "try", ":", "create_domain_key", "(", ")", "create_domain_csr", "(", "domain", ")", "get_c...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
parse_account_key
Parse account key to get public key
zappa/letsencrypt.py
def parse_account_key(): """Parse account key to get public key""" LOGGER.info("Parsing account key...") cmd = [ 'openssl', 'rsa', '-in', os.path.join(gettempdir(), 'account.key'), '-noout', '-text' ] devnull = open(os.devnull, 'wb') return subprocess.check_output...
def parse_account_key(): """Parse account key to get public key""" LOGGER.info("Parsing account key...") cmd = [ 'openssl', 'rsa', '-in', os.path.join(gettempdir(), 'account.key'), '-noout', '-text' ] devnull = open(os.devnull, 'wb') return subprocess.check_output...
[ "Parse", "account", "key", "to", "get", "public", "key" ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/letsencrypt.py#L151-L161
[ "def", "parse_account_key", "(", ")", ":", "LOGGER", ".", "info", "(", "\"Parsing account key...\"", ")", "cmd", "=", "[", "'openssl'", ",", "'rsa'", ",", "'-in'", ",", "os", ".", "path", ".", "join", "(", "gettempdir", "(", ")", ",", "'account.key'", ")...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
parse_csr
Parse certificate signing request for domains
zappa/letsencrypt.py
def parse_csr(): """ Parse certificate signing request for domains """ LOGGER.info("Parsing CSR...") cmd = [ 'openssl', 'req', '-in', os.path.join(gettempdir(), 'domain.csr'), '-noout', '-text' ] devnull = open(os.devnull, 'wb') out = subprocess.check_outp...
def parse_csr(): """ Parse certificate signing request for domains """ LOGGER.info("Parsing CSR...") cmd = [ 'openssl', 'req', '-in', os.path.join(gettempdir(), 'domain.csr'), '-noout', '-text' ] devnull = open(os.devnull, 'wb') out = subprocess.check_outp...
[ "Parse", "certificate", "signing", "request", "for", "domains" ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/letsencrypt.py#L164-L187
[ "def", "parse_csr", "(", ")", ":", "LOGGER", ".", "info", "(", "\"Parsing CSR...\"", ")", "cmd", "=", "[", "'openssl'", ",", "'req'", ",", "'-in'", ",", "os", ".", "path", ".", "join", "(", "gettempdir", "(", ")", ",", "'domain.csr'", ")", ",", "'-no...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
get_boulder_header
Use regular expressions to find crypto values from parsed account key, and return a header we can send to our Boulder instance.
zappa/letsencrypt.py
def get_boulder_header(key_bytes): """ Use regular expressions to find crypto values from parsed account key, and return a header we can send to our Boulder instance. """ pub_hex, pub_exp = re.search( r"modulus:\n\s+00:([a-f0-9\:\s]+?)\npublicExponent: ([0-9]+)", key_bytes.decode('ut...
def get_boulder_header(key_bytes): """ Use regular expressions to find crypto values from parsed account key, and return a header we can send to our Boulder instance. """ pub_hex, pub_exp = re.search( r"modulus:\n\s+00:([a-f0-9\:\s]+?)\npublicExponent: ([0-9]+)", key_bytes.decode('ut...
[ "Use", "regular", "expressions", "to", "find", "crypto", "values", "from", "parsed", "account", "key", "and", "return", "a", "header", "we", "can", "send", "to", "our", "Boulder", "instance", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/letsencrypt.py#L190-L209
[ "def", "get_boulder_header", "(", "key_bytes", ")", ":", "pub_hex", ",", "pub_exp", "=", "re", ".", "search", "(", "r\"modulus:\\n\\s+00:([a-f0-9\\:\\s]+?)\\npublicExponent: ([0-9]+)\"", ",", "key_bytes", ".", "decode", "(", "'utf8'", ")", ",", "re", ".", "MULTILINE...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
register_account
Agree to LE TOS
zappa/letsencrypt.py
def register_account(): """ Agree to LE TOS """ LOGGER.info("Registering account...") code, result = _send_signed_request(DEFAULT_CA + "/acme/new-reg", { "resource": "new-reg", "agreement": "https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf", }) if code == 201...
def register_account(): """ Agree to LE TOS """ LOGGER.info("Registering account...") code, result = _send_signed_request(DEFAULT_CA + "/acme/new-reg", { "resource": "new-reg", "agreement": "https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf", }) if code == 201...
[ "Agree", "to", "LE", "TOS" ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/letsencrypt.py#L212-L226
[ "def", "register_account", "(", ")", ":", "LOGGER", ".", "info", "(", "\"Registering account...\"", ")", "code", ",", "result", "=", "_send_signed_request", "(", "DEFAULT_CA", "+", "\"/acme/new-reg\"", ",", "{", "\"resource\"", ":", "\"new-reg\"", ",", "\"agreemen...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
get_cert
Call LE to get a new signed CA.
zappa/letsencrypt.py
def get_cert(zappa_instance, log=LOGGER, CA=DEFAULT_CA): """ Call LE to get a new signed CA. """ out = parse_account_key() header = get_boulder_header(out) accountkey_json = json.dumps(header['jwk'], sort_keys=True, separators=(',', ':')) thumbprint = _b64(hashlib.sha256(accountkey_json.enco...
def get_cert(zappa_instance, log=LOGGER, CA=DEFAULT_CA): """ Call LE to get a new signed CA. """ out = parse_account_key() header = get_boulder_header(out) accountkey_json = json.dumps(header['jwk'], sort_keys=True, separators=(',', ':')) thumbprint = _b64(hashlib.sha256(accountkey_json.enco...
[ "Call", "LE", "to", "get", "a", "new", "signed", "CA", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/letsencrypt.py#L229-L293
[ "def", "get_cert", "(", "zappa_instance", ",", "log", "=", "LOGGER", ",", "CA", "=", "DEFAULT_CA", ")", ":", "out", "=", "parse_account_key", "(", ")", "header", "=", "get_boulder_header", "(", "out", ")", "accountkey_json", "=", "json", ".", "dumps", "(",...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
verify_challenge
Loop until our challenge is verified, else fail.
zappa/letsencrypt.py
def verify_challenge(uri): """ Loop until our challenge is verified, else fail. """ while True: try: resp = urlopen(uri) challenge_status = json.loads(resp.read().decode('utf8')) except IOError as e: raise ValueError("Error checking challenge: {0} {1}"...
def verify_challenge(uri): """ Loop until our challenge is verified, else fail. """ while True: try: resp = urlopen(uri) challenge_status = json.loads(resp.read().decode('utf8')) except IOError as e: raise ValueError("Error checking challenge: {0} {1}"...
[ "Loop", "until", "our", "challenge", "is", "verified", "else", "fail", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/letsencrypt.py#L296-L314
[ "def", "verify_challenge", "(", "uri", ")", ":", "while", "True", ":", "try", ":", "resp", "=", "urlopen", "(", "uri", ")", "challenge_status", "=", "json", ".", "loads", "(", "resp", ".", "read", "(", ")", ".", "decode", "(", "'utf8'", ")", ")", "...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
sign_certificate
Get the new certificate. Returns the signed bytes.
zappa/letsencrypt.py
def sign_certificate(): """ Get the new certificate. Returns the signed bytes. """ LOGGER.info("Signing certificate...") cmd = [ 'openssl', 'req', '-in', os.path.join(gettempdir(), 'domain.csr'), '-outform', 'DER' ] devnull = open(os.devnull, 'wb') csr_der = ...
def sign_certificate(): """ Get the new certificate. Returns the signed bytes. """ LOGGER.info("Signing certificate...") cmd = [ 'openssl', 'req', '-in', os.path.join(gettempdir(), 'domain.csr'), '-outform', 'DER' ] devnull = open(os.devnull, 'wb') csr_der = ...
[ "Get", "the", "new", "certificate", ".", "Returns", "the", "signed", "bytes", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/letsencrypt.py#L317-L339
[ "def", "sign_certificate", "(", ")", ":", "LOGGER", ".", "info", "(", "\"Signing certificate...\"", ")", "cmd", "=", "[", "'openssl'", ",", "'req'", ",", "'-in'", ",", "os", ".", "path", ".", "join", "(", "gettempdir", "(", ")", ",", "'domain.csr'", ")",...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
encode_certificate
Encode cert bytes to PEM encoded cert file.
zappa/letsencrypt.py
def encode_certificate(result): """ Encode cert bytes to PEM encoded cert file. """ cert_body = """-----BEGIN CERTIFICATE-----\n{0}\n-----END CERTIFICATE-----\n""".format( "\n".join(textwrap.wrap(base64.b64encode(result).decode('utf8'), 64))) signed_crt = open("{}/signed.crt".format(gettempd...
def encode_certificate(result): """ Encode cert bytes to PEM encoded cert file. """ cert_body = """-----BEGIN CERTIFICATE-----\n{0}\n-----END CERTIFICATE-----\n""".format( "\n".join(textwrap.wrap(base64.b64encode(result).decode('utf8'), 64))) signed_crt = open("{}/signed.crt".format(gettempd...
[ "Encode", "cert", "bytes", "to", "PEM", "encoded", "cert", "file", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/letsencrypt.py#L342-L352
[ "def", "encode_certificate", "(", "result", ")", ":", "cert_body", "=", "\"\"\"-----BEGIN CERTIFICATE-----\\n{0}\\n-----END CERTIFICATE-----\\n\"\"\"", ".", "format", "(", "\"\\n\"", ".", "join", "(", "textwrap", ".", "wrap", "(", "base64", ".", "b64encode", "(", "res...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
_send_signed_request
Helper function to make signed requests to Boulder
zappa/letsencrypt.py
def _send_signed_request(url, payload): """ Helper function to make signed requests to Boulder """ payload64 = _b64(json.dumps(payload).encode('utf8')) out = parse_account_key() header = get_boulder_header(out) protected = copy.deepcopy(header) protected["nonce"] = urlopen(DEFAULT_CA +...
def _send_signed_request(url, payload): """ Helper function to make signed requests to Boulder """ payload64 = _b64(json.dumps(payload).encode('utf8')) out = parse_account_key() header = get_boulder_header(out) protected = copy.deepcopy(header) protected["nonce"] = urlopen(DEFAULT_CA +...
[ "Helper", "function", "to", "make", "signed", "requests", "to", "Boulder" ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/letsencrypt.py#L366-L398
[ "def", "_send_signed_request", "(", "url", ",", "payload", ")", ":", "payload64", "=", "_b64", "(", "json", ".", "dumps", "(", "payload", ")", ".", "encode", "(", "'utf8'", ")", ")", "out", "=", "parse_account_key", "(", ")", "header", "=", "get_boulder_...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
shamelessly_promote
Shamelessly promote our little community.
zappa/cli.py
def shamelessly_promote(): """ Shamelessly promote our little community. """ click.echo("Need " + click.style("help", fg='green', bold=True) + "? Found a " + click.style("bug", fg='green', bold=True) + "? Let us " + click.style("know", fg='green', bold=True) + "! :D") ...
def shamelessly_promote(): """ Shamelessly promote our little community. """ click.echo("Need " + click.style("help", fg='green', bold=True) + "? Found a " + click.style("bug", fg='green', bold=True) + "? Let us " + click.style("know", fg='green', bold=True) + "! :D") ...
[ "Shamelessly", "promote", "our", "little", "community", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/cli.py#L2744-L2757
[ "def", "shamelessly_promote", "(", ")", ":", "click", ".", "echo", "(", "\"Need \"", "+", "click", ".", "style", "(", "\"help\"", ",", "fg", "=", "'green'", ",", "bold", "=", "True", ")", "+", "\"? Found a \"", "+", "click", ".", "style", "(", "\"bug\"...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
handle
Main program execution handler.
zappa/cli.py
def handle(): # pragma: no cover """ Main program execution handler. """ try: cli = ZappaCLI() sys.exit(cli.handle()) except SystemExit as e: # pragma: no cover cli.on_exit() sys.exit(e.code) except KeyboardInterrupt: # pragma: no cover cli.on_exit() ...
def handle(): # pragma: no cover """ Main program execution handler. """ try: cli = ZappaCLI() sys.exit(cli.handle()) except SystemExit as e: # pragma: no cover cli.on_exit() sys.exit(e.code) except KeyboardInterrupt: # pragma: no cover cli.on_exit() ...
[ "Main", "program", "execution", "handler", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/cli.py#L2772-L2797
[ "def", "handle", "(", ")", ":", "# pragma: no cover", "try", ":", "cli", "=", "ZappaCLI", "(", ")", "sys", ".", "exit", "(", "cli", ".", "handle", "(", ")", ")", "except", "SystemExit", "as", "e", ":", "# pragma: no cover", "cli", ".", "on_exit", "(", ...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
ZappaCLI.stage_config
A shortcut property for settings of a stage.
zappa/cli.py
def stage_config(self): """ A shortcut property for settings of a stage. """ def get_stage_setting(stage, extended_stages=None): if extended_stages is None: extended_stages = [] if stage in extended_stages: raise RuntimeError(stag...
def stage_config(self): """ A shortcut property for settings of a stage. """ def get_stage_setting(stage, extended_stages=None): if extended_stages is None: extended_stages = [] if stage in extended_stages: raise RuntimeError(stag...
[ "A", "shortcut", "property", "for", "settings", "of", "a", "stage", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/cli.py#L127-L161
[ "def", "stage_config", "(", "self", ")", ":", "def", "get_stage_setting", "(", "stage", ",", "extended_stages", "=", "None", ")", ":", "if", "extended_stages", "is", "None", ":", "extended_stages", "=", "[", "]", "if", "stage", "in", "extended_stages", ":", ...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
ZappaCLI.override_stage_config_setting
Forcefully override a setting set by zappa_settings (for the current stage only) :param key: settings key :param val: value
zappa/cli.py
def override_stage_config_setting(self, key, val): """ Forcefully override a setting set by zappa_settings (for the current stage only) :param key: settings key :param val: value """ self._stage_config_overrides = getattr(self, '_stage_config_overrides', {}) self....
def override_stage_config_setting(self, key, val): """ Forcefully override a setting set by zappa_settings (for the current stage only) :param key: settings key :param val: value """ self._stage_config_overrides = getattr(self, '_stage_config_overrides', {}) self....
[ "Forcefully", "override", "a", "setting", "set", "by", "zappa_settings", "(", "for", "the", "current", "stage", "only", ")", ":", "param", "key", ":", "settings", "key", ":", "param", "val", ":", "value" ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/cli.py#L171-L178
[ "def", "override_stage_config_setting", "(", "self", ",", "key", ",", "val", ")", ":", "self", ".", "_stage_config_overrides", "=", "getattr", "(", "self", ",", "'_stage_config_overrides'", ",", "{", "}", ")", "self", ".", "_stage_config_overrides", ".", "setdef...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
ZappaCLI.handle
Main function. Parses command, load settings and dispatches accordingly.
zappa/cli.py
def handle(self, argv=None): """ Main function. Parses command, load settings and dispatches accordingly. """ desc = ('Zappa - Deploy Python applications to AWS Lambda' ' and API Gateway.\n') parser = argparse.ArgumentParser(description=desc) pa...
def handle(self, argv=None): """ Main function. Parses command, load settings and dispatches accordingly. """ desc = ('Zappa - Deploy Python applications to AWS Lambda' ' and API Gateway.\n') parser = argparse.ArgumentParser(description=desc) pa...
[ "Main", "function", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/cli.py#L180-L513
[ "def", "handle", "(", "self", ",", "argv", "=", "None", ")", ":", "desc", "=", "(", "'Zappa - Deploy Python applications to AWS Lambda'", "' and API Gateway.\\n'", ")", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "desc", ")", "parser...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
ZappaCLI.dispatch_command
Given a command to execute and stage, execute that command.
zappa/cli.py
def dispatch_command(self, command, stage): """ Given a command to execute and stage, execute that command. """ self.api_stage = stage if command not in ['status', 'manage']: if not self.vargs.get('json', None): click.echo("Calling " + click....
def dispatch_command(self, command, stage): """ Given a command to execute and stage, execute that command. """ self.api_stage = stage if command not in ['status', 'manage']: if not self.vargs.get('json', None): click.echo("Calling " + click....
[ "Given", "a", "command", "to", "execute", "and", "stage", "execute", "that", "command", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/cli.py#L515-L620
[ "def", "dispatch_command", "(", "self", ",", "command", ",", "stage", ")", ":", "self", ".", "api_stage", "=", "stage", "if", "command", "not", "in", "[", "'status'", ",", "'manage'", "]", ":", "if", "not", "self", ".", "vargs", ".", "get", "(", "'js...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
ZappaCLI.package
Only build the package
zappa/cli.py
def package(self, output=None): """ Only build the package """ # Make sure we're in a venv. self.check_venv() # force not to delete the local zip self.override_stage_config_setting('delete_local_zip', False) # Execute the prebuild script if self.p...
def package(self, output=None): """ Only build the package """ # Make sure we're in a venv. self.check_venv() # force not to delete the local zip self.override_stage_config_setting('delete_local_zip', False) # Execute the prebuild script if self.p...
[ "Only", "build", "the", "package" ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/cli.py#L626-L642
[ "def", "package", "(", "self", ",", "output", "=", "None", ")", ":", "# Make sure we're in a venv.", "self", ".", "check_venv", "(", ")", "# force not to delete the local zip", "self", ".", "override_stage_config_setting", "(", "'delete_local_zip'", ",", "False", ")",...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
ZappaCLI.template
Only build the template file.
zappa/cli.py
def template(self, lambda_arn, role_arn, output=None, json=False): """ Only build the template file. """ if not lambda_arn: raise ClickException("Lambda ARN is required to template.") if not role_arn: raise ClickException("Role ARN is required to templat...
def template(self, lambda_arn, role_arn, output=None, json=False): """ Only build the template file. """ if not lambda_arn: raise ClickException("Lambda ARN is required to template.") if not role_arn: raise ClickException("Role ARN is required to templat...
[ "Only", "build", "the", "template", "file", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/cli.py#L644-L681
[ "def", "template", "(", "self", ",", "lambda_arn", ",", "role_arn", ",", "output", "=", "None", ",", "json", "=", "False", ")", ":", "if", "not", "lambda_arn", ":", "raise", "ClickException", "(", "\"Lambda ARN is required to template.\"", ")", "if", "not", ...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
ZappaCLI.deploy
Package your project, upload it to S3, register the Lambda function and create the API Gateway routes.
zappa/cli.py
def deploy(self, source_zip=None): """ Package your project, upload it to S3, register the Lambda function and create the API Gateway routes. """ if not source_zip: # Make sure we're in a venv. self.check_venv() # Execute the prebuild script...
def deploy(self, source_zip=None): """ Package your project, upload it to S3, register the Lambda function and create the API Gateway routes. """ if not source_zip: # Make sure we're in a venv. self.check_venv() # Execute the prebuild script...
[ "Package", "your", "project", "upload", "it", "to", "S3", "register", "the", "Lambda", "function", "and", "create", "the", "API", "Gateway", "routes", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/cli.py#L683-L854
[ "def", "deploy", "(", "self", ",", "source_zip", "=", "None", ")", ":", "if", "not", "source_zip", ":", "# Make sure we're in a venv.", "self", ".", "check_venv", "(", ")", "# Execute the prebuild script", "if", "self", ".", "prebuild_script", ":", "self", ".", ...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
ZappaCLI.update
Repackage and update the function code.
zappa/cli.py
def update(self, source_zip=None, no_upload=False): """ Repackage and update the function code. """ if not source_zip: # Make sure we're in a venv. self.check_venv() # Execute the prebuild script if self.prebuild_script: s...
def update(self, source_zip=None, no_upload=False): """ Repackage and update the function code. """ if not source_zip: # Make sure we're in a venv. self.check_venv() # Execute the prebuild script if self.prebuild_script: s...
[ "Repackage", "and", "update", "the", "function", "code", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/cli.py#L856-L1055
[ "def", "update", "(", "self", ",", "source_zip", "=", "None", ",", "no_upload", "=", "False", ")", ":", "if", "not", "source_zip", ":", "# Make sure we're in a venv.", "self", ".", "check_venv", "(", ")", "# Execute the prebuild script", "if", "self", ".", "pr...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
ZappaCLI.rollback
Rollsback the currently deploy lambda code to a previous revision.
zappa/cli.py
def rollback(self, revision): """ Rollsback the currently deploy lambda code to a previous revision. """ print("Rolling back..") self.zappa.rollback_lambda_function_version( self.lambda_name, versions_back=revision) print("Done!")
def rollback(self, revision): """ Rollsback the currently deploy lambda code to a previous revision. """ print("Rolling back..") self.zappa.rollback_lambda_function_version( self.lambda_name, versions_back=revision) print("Done!")
[ "Rollsback", "the", "currently", "deploy", "lambda", "code", "to", "a", "previous", "revision", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/cli.py#L1057-L1066
[ "def", "rollback", "(", "self", ",", "revision", ")", ":", "print", "(", "\"Rolling back..\"", ")", "self", ".", "zappa", ".", "rollback_lambda_function_version", "(", "self", ".", "lambda_name", ",", "versions_back", "=", "revision", ")", "print", "(", "\"Don...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
ZappaCLI.tail
Tail this function's logs. if keep_open, do so repeatedly, printing any new logs
zappa/cli.py
def tail(self, since, filter_pattern, limit=10000, keep_open=True, colorize=True, http=False, non_http=False, force_colorize=False): """ Tail this function's logs. if keep_open, do so repeatedly, printing any new logs """ try: since_stamp = string_to_timestamp(since...
def tail(self, since, filter_pattern, limit=10000, keep_open=True, colorize=True, http=False, non_http=False, force_colorize=False): """ Tail this function's logs. if keep_open, do so repeatedly, printing any new logs """ try: since_stamp = string_to_timestamp(since...
[ "Tail", "this", "function", "s", "logs", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/cli.py#L1068-L1100
[ "def", "tail", "(", "self", ",", "since", ",", "filter_pattern", ",", "limit", "=", "10000", ",", "keep_open", "=", "True", ",", "colorize", "=", "True", ",", "http", "=", "False", ",", "non_http", "=", "False", ",", "force_colorize", "=", "False", ")"...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
ZappaCLI.undeploy
Tear down an existing deployment.
zappa/cli.py
def undeploy(self, no_confirm=False, remove_logs=False): """ Tear down an existing deployment. """ if not no_confirm: # pragma: no cover confirm = input("Are you sure you want to undeploy? [y/n] ") if confirm != 'y': return if self.use_al...
def undeploy(self, no_confirm=False, remove_logs=False): """ Tear down an existing deployment. """ if not no_confirm: # pragma: no cover confirm = input("Are you sure you want to undeploy? [y/n] ") if confirm != 'y': return if self.use_al...
[ "Tear", "down", "an", "existing", "deployment", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/cli.py#L1102-L1139
[ "def", "undeploy", "(", "self", ",", "no_confirm", "=", "False", ",", "remove_logs", "=", "False", ")", ":", "if", "not", "no_confirm", ":", "# pragma: no cover", "confirm", "=", "input", "(", "\"Are you sure you want to undeploy? [y/n] \"", ")", "if", "confirm", ...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
ZappaCLI.update_cognito_triggers
Update any cognito triggers
zappa/cli.py
def update_cognito_triggers(self): """ Update any cognito triggers """ if self.cognito: user_pool = self.cognito.get('user_pool') triggers = self.cognito.get('triggers', []) lambda_configs = set() for trigger in triggers: la...
def update_cognito_triggers(self): """ Update any cognito triggers """ if self.cognito: user_pool = self.cognito.get('user_pool') triggers = self.cognito.get('triggers', []) lambda_configs = set() for trigger in triggers: la...
[ "Update", "any", "cognito", "triggers" ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/cli.py#L1141-L1151
[ "def", "update_cognito_triggers", "(", "self", ")", ":", "if", "self", ".", "cognito", ":", "user_pool", "=", "self", ".", "cognito", ".", "get", "(", "'user_pool'", ")", "triggers", "=", "self", ".", "cognito", ".", "get", "(", "'triggers'", ",", "[", ...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
ZappaCLI.schedule
Given a a list of functions and a schedule to execute them, setup up regular execution.
zappa/cli.py
def schedule(self): """ Given a a list of functions and a schedule to execute them, setup up regular execution. """ events = self.stage_config.get('events', []) if events: if not isinstance(events, list): # pragma: no cover print("Events must...
def schedule(self): """ Given a a list of functions and a schedule to execute them, setup up regular execution. """ events = self.stage_config.get('events', []) if events: if not isinstance(events, list): # pragma: no cover print("Events must...
[ "Given", "a", "a", "list", "of", "functions", "and", "a", "schedule", "to", "execute", "them", "setup", "up", "regular", "execution", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/cli.py#L1153-L1223
[ "def", "schedule", "(", "self", ")", ":", "events", "=", "self", ".", "stage_config", ".", "get", "(", "'events'", ",", "[", "]", ")", "if", "events", ":", "if", "not", "isinstance", "(", "events", ",", "list", ")", ":", "# pragma: no cover", "print", ...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
ZappaCLI.unschedule
Given a a list of scheduled functions, tear down their regular execution.
zappa/cli.py
def unschedule(self): """ Given a a list of scheduled functions, tear down their regular execution. """ # Run even if events are not defined to remove previously existing ones (thus default to []). events = self.stage_config.get('events', []) if not isinstance(...
def unschedule(self): """ Given a a list of scheduled functions, tear down their regular execution. """ # Run even if events are not defined to remove previously existing ones (thus default to []). events = self.stage_config.get('events', []) if not isinstance(...
[ "Given", "a", "a", "list", "of", "scheduled", "functions", "tear", "down", "their", "regular", "execution", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/cli.py#L1225-L1258
[ "def", "unschedule", "(", "self", ")", ":", "# Run even if events are not defined to remove previously existing ones (thus default to []).", "events", "=", "self", ".", "stage_config", ".", "get", "(", "'events'", ",", "[", "]", ")", "if", "not", "isinstance", "(", "e...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
ZappaCLI.invoke
Invoke a remote function.
zappa/cli.py
def invoke(self, function_name, raw_python=False, command=None, no_color=False): """ Invoke a remote function. """ # There are three likely scenarios for 'command' here: # command, which is a modular function path # raw_command, which is a string of python to execute...
def invoke(self, function_name, raw_python=False, command=None, no_color=False): """ Invoke a remote function. """ # There are three likely scenarios for 'command' here: # command, which is a modular function path # raw_command, which is a string of python to execute...
[ "Invoke", "a", "remote", "function", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/cli.py#L1260-L1300
[ "def", "invoke", "(", "self", ",", "function_name", ",", "raw_python", "=", "False", ",", "command", "=", "None", ",", "no_color", "=", "False", ")", ":", "# There are three likely scenarios for 'command' here:", "# command, which is a modular function path", "# raw_c...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
ZappaCLI.format_invoke_command
Formats correctly the string output from the invoke() method, replacing line breaks and tabs when necessary.
zappa/cli.py
def format_invoke_command(self, string): """ Formats correctly the string output from the invoke() method, replacing line breaks and tabs when necessary. """ string = string.replace('\\n', '\n') formated_response = '' for line in string.splitlines(): ...
def format_invoke_command(self, string): """ Formats correctly the string output from the invoke() method, replacing line breaks and tabs when necessary. """ string = string.replace('\\n', '\n') formated_response = '' for line in string.splitlines(): ...
[ "Formats", "correctly", "the", "string", "output", "from", "the", "invoke", "()", "method", "replacing", "line", "breaks", "and", "tabs", "when", "necessary", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/cli.py#L1302-L1319
[ "def", "format_invoke_command", "(", "self", ",", "string", ")", ":", "string", "=", "string", ".", "replace", "(", "'\\\\n'", ",", "'\\n'", ")", "formated_response", "=", "''", "for", "line", "in", "string", ".", "splitlines", "(", ")", ":", "if", "line...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
ZappaCLI.colorize_invoke_command
Apply various heuristics to return a colorized version the invoke command string. If these fail, simply return the string in plaintext. Inspired by colorize_log_entry().
zappa/cli.py
def colorize_invoke_command(self, string): """ Apply various heuristics to return a colorized version the invoke command string. If these fail, simply return the string in plaintext. Inspired by colorize_log_entry(). """ final_string = string try: ...
def colorize_invoke_command(self, string): """ Apply various heuristics to return a colorized version the invoke command string. If these fail, simply return the string in plaintext. Inspired by colorize_log_entry(). """ final_string = string try: ...
[ "Apply", "various", "heuristics", "to", "return", "a", "colorized", "version", "the", "invoke", "command", "string", ".", "If", "these", "fail", "simply", "return", "the", "string", "in", "plaintext", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/cli.py#L1321-L1387
[ "def", "colorize_invoke_command", "(", "self", ",", "string", ")", ":", "final_string", "=", "string", "try", ":", "# Line headers", "try", ":", "for", "token", "in", "[", "'START'", ",", "'END'", ",", "'REPORT'", ",", "'[DEBUG]'", "]", ":", "if", "token",...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
ZappaCLI.status
Describe the status of the current deployment.
zappa/cli.py
def status(self, return_json=False): """ Describe the status of the current deployment. """ def tabular_print(title, value): """ Convenience function for priting formatted table items. """ click.echo('%-*s%s' % (32, click.style("\t" + titl...
def status(self, return_json=False): """ Describe the status of the current deployment. """ def tabular_print(title, value): """ Convenience function for priting formatted table items. """ click.echo('%-*s%s' % (32, click.style("\t" + titl...
[ "Describe", "the", "status", "of", "the", "current", "deployment", "." ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/cli.py#L1389-L1519
[ "def", "status", "(", "self", ",", "return_json", "=", "False", ")", ":", "def", "tabular_print", "(", "title", ",", "value", ")", ":", "\"\"\"\n Convenience function for priting formatted table items.\n \"\"\"", "click", ".", "echo", "(", "'%-*s%s...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739
train
ZappaCLI.check_environment
Make sure the environment contains only strings (since putenv needs a string)
zappa/cli.py
def check_environment(self, environment): """ Make sure the environment contains only strings (since putenv needs a string) """ non_strings = [] for (k,v) in environment.items(): if not isinstance(v, basestring): non_strings.append(k) ...
def check_environment(self, environment): """ Make sure the environment contains only strings (since putenv needs a string) """ non_strings = [] for (k,v) in environment.items(): if not isinstance(v, basestring): non_strings.append(k) ...
[ "Make", "sure", "the", "environment", "contains", "only", "strings" ]
Miserlou/Zappa
python
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/cli.py#L1534-L1548
[ "def", "check_environment", "(", "self", ",", "environment", ")", ":", "non_strings", "=", "[", "]", "for", "(", "k", ",", "v", ")", "in", "environment", ".", "items", "(", ")", ":", "if", "not", "isinstance", "(", "v", ",", "basestring", ")", ":", ...
3ccf7490a8d8b8fa74a61ee39bf44234f3567739