<commit_before>package com.sclasen.sprack

import akka.actor.{ActorSystem, Props}
import akka.io.IO
import spray.can.Http
import org.rogach.scallop._
import concurrent.duration._
import akka.util.Timeout
import akka.pattern._
import scala.util.{Failure, Success}
import com.typesafe.config.ConfigFactory
import java.io.File

object Main extends App {

  val conf = new Conf(args)
  implicit val system = createActorSystem(conf)
  implicit val bootTimeout = Timeout(conf.timeout())
  // the handler actor replies to incoming HttpRequests
  println("creating RackHandler, this can take a while on big apps")
  val handler = system.actorOf(Props(new SprackService(conf.rackfile(), conf.port())), name = "handler")
  import concurrent.ExecutionContext.Implicits.global
  (handler ? Ready).onComplete {
    case Success(Ready) =>
      println("RackHandler Ready binding")
      IO(Http) ! Http.Bind(handler, interface = conf.host(), port = conf.port())
      IO(Http) ! Http.Bind(handler, interface = conf.host(), port = conf.port() + 1 )
    case Failure(e) =>
      println("Failed to init RackHandler, exiting")
      e.printStackTrace()
      System.exit(11)
  }


  def createActorSystem(conf: Conf): ActorSystem = {
    conf.akkafile.get.map {
      file =>
        ActorSystem("sprack-system", ConfigFactory.parseFile(new File(file)))
    }.getOrElse(ActorSystem("sprack-system"))
  }

}

class Conf(args: Seq[String]) extends ScallopConf(args) {<commit_msg>remove second bind<commit_after>package com.sclasen.sprack

import akka.actor.{ActorSystem, Props}
import akka.io.IO
import spray.can.Http
import org.rogach.scallop._
import concurrent.duration._
import akka.util.Timeout
import akka.pattern._
import scala.util.{Failure, Success}
import com.typesafe.config.ConfigFactory
import java.io.File

object Main extends App {

  val conf = new Conf(args)
  implicit val system = createActorSystem(conf)
  implicit val bootTimeout = Timeout(conf.timeout())
  // the handler actor replies to incoming HttpRequests
  println("creating RackHandler, this can take a while on big apps")
  val handler = system.actorOf(Props(new SprackService(conf.rackfile(), conf.port())), name = "handler")
  import concurrent.ExecutionContext.Implicits.global
  (handler ? Ready).onComplete {
    case Success(Ready) =>
      println("RackHandler Ready binding")
      IO(Http) ! Http.Bind(handler, interface = conf.host(), port = conf.port())
    case Failure(e) =>
      println("Failed to init RackHandler, exiting")
      e.printStackTrace()
      System.exit(11)
  }


  def createActorSystem(conf: Conf): ActorSystem = {
    conf.akkafile.get.map {
      file =>
        ActorSystem("sprack-system", ConfigFactory.parseFile(new File(file)))
    }.getOrElse(ActorSystem("sprack-system"))
  }

}

class Conf(args: Seq[String]) extends ScallopConf(args) {
{'fraction_non_alphanumeric': 0.12002815909890883, 'fraction_numerical': 0.0017599436818021823, 'mean_word_length': 4.243542435424354, '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': '4617120', 'n_tokens_mistral': 896, 'n_tokens_neox': 862, 'n_words': 215}