<commit_before>package org.jetbrains.kotlinx.jupyter.api.plugin

import org.gradle.api.Project
import org.gradle.kotlin.dsl.dependencies

class KotlinJupyterPluginExtension(
    private val project: Project
) {
    fun addApiDependency(version: String? = null) {
        val apiVersion = version ?: apiVersion()
        project.dependencies {
            "compileOnly"("$GROUP_ID:kotlin-jupyter-api:$apiVersion")
        }
    }

    fun addScannerDependency(version: String? = null) {
        val apiVersion = version ?: apiVersion()
        val mavenCoordinates = "$GROUP_ID:kotlin-jupyter-api-annotations:$apiVersion"
        project.dependencies {
            "implementation"(mavenCoordinates)
            "kapt"(mavenCoordinates)
        }
    }

    internal fun addDependenciesIfNeeded() {
        if (project.getFlag("kotlin.jupyter.add.api", true)) {
            addApiDependency()
        }
        if (project.getFlag("kotlin.jupyter.add.scanner", true)) {
            addScannerDependency()
        }
    }

    companion object {
        private const val GROUP_ID = "org.jetbrains.kotlinx"

        private fun Project.getFlag(propertyName: String, default: Boolean = false): Boolean {
            return findProperty(propertyName)?.let {
                when (it) {
                    "true", true -> true
                    "false", false -> false
                    else -> null
                }
            } ?: default
        }

        fun apiVersion(): String {
            return ApiGradlePlugin::class.java.classLoader.getResource("VERSION")!!.readText()
        }
    }
}
<commit_msg>[PLUGIN] Don't add dependencies for non-existent configurations<commit_after>package org.jetbrains.kotlinx.jupyter.api.plugin

import org.gradle.api.Project
import org.gradle.kotlin.dsl.dependencies

class KotlinJupyterPluginExtension(
    private val project: Project
) {
    fun addApiDependency(version: String? = null) {
        val apiVersion = version ?: apiVersion()
        val compileOnlyConf = project.configurations.findByName("compileOnly") ?: return
        project.dependencies {
            compileOnlyConf("$GROUP_ID:kotlin-jupyter-api:$apiVersion")
        }
    }

    fun addScannerDependency(version: String? = null) {
        val implementationConf = project.configurations.findByName("implementation") ?: return
        val kaptConf = project.configurations.findByName("kapt") ?: return
        val apiVersion = version ?: apiVersion()
        val mavenCoordinates = "$GROUP_ID:kotlin-jupyter-api-annotations:$apiVersion"
        project.dependencies {
            implementationConf(mavenCoordinates)
            kaptConf(mavenCoordinates)
        }
    }

    internal fun addDependenciesIfNeeded() {
        if (project.getFlag("kotlin.jupyter.add.api", true)) {
            addApiDependency()
        }
        if (project.getFlag("kotlin.jupyter.add.scanner", true)) {
            addScannerDependency()
        }
    }

    companion object {
        private const val GROUP_ID = "org.jetbrains.kotlinx"

        private fun Project.getFlag(propertyName: String, default: Boolean = false): Boolean {
            return findProperty(propertyName)?.let {
                when (it) {
                    "true", true -> true
                    "false", false -> false
                    else -> null
                }
            } ?: default
        }

        fun apiVersion(): String {
            return ApiGradlePlugin::class.java.classLoader.getResource("VERSION")!!.readText()
        }
    }
}

{'fraction_non_alphanumeric': 0.10527801298334745, 'fraction_numerical': 0.0, 'mean_word_length': 2.251376146788991, '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': '5837961', 'n_tokens_mistral': 1030, 'n_tokens_neox': 967, 'n_words': 178}