<commit_before>package adapters

import play.api.Play
import play.api.libs.ws.WS
import java.math.BigInteger
import javax.crypto.Mac
import javax.crypto.spec.SecretKeySpec
import java.util.prefs.Base64

object Pusher {

  import play.api.Play.current
  import SecurityString._

  val appId = Play.configuration.getString("pusher.appId").getOrElse(throw new RuntimeException("Missing Pusher app id"))
  val key = Play.configuration.getString("pusher.key").getOrElse(throw new RuntimeException("Missing Pusher key"))
  val secret = Play.configuration.getString("pusher.secret").getOrElse(throw new RuntimeException("Missing Pusher secret key"))

  def sendNsiResponse(message: String) = {
    send("response_channel", "response", message)
  }

  def send(channel: String, event: String, message: String) = {
    val domain = "api.pusherapp.com"
    val requestPath = "/apps/%s/channels/%s/events".format(appId, channel)

    // socket_id: optional
    val params = List(
        "auth_key" -> key,
        "auth_timestamp" -> (System.currentTimeMillis / 1000).toString,
        "auth_version" -> "1.0",<commit_msg>make configuration vals lazy, complains when pusher used and conf not specified<commit_after>package adapters

import play.api.Play
import play.api.libs.ws.WS
import java.math.BigInteger
import javax.crypto.Mac
import javax.crypto.spec.SecretKeySpec
import java.util.prefs.Base64

object Pusher {

  import play.api.Play.current
  import SecurityString._

  lazy val appId = Play.configuration.getString("pusher.appId").getOrElse(throw new RuntimeException("Missing Pusher app id"))
  lazy val key = Play.configuration.getString("pusher.key").getOrElse(throw new RuntimeException("Missing Pusher key"))
  lazy val secret = Play.configuration.getString("pusher.secret").getOrElse(throw new RuntimeException("Missing Pusher secret key"))

  def sendNsiResponse(message: String) = {
    send("response_channel", "response", message)
  }

  def send(channel: String, event: String, message: String) = {
    val domain = "api.pusherapp.com"
    val requestPath = "/apps/%s/channels/%s/events".format(appId, channel)

    // socket_id: optional
    val params = List(
        "auth_key" -> key,
        "auth_timestamp" -> (System.currentTimeMillis / 1000).toString,
        "auth_version" -> "1.0",
{'fraction_non_alphanumeric': 0.1210412147505423, 'fraction_numerical': 0.006941431670281995, 'mean_word_length': 4.375291375291376, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '7454160', 'n_tokens_mistral': 703, 'n_tokens_neox': 694, 'n_words': 163}