<commit_before>from troposphere.constants import NUMBER
from troposphere import FindInMap, GetAtt, Join, Output
from troposphere import Parameter, Ref, Template
from troposphere.awslambda import Function, Code, MEMORY_VALUES
from troposphere.cloudformation import CustomResource
from troposphere.ec2 import Instance
from troposphere.ec2 import SecurityGroup
from troposphere.iam import Role, Policy


t = Template()

t.add_version("2010-09-09")

ExistingVPC = t.add_parameter(Parameter(
    "ExistingVPC",
    Type="AWS::EC2::VPC::Id",
    Description=(
        "The VPC ID that includes the security groups in the "
        "ExistingSecurityGroups parameter."
    ),
))

InstanceType = t.add_parameter(Parameter(
    "InstanceType",
    Default="t2.micro",
    Type="String",
    AllowedValues=["t2.micro", "m1.small"],
))

ExistingSecurityGroups = t.add_parameter(Parameter(
    "ExistingSecurityGroups",
    Type="List<AWS::EC2::SecurityGroup::Id>",
))

MemorySize = t.add_parameter(Parameter(
    'LambdaMemorySize',
    Type=NUMBER,
    Description='Amount of memory to allocate to the Lambda Function',
    Default='128',
    AllowedValues=MEMORY_VALUES
))

Timeout = t.add_parameter(Parameter(
    'LambdaTimeout',
    Type=NUMBER,
    Description='Timeout in seconds for the Lambda function',
    Default='60'
))

t.add_mapping("AWSInstanceType2Arch",
              {'m1.small': {'Arch': 'PV64'},
               't2.micro': {'Arch': 'HVM64'}}
              )

t.add_mapping("AWSRegionArch2AMI",
              {'ap-northeast-1': {'HVM64': 'ami-cbf90ecb',
                                   'PV64': 'ami-27f90e27'},
               'ap-southeast-1': {'HVM64': 'ami-68d8e93a',
                                   'PV64': 'ami-acd9e8fe'},
               'ap-southeast-2': {'HVM64': 'ami-fd9cecc7',
                                   'PV64': 'ami-ff9cecc5'},
               'cn-north-1': {'HVM64': 'ami-f239abcb',
                               'PV64': 'ami-fa39abc3'},
               'eu-central-1': {'HVM64': 'ami-a8221fb5',
                                 'PV64': 'ami-ac221fb1'},
               'eu-west-1': {'HVM64': 'ami-a10897d6',
                              'PV64': 'ami-bf0897c8'},
               'sa-east-1': {'HVM64': 'ami-b52890a8',
                              'PV64': 'ami-bb2890a6'},
               'us-east-1': {'HVM64': 'ami-1ecae776',
                              'PV64': 'ami-1ccae774'},
               'us-west-1': {'HVM64': 'ami-d114f295',
                              'PV64': 'ami-d514f291'},
               'us-west-2': {'HVM64': 'ami-e7527ed7',
                              'PV64': 'ami-ff527ecf'}}
              )

code = [
    "var response = require('cfn-response');",
    "exports.handler = function(event, context) {",
    "   var responseData = {Value: event.ResourceProperties.List};",
    "   responseData.Value.push(event.ResourceProperties.AppendedItem);",
    "   response.send(event, context, response.SUCCESS, responseData);",
    "};",
]

AppendItemToListFunction = t.add_resource(Function(
    "AppendItemToListFunction",
    Code=Code(
        ZipFile=Join("", code)
    ),
    Handler="index.handler",
    Role=GetAtt("LambdaExecutionRole", "Arn"),
    Runtime="nodejs",
    MemorySize=Ref(MemorySize),
    Timeout=Ref(Timeout)<commit_msg>[examples] Fix indentation<commit_after>from troposphere.constants import NUMBER
from troposphere import FindInMap, GetAtt, Join, Output
from troposphere import Parameter, Ref, Template
from troposphere.awslambda import Function, Code, MEMORY_VALUES
from troposphere.cloudformation import CustomResource
from troposphere.ec2 import Instance
from troposphere.ec2 import SecurityGroup
from troposphere.iam import Role, Policy


t = Template()

t.add_version("2010-09-09")

ExistingVPC = t.add_parameter(Parameter(
    "ExistingVPC",
    Type="AWS::EC2::VPC::Id",
    Description=(
        "The VPC ID that includes the security groups in the "
        "ExistingSecurityGroups parameter."
    ),
))

InstanceType = t.add_parameter(Parameter(
    "InstanceType",
    Default="t2.micro",
    Type="String",
    AllowedValues=["t2.micro", "m1.small"],
))

ExistingSecurityGroups = t.add_parameter(Parameter(
    "ExistingSecurityGroups",
    Type="List<AWS::EC2::SecurityGroup::Id>",
))

MemorySize = t.add_parameter(Parameter(
    'LambdaMemorySize',
    Type=NUMBER,
    Description='Amount of memory to allocate to the Lambda Function',
    Default='128',
    AllowedValues=MEMORY_VALUES
))

Timeout = t.add_parameter(Parameter(
    'LambdaTimeout',
    Type=NUMBER,
    Description='Timeout in seconds for the Lambda function',
    Default='60'
))

t.add_mapping("AWSInstanceType2Arch",
              {'m1.small': {'Arch': 'PV64'},
               't2.micro': {'Arch': 'HVM64'}}
              )

t.add_mapping("AWSRegionArch2AMI",
              {'ap-northeast-1': {'HVM64': 'ami-cbf90ecb',
                                  'PV64': 'ami-27f90e27'},
               'ap-southeast-1': {'HVM64': 'ami-68d8e93a',
                                  'PV64': 'ami-acd9e8fe'},
               'ap-southeast-2': {'HVM64': 'ami-fd9cecc7',
                                  'PV64': 'ami-ff9cecc5'},
               'cn-north-1': {'HVM64': 'ami-f239abcb',
                              'PV64': 'ami-fa39abc3'},
               'eu-central-1': {'HVM64': 'ami-a8221fb5',
                                'PV64': 'ami-ac221fb1'},
               'eu-west-1': {'HVM64': 'ami-a10897d6',
                             'PV64': 'ami-bf0897c8'},
               'sa-east-1': {'HVM64': 'ami-b52890a8',
                             'PV64': 'ami-bb2890a6'},
               'us-east-1': {'HVM64': 'ami-1ecae776',
                             'PV64': 'ami-1ccae774'},
               'us-west-1': {'HVM64': 'ami-d114f295',
                             'PV64': 'ami-d514f291'},
               'us-west-2': {'HVM64': 'ami-e7527ed7',
                             'PV64': 'ami-ff527ecf'}}
              )

code = [
    "var response = require('cfn-response');",
    "exports.handler = function(event, context) {",
    "   var responseData = {Value: event.ResourceProperties.List};",
    "   responseData.Value.push(event.ResourceProperties.AppendedItem);",
    "   response.send(event, context, response.SUCCESS, responseData);",
    "};",
]

AppendItemToListFunction = t.add_resource(Function(
    "AppendItemToListFunction",
    Code=Code(
        ZipFile=Join("", code)
    ),
    Handler="index.handler",
    Role=GetAtt("LambdaExecutionRole", "Arn"),
    Runtime="nodejs",
    MemorySize=Ref(MemorySize),
    Timeout=Ref(Timeout)
{'fraction_non_alphanumeric': 0.14956680346557227, 'fraction_numerical': 0.049247606019151846, 'mean_word_length': 2.355430902600714, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 7, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7013574', 'n_tokens_mistral': 2298, 'n_tokens_neox': 2113, 'n_words': 369}