<commit_before>package remotely

import scala.reflect.runtime.universe.TypeTag
import scodec.{Codec,Decoder,Encoder}

case class Protocol(codecs: Codecs, signatures: Signatures) {

  def codec[A:TypeTag:Codec]: Protocol =
    this.copy(codecs = codecs.codec[A])

  def specify[A:TypeTag](name: String): Protocol =
    this.copy(signatures = signatures.specify[A](name))

  def specify1[A:TypeTag,B:TypeTag](name: String): Protocol =
    specify[A => B](name)

  def specify2[A:TypeTag,B:TypeTag,C:TypeTag](name: String): Protocol =
    specify[(A,B) => C](name)

  def specify3[A:TypeTag,B:TypeTag,C:TypeTag,D:TypeTag](name: String): Protocol =
    specify[(A,B,C) => D](name)

  def specify4[A:TypeTag,B:TypeTag,C:TypeTag,D:TypeTag,E:TypeTag](name: String): Protocol =
    specify[(A,B,C,D) => E](name)

  def generateClient(moduleName: String, pkg: String = "default"): String =
    signatures.generateClient(moduleName, pkg)

  def generateServer(traitName: String, pkg: String = "default"): String = s"""
  |package $pkg
  |
  |import remotely.{Codecs,Environment,Response,Values}
  |import remotely.codecs._
  |
  |trait $traitName {
  |  // This interface is generated from a `Protocol`. Do not modify.
  |  def environment: Environment = Environment(
  |${Signatures.indent("    ")(codecs.pretty)},
  |    populateDeclarations(Values.empty)
  |  )
  |
  |${Signatures.indent("  ")(signatures.generateServerTraitBody)}
  |}
  """.stripMargin

  def pretty: String =
    "Protocol(\n" +
    Signatures.indent("  ")(codecs.pretty) + ",\n" +
    Signatures.indent("  ")(signatures.pretty) + "\n)"

  override def toString = pretty
}

object Protocol {

  val empty = Protocol(Codecs.empty, Signatures.empty)
}
<commit_msg>Abstract class instead of trait<commit_after>package remotely

import scala.reflect.runtime.universe.TypeTag
import scodec.{Codec,Decoder,Encoder}

case class Protocol(codecs: Codecs, signatures: Signatures) {

  def codec[A:TypeTag:Codec]: Protocol =
    this.copy(codecs = codecs.codec[A])

  def specify[A:TypeTag](name: String): Protocol =
    this.copy(signatures = signatures.specify[A](name))

  def specify1[A:TypeTag,B:TypeTag](name: String): Protocol =
    specify[A => B](name)

  def specify2[A:TypeTag,B:TypeTag,C:TypeTag](name: String): Protocol =
    specify[(A,B) => C](name)

  def specify3[A:TypeTag,B:TypeTag,C:TypeTag,D:TypeTag](name: String): Protocol =
    specify[(A,B,C) => D](name)

  def specify4[A:TypeTag,B:TypeTag,C:TypeTag,D:TypeTag,E:TypeTag](name: String): Protocol =
    specify[(A,B,C,D) => E](name)

  def generateClient(moduleName: String, pkg: String = "default"): String =
    signatures.generateClient(moduleName, pkg)

  def generateServer(traitName: String, pkg: String = "default"): String = s"""
  |package $pkg
  |
  |import remotely.{Codecs,Environment,Response,Values}
  |import remotely.codecs._
  |
  |abstract class $traitName {
  |  // This interface is generated from a `Protocol`. Do not modify.
  |  def environment: Environment = Environment(
  |${Signatures.indent("    ")(codecs.pretty)},
  |    populateDeclarations(Values.empty)
  |  )
  |
  |${Signatures.indent("  ")(signatures.generateServerTraitBody)}
  |}
  """.stripMargin

  def pretty: String =
    "Protocol(\n" +
    Signatures.indent("  ")(codecs.pretty) + ",\n" +
    Signatures.indent("  ")(signatures.pretty) + "\n)"

  override def toString = pretty
}

object Protocol {

  val empty = Protocol(Codecs.empty, Signatures.empty)
}

{'fraction_non_alphanumeric': 0.15703192407247626, 'fraction_numerical': 0.0023008340523439745, 'mean_word_length': 4.720394736842105, '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': '4208786', 'n_tokens_mistral': 1214, 'n_tokens_neox': 1190, 'n_words': 229}