<commit_before>package org.http4s
package blaze

import java.net.InetSocketAddress
import org.http4s.blaze.channel.ServerChannel
import org.http4s.server.{ServerBuilder, Server}
import scalaz.\/
import scalaz.concurrent.Task
import org.http4s.middleware.URITranslation
import org.http4s.blaze.channel.nio1.SocketServerChannelFactory
import java.nio.ByteBuffer
import org.http4s.blaze.pipeline.LeafBuilder

class BlazeServer private (serverChannel: ServerChannel) extends Server {
  override def start: Task[this.type] = Task.async { cb =>
    cb(\/.fromTryCatch(serverChannel.run()).map(_ => this))
  }

  override def shutdown: Task[this.type] = Task.async { cb =>
    cb(\/.fromTryCatch(serverChannel.close()).map(_ => this))
  }
}

object BlazeServer {
  class Builder extends ServerBuilder {
    type To = BlazeServer

    private var aggregateService = HttpService.empty
    private var port = 8080

    override def mountService(service: HttpService, prefix: String): this.type = {
      aggregateService = URITranslation.translateRoot(prefix)(service) orElse service
      this
    }

    override def withPort(port: Int): this.type = {
      this.port = port
      this
    }

    override def build: To = {<commit_msg>Fix bug in BlazeServer service aggregation, h/t @bryce-anderson. #13<commit_after>package org.http4s
package blaze

import java.net.InetSocketAddress
import org.http4s.blaze.channel.ServerChannel
import org.http4s.server.{ServerBuilder, Server}
import scalaz.\/
import scalaz.concurrent.Task
import org.http4s.middleware.URITranslation
import org.http4s.blaze.channel.nio1.SocketServerChannelFactory
import java.nio.ByteBuffer
import org.http4s.blaze.pipeline.LeafBuilder

class BlazeServer private (serverChannel: ServerChannel) extends Server {
  override def start: Task[this.type] = Task.async { cb =>
    cb(\/.fromTryCatch(serverChannel.run()).map(_ => this))
  }

  override def shutdown: Task[this.type] = Task.async { cb =>
    cb(\/.fromTryCatch(serverChannel.close()).map(_ => this))
  }
}

object BlazeServer {
  class Builder extends ServerBuilder {
    type To = BlazeServer

    private var aggregateService = HttpService.empty
    private var port = 8080

    override def mountService(service: HttpService, prefix: String): this.type = {
      aggregateService = URITranslation.translateRoot(prefix)(service) orElse aggregateService
      this
    }

    override def withPort(port: Int): this.type = {
      this.port = port
      this
    }

    override def build: To = {
{'fraction_non_alphanumeric': 0.10166799046862589, 'fraction_numerical': 0.009531374106433678, 'mean_word_length': 4.0582329317269075, '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': '7483586', 'n_tokens_mistral': 777, 'n_tokens_neox': 752, 'n_words': 182}