<commit_before>package ch.epfl.scala.index.model
package release

case class ReleaseSelection(
    artifact: Option[String],
    version: Option[SemanticVersion],
    target: Option[ScalaTarget]
)

object ReleaseSelection {

  /**
    * @param artifactRaw either an artifact (ex: cats-core) or an artifactId (ex: cats-core_2.11)
    */
  def apply(artifactRaw: Option[String] = None,
            version: Option[SemanticVersion] = None) = {
    val (artifact, target) = artifactRaw
      .flatMap(raw => Artifact(raw))
      .map { case (a, b) => (Some(a), Some(b)) }
      .getOrElse((artifactRaw, None))

    new ReleaseSelection(artifact, version, target)
  }
}

/**
  * populate dropdowns to select artifact, version and target
  */
case class ReleaseOptions(
    artifacts: List[String],
    versions: List[SemanticVersion],
    targets: List[ScalaTarget],
    release: Release
)

object DefaultRelease {
  def apply(project: Project,
            selection: ReleaseSelection,
            releases: List[Release]): Option[ReleaseOptions] = {

    val selectedReleases = releases.filter(
        release =>
          selection.artifact
            .map(_ == release.reference.artifact)
            .getOrElse(true) &&
            selection.target
              .map(_ == release.reference.target)
              .getOrElse(true) &&
            selection.version
              .map(_ == release.reference.version)
              .getOrElse(true))<commit_msg>formatting<commit_after>package ch.epfl.scala.index.model
package release

case class ReleaseSelection(
    artifact: Option[String],
    version: Option[SemanticVersion],
    target: Option[ScalaTarget]
)

object ReleaseSelection {

  /**
    * @param artifactRaw either an artifact (ex: cats-core) or an artifactId (ex: cats-core_2.11)
    */
  def apply(artifactRaw: Option[String] = None,
            version: Option[SemanticVersion] = None) = {
    val (artifact, target) = artifactRaw
      .flatMap(raw => Artifact(raw))
      .map { case (a, b) => (Some(a), Some(b)) }
      .getOrElse((artifactRaw, None))

    new ReleaseSelection(artifact, version, target)
  }
}

/**
  * populate dropdowns to select artifact, version and target
  */
case class ReleaseOptions(
    artifacts: List[String],
    versions: List[SemanticVersion],
    targets: List[ScalaTarget],
    release: Release
)

object DefaultRelease {
  def apply(project: Project,
            selection: ReleaseSelection,
            releases: List[Release]): Option[ReleaseOptions] = {

    val selectedReleases = releases.filter(release =>
      selection.artifact.map(_ == release.reference.artifact).getOrElse(true) &&
      selection.target.map(_ == release.reference.target).getOrElse(true) &&
      selection.version.map(_ == release.reference.version).getOrElse(true)
    )
{'fraction_non_alphanumeric': 0.11970074812967581, 'fraction_numerical': 0.0021375133594584966, 'mean_word_length': 3.051948051948052, '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': '4672507', 'n_tokens_mistral': 838, 'n_tokens_neox': 789, 'n_words': 186}