<commit_before>package is24

import com.amazonaws.regions.RegionUtils
import com.amazonaws.services.cloudformation.AmazonCloudFormationClient
import com.amazonaws.services.cloudformation.model.{UpdateStackResult, Parameter, UpdateStackRequest}
import com.amazonaws.services.lambda.runtime.{LambdaLogger, Context}
import com.amazonaws.services.lambda.runtime.events.SNSEvent
import play.api.libs.json._

import scala.collection.JavaConversions._


case class StackUpdateEvent(stackName: String, region: String, params: Map[String, String])

object StackUpdateEvent {
  implicit val reads = Json.format[StackUpdateEvent]
}


class StackUpdateHandler {

  def handler(event: SNSEvent, context: Context): Unit  = {
    val logger = context.getLogger

    event.getRecords.toList
      .map(_.getSNS.getMessage)
      .map(m => Json.parse(m).validate[StackUpdateEvent])
      .foreach {
        case JsSuccess(StackUpdateEvent(name, region, params), _) =>
          updateStack(name, region, params)
          logger.log(s"update stack $name with params: $params successfully triggered")
        case t =>
          logger.log("error: " + t)
      }
  }

  private def updateStack(stackName: String, region: String, params: Map[String, String]) = {
    val cloudFormation = new AmazonCloudFormationClient().withRegion[AmazonCloudFormationClient](RegionUtils.getRegion(region))
    cloudFormation.updateStack(new UpdateStackRequest()
      .withStackName(stackName)
      .with
      .withUsePreviousTemplate(true)
      .withCapabilities("CAPABILITY_IAM")
      .withParameters(params.map{case (key, value) => new Parameter().withParameterKey(key).withParameterValue(value)}))
  }

}

<commit_msg>fix accidental commit<commit_after>package is24

import com.amazonaws.regions.RegionUtils
import com.amazonaws.services.cloudformation.AmazonCloudFormationClient
import com.amazonaws.services.cloudformation.model.{UpdateStackResult, Parameter, UpdateStackRequest}
import com.amazonaws.services.lambda.runtime.{LambdaLogger, Context}
import com.amazonaws.services.lambda.runtime.events.SNSEvent
import play.api.libs.json._

import scala.collection.JavaConversions._


case class StackUpdateEvent(stackName: String, region: String, params: Map[String, String])

object StackUpdateEvent {
  implicit val reads = Json.format[StackUpdateEvent]
}


class StackUpdateHandler {

  def handler(event: SNSEvent, context: Context): Unit  = {
    val logger = context.getLogger

    event.getRecords.toList
      .map(_.getSNS.getMessage)
      .map(m => Json.parse(m).validate[StackUpdateEvent])
      .foreach {
        case JsSuccess(StackUpdateEvent(name, region, params), _) =>
          updateStack(name, region, params)
          logger.log(s"update stack $name with params: $params successfully triggered")
        case t =>
          logger.log("error: " + t)
      }
  }

  private def updateStack(stackName: String, region: String, params: Map[String, String]) = {
    val cloudFormation = new AmazonCloudFormationClient().withRegion[AmazonCloudFormationClient](RegionUtils.getRegion(region))
    cloudFormation.updateStack(new UpdateStackRequest()
      .withStackName(stackName)
      .withUsePreviousTemplate(true)
      .withCapabilities("CAPABILITY_IAM")
      .withParameters(params.map{case (key, value) => new Parameter().withParameterKey(key).withParameterValue(value)}))
  }

}


{'fraction_non_alphanumeric': 0.10621301775147929, 'fraction_numerical': 0.001183431952662722, 'mean_word_length': 4.533551554828151, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2641109', 'n_tokens_mistral': 960, 'n_tokens_neox': 949, 'n_words': 187}