<commit_before>package ch.epfl.scala.index
package data
package project

import cleanup._
import model._
import model.misc._
import bintray._
import maven.MavenModel
import github._
import release._

import me.tongfei.progressbar._
import org.joda.time.DateTime

object ProjectConvert extends BintrayProtocol {

  val nonStandardLibs = NonStandardLib.load()
  
  def extractArtifactNameAndTarget(pom: MavenModel): Option[(String, ScalaTarget, Boolean)] = {
    nonStandardLibs.find(lib => 
      lib.groupId == pom.groupId && 
      lib.artifactId == pom.artifactId).map(_.lookup) match {

      case Some(ScalaTargetFromPom) =>
        pom.dependencies
          .find(dep =>
            dep.groupId == "org.scala-lang" &&
            dep.artifactId == "scala-library"
          )
          .flatMap(dep => SemanticVersion(dep.version))
          .map(version => (pom.artifactId, ScalaTarget(version.copy(patch = None)), true))

      case Some(ScalaTargetFromVersion) => 
        SemanticVersion(pom.version)
          .map(version => (pom.artifactId, ScalaTarget(version), true))

      case None =><commit_msg>document non std lib heuristics<commit_after>package ch.epfl.scala.index
package data
package project

import cleanup._
import model._
import model.misc._
import bintray._
import maven.MavenModel
import github._
import release._

import me.tongfei.progressbar._
import org.joda.time.DateTime

object ProjectConvert extends BintrayProtocol {

  val nonStandardLibs = NonStandardLib.load()
  
  /** artifactId is often use to express binary compatibility with a scala version (ScalaTarget)
    * if the developer follow this convention we extract the relevant parts and we mark
    * the library as standard. Otherwise we either have a library like gatling or the scala library itself
    */
  def extractArtifactNameAndTarget(pom: MavenModel): Option[(String, ScalaTarget, Boolean)] = {
    nonStandardLibs.find(lib => 
      lib.groupId == pom.groupId && 
      lib.artifactId == pom.artifactId).map(_.lookup) match {

      case Some(ScalaTargetFromPom) =>
        pom.dependencies
          .find(dep =>
            dep.groupId == "org.scala-lang" &&
            dep.artifactId == "scala-library"
          )
          .flatMap(dep => SemanticVersion(dep.version))
          .map(version => (pom.artifactId, ScalaTarget(version.copy(patch = None)), true))

      case Some(ScalaTargetFromVersion) => 
        SemanticVersion(pom.version)
          .map(version => (pom.artifactId, ScalaTarget(version), true))

      case None =>
{'fraction_non_alphanumeric': 0.1037328094302554, 'fraction_numerical': 0.0, 'mean_word_length': 3.201320132013201, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, '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': '2563288', 'n_tokens_mistral': 770, 'n_tokens_neox': 718, 'n_words': 182}