<commit_before>import java.io.{File, PrintWriter}
import java.net.{URL, URLClassLoader}
import java.nio.file.Files
import javax.tools.ToolProvider

import com.google.protobuf.Message.Builder
import scalapb.compiler._
import org.scalacheck.Gen
import scalapb._
import protocbridge.ProtocBridge

import scala.reflect.ClassTag
import _root_.scalapb.ScalaPbCodeGenerator

object SchemaGenerators {
  import Nodes._

  val snakeRegex = "_[0-9][a-z]".r

  val RESERVED = Seq(
    // JAVA_KEYWORDS
    "abstract",
    "continue",
    "for",
    "new",
    "switch",
    "assert",
    "default",
    "goto",
    "package",
    "synchronized",
    "boolean",
    "copy",
    "do",
    "if",
    "private",
    "this",
    "break",
    "double",
    "implements",
    "protected",
    "throw",
    "byte",
    "else",
    "import",
    "public",
    "throws",
    "case",
    "enum",
    "instanceof",
    "return",
    "transient",
    "catch",
    "extends",
    "int",
    "short",
    "try",
    "char",
    "final",
    "interface",
    "static",
    "void",
    "class",
    "finally",
    "long",
    "strictfp",
    "volatile",
    "const",
    "float",
    "native",
    "super",
    "while",
    // From scala.Product
    "productArity",
    "productElementName",
    "productElementNames",
    "productIterator",
    "productPrefix",
    // Java object methods
    "clone",
    "equals",
    "finalize",
    "getclass",
    "hashcode",
    "notify",
    "notifyall",
    "tostring",
    "wait",
    // Other java stuff
    "true",
    "false",
    "null",
    // Package names
    "java",
    "com",
    "google",
    // Scala
    "ne",
    "eq",
    "val",
    "var",
    "def",
    "any",
    "map",
    "nil",
    "seq",
    "type",
    // Words that are not allowed by the Java protocol buffer compiler:
    "tag",
    // internal names
    "of",
    "java_pb_source",
    "scala_pb_source",
    "pb_byte_array_source",
    "get",
    "set",
    "compose"
  )

  // identifier must not have be of the Java keywords.
  val identifier = Gen.resize(4, Gen.identifier).retryUntil(e => !RESERVED.contains(e))

  /** Generates an alphanumerical character */
  def snakeIdChar = Gen.frequency((1, Gen.numChar), (1, Gen.const("_")), (9, Gen.alphaChar))

  //// String Generators ////

  /** Generates a string that starts with a lower-case alpha character,
    * and only contains alphanumerical characters */
  def snakeIdentifier: Gen[String] =
    (for {
      c  <- Gen.alphaChar<commit_msg>Fix potential source of e2e test failures<commit_after>import java.io.{File, PrintWriter}
import java.net.{URL, URLClassLoader}
import java.nio.file.Files
import javax.tools.ToolProvider

import com.google.protobuf.Message.Builder
import scalapb.compiler._
import org.scalacheck.Gen
import scalapb._
import protocbridge.ProtocBridge

import scala.reflect.ClassTag
import _root_.scalapb.ScalaPbCodeGenerator

object SchemaGenerators {
  import Nodes._

  val snakeRegex = "_[0-9][a-z]".r

  val RESERVED = Seq(
    // JAVA_KEYWORDS
    "abstract",
    "continue",
    "for",
    "new",
    "switch",
    "assert",
    "default",
    "goto",
    "package",
    "synchronized",
    "boolean",
    "copy",
    "do",
    "if",
    "private",
    "this",
    "break",
    "double",
    "implements",
    "protected",
    "throw",
    "byte",
    "else",
    "import",
    "public",
    "throws",
    "case",
    "enum",
    "instanceof",
    "return",
    "transient",
    "catch",
    "extends",
    "int",
    "short",
    "try",
    "char",
    "final",
    "interface",
    "static",
    "void",
    "class",
    "finally",
    "long",
    "strictfp",
    "volatile",
    "const",
    "float",
    "native",
    "super",
    "while",
    // From scala.Product
    "productArity",
    "productElementName",
    "productElementNames",
    "productIterator",
    "productPrefix",
    // Java object methods
    "clone",
    "equals",
    "finalize",
    "getclass",
    "hashcode",
    "notify",
    "notifyall",
    "tostring",
    "wait",
    // Other java stuff
    "true",
    "false",
    "null",
    // Package names
    "java",
    "com",
    "google",
    // Scala
    "ne",
    "eq",
    "val",
    "var",
    "def",
    "any",
    "map",
    "nil",
    "seq",
    "type",
    // Words that are not allowed by the Java protocol buffer compiler:
    "tag",
    // internal names
    "of",
    "java_pb_source",
    "scala_pb_source",
    "pb_byte_array_source",
    "get",
    "set",
    "compose"
  )

  // identifier must not have be of the Java keywords.
  val identifier =
    Gen.resize(4, Gen.identifier).retryUntil(e => !RESERVED.contains(e) && !e.startsWith("is"))

  /** Generates an alphanumerical character */
  def snakeIdChar = Gen.frequency((1, Gen.numChar), (1, Gen.const("_")), (9, Gen.alphaChar))

  //// String Generators ////

  /** Generates a string that starts with a lower-case alpha character,
    * and only contains alphanumerical characters */
  def snakeIdentifier: Gen[String] =
    (for {
      c  <- Gen.alphaChar
{'fraction_non_alphanumeric': 0.16074617979757888, 'fraction_numerical': 0.002579876959714229, 'mean_word_length': 2.437926330150068, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '520498', 'n_tokens_mistral': 1758, 'n_tokens_neox': 1730, 'n_words': 400}