From bb6d87f1c2b4c1b7e9e8fac0c54099bd07458f7f Mon Sep 17 00:00:00 2001 From: "Ilya.Kazakevich" Date: Wed, 25 Mar 2026 21:32:15 +0100 Subject: [PATCH] cleanup [pycharm]: close target-specific symbols GitOrigin-RevId: cb0788461d5d71d68cf3abc0e62cc9ae0e16293b --- python/src/com/jetbrains/python/run/PathMappingsUtil.kt | 5 ++++- .../python/run/TargetConfigurationWithLocalFsAccessEx.kt | 7 +++++-- python/src/com/jetbrains/python/run/TargetedPythonPaths.kt | 6 ++++-- .../target/HelpersAwareLocalTargetEnvironmentRequest.kt | 4 +++- .../com/jetbrains/python/run/target/PySdkTargetPaths.kt | 7 +++++-- 5 files changed, 21 insertions(+), 8 deletions(-) diff --git a/python/src/com/jetbrains/python/run/PathMappingsUtil.kt b/python/src/com/jetbrains/python/run/PathMappingsUtil.kt index d48d09fb1a73..d18e2d4a2c80 100644 --- a/python/src/com/jetbrains/python/run/PathMappingsUtil.kt +++ b/python/src/com/jetbrains/python/run/PathMappingsUtil.kt @@ -10,11 +10,14 @@ import com.intellij.remote.ProcessControlWithMappings import com.intellij.util.PathMapper import com.intellij.util.PathMappingSettings import com.jetbrains.python.run.target.targetEnvironment +import org.jetbrains.annotations.ApiStatus +@ApiStatus.Internal fun ProcessHandler.guessPathMapper(): PathMapper? = (this as? ProcessControlWithMappings)?.mappingSettings ?: targetEnvironment?.collectAllPathMappings() -fun TargetEnvironment.collectAllPathMappings(): PathMappingSettings { +@ApiStatus.Internal +internal fun TargetEnvironment.collectAllPathMappings(): PathMappingSettings { val pathMappings = mutableListOf() if (this is ExternallySynchronized) { pathMappings += synchronizedVolumes.map(TargetEnvironment.SynchronizedVolume::toPathMapping) diff --git a/python/src/com/jetbrains/python/run/TargetConfigurationWithLocalFsAccessEx.kt b/python/src/com/jetbrains/python/run/TargetConfigurationWithLocalFsAccessEx.kt index d0bd8458387b..3e842aaedae6 100644 --- a/python/src/com/jetbrains/python/run/TargetConfigurationWithLocalFsAccessEx.kt +++ b/python/src/com/jetbrains/python/run/TargetConfigurationWithLocalFsAccessEx.kt @@ -6,13 +6,15 @@ import com.intellij.execution.target.TargetEnvironmentConfiguration import com.intellij.execution.target.TargetEnvironmentType import com.intellij.execution.target.getTargetType import com.intellij.openapi.diagnostic.Logger +import org.jetbrains.annotations.ApiStatus /** * When module sits on this target, should allow user create sdk on [confType]? * ``\\wsl$`` projects allow WSL and Docker */ -fun TargetConfigurationWithLocalFsAccess.allowCreationTargetOfThisType(confType: TargetEnvironmentType<*>): Boolean { +@ApiStatus.Internal +internal fun TargetConfigurationWithLocalFsAccess.allowCreationTargetOfThisType(confType: TargetEnvironmentType<*>): Boolean { val javaClass = asTargetConfig.getTargetType().javaClass return javaClass == confType.javaClass || javaClass in confType.canProbablyRunCodeForeignTypes } @@ -22,7 +24,8 @@ fun TargetConfigurationWithLocalFsAccess.allowCreationTargetOfThisType(confType: * When module sits on this target, should allow user to choose sdk with [config]? * ``\\wsl$`` projects allow Docker AND only WSL with right distro */ -fun TargetConfigurationWithLocalFsAccess.codeCouldProbablyBeRunWithConfig(config: TargetEnvironmentConfiguration?): Boolean { +@ApiStatus.Internal +internal fun TargetConfigurationWithLocalFsAccess.codeCouldProbablyBeRunWithConfig(config: TargetEnvironmentConfiguration?): Boolean { if (config == null) return false // For now no local target could run remote if (asTargetConfig == config) return true // Same config (like same wsl distro) return asTargetConfig.getTargetType().javaClass in config.getTargetType().canProbablyRunCodeForeignTypes diff --git a/python/src/com/jetbrains/python/run/TargetedPythonPaths.kt b/python/src/com/jetbrains/python/run/TargetedPythonPaths.kt index 2d9870f75adc..c94a58d386b1 100644 --- a/python/src/com/jetbrains/python/run/TargetedPythonPaths.kt +++ b/python/src/com/jetbrains/python/run/TargetedPythonPaths.kt @@ -39,7 +39,8 @@ import java.nio.file.Path * Append PYTHONPATH from system environment for local target if it is necessary * checkPythonPathInEnvs flag used for optionally checking envs already contains PYTHONPATH */ -fun initPythonPath(envs: MutableMap>, +@ApiStatus.Internal +internal fun initPythonPath(envs: MutableMap>, passParentEnvs: Boolean, pythonPathList: MutableCollection>, targetEnvironmentRequest: TargetEnvironmentRequest, @@ -114,7 +115,8 @@ private fun collectPythonPath(context: Context, /** * List of [target->targetPath] functions. TargetPaths are to be added to ``PYTHONPATH`` because user did so */ -fun getAddedPaths(sdkAdditionalData: SdkAdditionalData): List> { +@ApiStatus.Internal +internal fun getAddedPaths(sdkAdditionalData: SdkAdditionalData): List> { val pathList: MutableList> = ArrayList() if (sdkAdditionalData is PythonSdkAdditionalData) { val addedPaths = if (sdkAdditionalData is RemoteSdkProperties) { diff --git a/python/src/com/jetbrains/python/run/target/HelpersAwareLocalTargetEnvironmentRequest.kt b/python/src/com/jetbrains/python/run/target/HelpersAwareLocalTargetEnvironmentRequest.kt index 0d07b7a8309a..8fb4de945c30 100644 --- a/python/src/com/jetbrains/python/run/target/HelpersAwareLocalTargetEnvironmentRequest.kt +++ b/python/src/com/jetbrains/python/run/target/HelpersAwareLocalTargetEnvironmentRequest.kt @@ -4,10 +4,12 @@ package com.jetbrains.python.run.target import com.intellij.execution.target.TargetEnvironmentRequest import com.intellij.execution.target.local.LocalTargetEnvironmentRequest import com.intellij.execution.target.value.constantExplicit +import org.jetbrains.annotations.ApiStatus import java.nio.file.Path import kotlin.io.path.absolutePathString -class HelpersAwareLocalTargetEnvironmentRequest : HelpersAwareTargetEnvironmentRequest { +@ApiStatus.Internal +internal class HelpersAwareLocalTargetEnvironmentRequest : HelpersAwareTargetEnvironmentRequest { override val targetEnvironmentRequest: TargetEnvironmentRequest = LocalTargetEnvironmentRequest() override fun preparePyCharmHelpers(): PythonHelpersMappings = diff --git a/python/src/com/jetbrains/python/run/target/PySdkTargetPaths.kt b/python/src/com/jetbrains/python/run/target/PySdkTargetPaths.kt index a005bf18a7a2..4c9b8262b6dd 100644 --- a/python/src/com/jetbrains/python/run/target/PySdkTargetPaths.kt +++ b/python/src/com/jetbrains/python/run/target/PySdkTargetPaths.kt @@ -13,6 +13,7 @@ import com.jetbrains.python.console.PyConsoleOptions import com.jetbrains.python.console.getPathMapper import com.jetbrains.python.remote.PyRemotePathMapper import com.jetbrains.python.remote.PythonRemoteInterpreterManager.appendBasicMappings +import org.jetbrains.annotations.ApiStatus import java.nio.file.Path /** @@ -20,7 +21,8 @@ import java.nio.file.Path * @throws IllegalArgumentException if [localPath] cannot be found neither in SDK additional data nor within the registered uploads in the * request */ -fun getTargetPathForPythonScriptExecution(project: Project, +@ApiStatus.Internal +internal fun getTargetPathForPythonScriptExecution(project: Project, sdk: Sdk?, pathMapper: PyRemotePathMapper?, localPath: Path): TargetEnvironmentFunction { @@ -50,7 +52,8 @@ private fun PyRemotePathMapper.extendPythonSdkPathMapper(project: Project, sdk: * @throws IllegalArgumentException if [localPath] cannot be found neither in SDK additional data nor within the registered uploads in the * request */ -fun getTargetPathForPythonConsoleExecution(project: Project, +@ApiStatus.Internal +internal fun getTargetPathForPythonConsoleExecution(project: Project, sdk: Sdk?, pathMapper: PyRemotePathMapper?, localPath: Path): TargetEnvironmentFunction {