[ml imports ranking] Anonymize number of files in py project

FUS-5036 Change group "pycharm.quickfix.imports"


Merge-request: IJ-MR-146185
Merged-by: Gleb Marin <Gleb.Marin@jetbrains.com>

GitOrigin-RevId: 278f9c703398a18bc47d2c724d44f12e9ec3610e
This commit is contained in:
Gleb Marin
2024-10-07 14:14:08 +00:00
committed by intellij-monorepo-bot
parent 82b46a43bb
commit 09c2b90e35
2 changed files with 3 additions and 3 deletions

View File

@@ -34,7 +34,7 @@ enum class FileExtensionType {
class BaseProjectFeatures : FeatureProvider(MLUnitImportCandidatesList) {
object Features {
val NUM_PYTHON_FILES_IN_PROJECT = FeatureDeclaration.int("num_python_files_in_project") {
"The amount of files in the project"
"The estimated amount of files in the project (by a power of 2)"
}.nullable()
val PSI_PARENT_OF_ORIG = (1..5).map { i -> FeatureDeclaration.aClass("psi_parent_of_orig_$i") { "PSI parent of original element #$i" }.nullable() }
val FILE_EXTENSION_TYPE = FeatureDeclaration.enum<FileExtensionType>("file_extension_type") { "extension of the original python file" }.nullable()
@@ -52,7 +52,7 @@ class BaseProjectFeatures : FeatureProvider(MLUnitImportCandidatesList) {
val scopeSize = readAction {
FileTypeIndex.getFiles(PythonFileType.INSTANCE, GlobalSearchScope.projectScope(project)).size
}
add(Features.NUM_PYTHON_FILES_IN_PROJECT with scopeSize)
add(Features.NUM_PYTHON_FILES_IN_PROJECT with Integer.highestOneBit(scopeSize))
val editor = readAction { FileEditorManager.getInstance(project).selectedEditor as? TextEditor } ?: return@buildList
val psiFile = readAction { PsiManager.getInstance(project).findFile(editor.file) } ?: return@buildList

View File

@@ -24,7 +24,7 @@ import com.jetbrains.python.PythonPluginDisposable
@Service
private class EventLogGroupHolder {
val group by lazy {
EventLogGroup("pycharm.quickfix.imports", 2, ML_RECORDER_ID).also {
EventLogGroup("pycharm.quickfix.imports", 3, ML_RECORDER_ID).also {
it.registerMLTaskLogging(service<MLTaskPyCharmImportStatementsRanking>().task,
parentDisposable = service<PythonPluginDisposable>())
}