<commit_before>package okapies.finagle

import com.twitter.util.{Closable, Future, Promise}
import com.twitter.finagle._
import com.twitter.finagle.client.{StackClient, Transporter, StdStackClient}
import com.twitter.finagle.server.{StackServer, StdStackServer, Listener}
import com.twitter.finagle.dispatch.{PipeliningDispatcher, GenSerialServerDispatcher}
import com.twitter.finagle.netty3.{Netty3Transporter, Netty3Listener}
import com.twitter.finagle.pool.SingletonPool
import com.twitter.finagle.transport.Transport
import com.twitter.finagle.stats.StatsReceiver
import java.net.SocketAddress

import okapies.finagle.kafka.protocol._

trait KafkaRichClient { self: Client[Request, Response] =>

  def newRichClient(dest: String): kafka.Client = kafka.Client(newService(dest))

  def newRichClient(dest: Name, label: String): kafka.Client = kafka.Client(newService(dest, label))

}

/*
object KafkaTransporter extends Netty3Transporter[Request, Response](
  name = "kafka",
  pipelineFactory = KafkaBatchClientPipelineFactory
)

object KafkaClient extends DefaultClient[Request, Response](
  name = "kafka",
  endpointer =
    Bridge[Request, Response, Request, Response](KafkaTransporter, new PipeliningDispatcher(_)),
  pool = (sr: StatsReceiver) => new SingletonPool(_, sr)
) with KafkaRichClient
*/

object Kafka
extends Client[Request, Response]
with KafkaRichClient
with Server[Request, Response] {

  case class Client(
    stack: Stack[ServiceFactory[Request, Response]] = StackClient.newStack,
    params: Stack.Params = StackClient.defaultParams
  ) extends StdStackClient[Request, Response, Client] {
    protected type In = Request
    protected type Out = Response

    protected def copy1(
      stack: Stack[ServiceFactory[Request, Response]],
      params: Stack.Params): Client =
      copy(stack, params)

    protected def newTransporter(): Transporter[Request, Response] =
      Netty3Transporter(KafkaBatchClientPipelineFactory, params)

    protected def newDispatcher(
      transport: Transport[Request, Response]): Service[Request, Response] =
      new PipeliningDispatcher(transport)
  }


  val client = Client()

  def newClient(dest: Name, label: String): ServiceFactory[Request, Response] =
    client.newClient(dest, label)<commit_msg>Removed commented code<commit_after>package okapies.finagle

import com.twitter.util.{Closable, Future, Promise}
import com.twitter.finagle._
import com.twitter.finagle.client.{StackClient, Transporter, StdStackClient}
import com.twitter.finagle.server.{StackServer, StdStackServer, Listener}
import com.twitter.finagle.dispatch.{PipeliningDispatcher, GenSerialServerDispatcher}
import com.twitter.finagle.netty3.{Netty3Transporter, Netty3Listener}
import com.twitter.finagle.pool.SingletonPool
import com.twitter.finagle.transport.Transport
import com.twitter.finagle.stats.StatsReceiver
import java.net.SocketAddress

import okapies.finagle.kafka.protocol._

trait KafkaRichClient { self: Client[Request, Response] =>

  def newRichClient(dest: String): kafka.Client = kafka.Client(newService(dest))

  def newRichClient(dest: Name, label: String): kafka.Client = kafka.Client(newService(dest, label))

}

object Kafka
extends Client[Request, Response]
with KafkaRichClient
with Server[Request, Response] {

  case class Client(
    stack: Stack[ServiceFactory[Request, Response]] = StackClient.newStack,
    params: Stack.Params = StackClient.defaultParams
  ) extends StdStackClient[Request, Response, Client] {
    protected type In = Request
    protected type Out = Response

    protected def copy1(
      stack: Stack[ServiceFactory[Request, Response]],
      params: Stack.Params): Client =
      copy(stack, params)

    protected def newTransporter(): Transporter[Request, Response] =
      Netty3Transporter(KafkaBatchClientPipelineFactory, params)

    protected def newDispatcher(
      transport: Transport[Request, Response]): Service[Request, Response] =
      new PipeliningDispatcher(transport)
  }


  val client = Client()

  def newClient(dest: Name, label: String): ServiceFactory[Request, Response] =
    client.newClient(dest, label)
{'fraction_non_alphanumeric': 0.09830508474576272, 'fraction_numerical': 0.0026634382566585956, 'mean_word_length': 5.5363924050632916, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, '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': '401898', 'n_tokens_mistral': 1202, 'n_tokens_neox': 1167, 'n_words': 276}