cleanup [python]: remove unused symbols

GitOrigin-RevId: cbefb7c4667b2d2d1a8f38bcddc28fb51a0ce226
This commit is contained in:
Ilya.Kazakevich
2026-02-10 23:07:23 +00:00
committed by intellij-monorepo-bot
parent e146a61379
commit 8fd70026cb
25 changed files with 8 additions and 236 deletions
@@ -1236,7 +1236,6 @@ run.processes.with.redirectedErrorStream.description=Merge standard streams of p
executor.actions.submenu=true
executor.actions.submenu.description=Show context execution actions other than Run and Debug in a submenu
kill.windows.processes.softly=false
kill.windows.processes.softly.description=Try to terminate Windows processes gracefully before forcing termination
disable.winp=false
@@ -305,8 +305,7 @@ public class PyIdeCommonOptionsForm implements AbstractPyCommonOptionsForm {
return PythonSdkUtil.findSdkByPath(sdkHome);
}
@Override
public void addInterpreterComboBoxActionListener(ActionListener listener) {
private void addInterpreterComboBoxActionListener(ActionListener listener) {
content.interpreterComboBox.addActionListener(listener);
}
@@ -92,8 +92,7 @@ public class PyPluginCommonOptionsForm implements AbstractPyCommonOptionsForm {
public void subscribe() {
}
@Override
public void addInterpreterComboBoxActionListener(ActionListener listener) {
private void addInterpreterComboBoxActionListener(ActionListener listener) {
content.interpreterComboBox.addActionListener(listener);
}
@@ -31,10 +31,6 @@ public class JavaPythonFacet extends LibraryContributingFacet<JavaPythonFacetCon
PythonFacetUtil.removeLibrary(getModule());
}
public static String getFacetLibraryName(final String sdkName) {
return sdkName + PYTHON_FACET_LIBRARY_NAME_SUFFIX;
}
@Override
public void initFacet() {
updateLibrary();
@@ -756,8 +756,6 @@
<extensionPoint qualifiedName="Pythonid.remoteInterpreterManager"
interface="com.jetbrains.python.remote.PythonRemoteInterpreterManager"
dynamic="true"/>
<extensionPoint qualifiedName="Pythonid.remoteConsoleProcessCreator"
interface="com.jetbrains.python.console.PythonConsoleRemoteProcessCreator" dynamic="true"/>
<extensionPoint qualifiedName="Pythonid.breakpointHandler"
interface="com.jetbrains.python.debugger.PyBreakpointHandlerFactory"
dynamic="true"/>
@@ -9,6 +9,10 @@ import com.intellij.openapi.util.NlsSafe;
import com.intellij.openapi.util.text.StringUtil;
import org.jetbrains.annotations.NotNull;
/**
* @deprecated use {@link com.intellij.execution.process.ProcessListener} directly
*/
@Deprecated(forRemoval = true)
public final class IndicatedProcessOutputListener extends ProcessAdapter {
private final @NotNull ProgressIndicator myIndicator;
@@ -47,19 +47,6 @@ public class PyLegacySkeletonGenerator extends PySkeletonGenerator {
return builder;
}
/**
* @param ensureSuccess throw {@link InvalidSdkException} containing additional diagnostic on process non-zero exit code.
* You might want to disable it for commands where non-zero exit code is possible for situations other
* than misconfigured interpreter or execution error in order to inspect the output manually.
*/
protected @NotNull ProcessOutput runProcess(@NotNull Builder builder, boolean ensureSuccess) throws InvalidSdkException {
ProcessOutput output = builder.runProcess();
if (ensureSuccess && output.getExitCode() != 0) {
throw new InvalidSdkException(formatGeneratorFailureMessage(output));
}
return output;
}
// [targets-api] this should be left as-is because it deals with non-structured `commandLine`
protected @NotNull ProcessOutput getProcessOutput(@Nullable String homePath,
String @NotNull [] commandLine,
@@ -163,16 +163,6 @@ public abstract class PySkeletonGenerator {
return this;
}
public @NotNull Builder timeout(int timeout) {
myTimeout = timeout;
return this;
}
public @NotNull Builder stdin(@NotNull String content) {
myStdin = content;
return this;
}
public @Nullable String getStdin() {
return myStdin;
}
@@ -3,7 +3,6 @@ package com.jetbrains.python;
import com.intellij.execution.configurations.GeneralCommandLine;
import com.intellij.execution.configurations.ParamsGroup;
import com.intellij.openapi.projectRoots.Sdk;
import org.jetbrains.annotations.NotNull;
import java.util.List;
@@ -36,16 +35,4 @@ public interface HelperPackage {
@NotNull
GeneralCommandLine newCommandLine(@NotNull String sdkPath, @NotNull List<String> parameters);
/**
* Version-sensitive version of {@link #newCommandLine(String, List)}. It adds additional directories with libraries inside python-helpers
* depending on the version of pythonSdk: either {@link PythonHelper#PY2_HELPER_DEPENDENCIES_DIR} or
* {@link PythonHelper#PY3_HELPER_DEPENDENCIES_DIR}.
*
* @param pythonSdk Python SDK containing interpreter that will be used to run this helper
* @param parameters additional command line parameters of this helper
* @return instance {@link GeneralCommandLine} used to start the process
*/
@NotNull
GeneralCommandLine newCommandLine(@NotNull Sdk pythonSdk, @NotNull List<String> parameters);
}
@@ -174,8 +174,8 @@ public enum PythonHelper implements HelperPackage {
return cmd;
}
@Override
public @NotNull GeneralCommandLine newCommandLine(@NotNull Sdk pythonSdk, @NotNull List<String> parameters) {
@NotNull
private GeneralCommandLine newCommandLine(@NotNull Sdk pythonSdk, @NotNull List<String> parameters) {
final String sdkHomePath = pythonSdk.getHomePath();
assert sdkHomePath != null;
final GeneralCommandLine cmd = newCommandLine(sdkHomePath, parameters);
@@ -295,7 +295,6 @@ public enum PythonHelper implements HelperPackage {
return myModule.newCommandLine(sdkPath, parameters);
}
@Override
public @NotNull GeneralCommandLine newCommandLine(@NotNull Sdk pythonSdk, @NotNull List<String> parameters) {
return myModule.newCommandLine(pythonSdk, parameters);
}
@@ -1,16 +0,0 @@
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.jetbrains.python.console
import com.intellij.openapi.extensions.ExtensionPointName
import com.intellij.remote.CredentialsType
interface PythonConsoleRemoteProcessCreator<T> {
val credentialsType: CredentialsType<T>
companion object {
@JvmField
val EP_NAME: ExtensionPointName<PythonConsoleRemoteProcessCreator<Any>> = ExtensionPointName.create(
"Pythonid.remoteConsoleProcessCreator")
}
}
@@ -25,7 +25,6 @@ import com.jetbrains.python.PyBundle;
import com.jetbrains.python.packaging.repository.PyPackageRepositories;
import com.jetbrains.python.packaging.repository.PyPackageRepositoryUtil;
import one.util.streamex.EntryStream;
import one.util.streamex.StreamEx;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -147,10 +146,6 @@ public final class PyPIPackageUtil {
return repository != null && repository.startsWith(PYPI_BASE_URL);
}
public @NotNull List<RepoPackage> getAdditionalPackages(@NotNull List<String> repositories) {
return StreamEx.of(myAdditionalPackages.getAllPresent(repositories).values()).flatMap(StreamEx::of).toList();
}
public void loadAdditionalPackages(@NotNull List<String> repositories, boolean alwaysRefresh) {
var failedToConnect = new ArrayList<String>();
if (alwaysRefresh) {
@@ -10,8 +10,6 @@ import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.xmlb.XmlSerializerUtil;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.SystemIndependent;
import java.util.List;
import java.util.Map;
@@ -24,7 +22,6 @@ public class PyPackageService implements
PersistentStateComponent<PyPackageService> {
public volatile Map<String, Boolean> sdkToUsersite = new ConcurrentHashMap<>();
public volatile List<String> additionalRepositories = ContainerUtil.createConcurrentList();
public volatile @SystemIndependent String virtualEnvBasePath;
public volatile Boolean PYPI_REMOVED = false;
@Override
@@ -69,12 +66,4 @@ public class PyPackageService implements
public static PyPackageService getInstance() {
return ApplicationManager.getApplication().getService(PyPackageService.class);
}
public @Nullable @SystemIndependent String getVirtualEnvBasePath() {
return virtualEnvBasePath;
}
public void setVirtualEnvBasePath(@NotNull @SystemIndependent String virtualEnvBasePath) {
this.virtualEnvBasePath = virtualEnvBasePath;
}
}
@@ -40,7 +40,6 @@ import java.util.Set;
public final class SetupTaskIntrospector {
private static final Logger LOG = Logger.getInstance(SetupTaskIntrospector.class);
private static final Map<String, List<SetupTask>> ourDistutilsTaskCache = new HashMap<>();
private static final Map<String, List<SetupTask>> ourSetuptoolsTaskCache = new HashMap<>();
@@ -5,7 +5,6 @@ import com.intellij.execution.ExecutionException;
import com.intellij.execution.RunCanceledByUserException;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.util.NlsContexts;
import com.intellij.openapi.util.NlsContexts.DetailedDescription;
import com.intellij.openapi.util.NlsSafe;
import com.intellij.openapi.util.SystemInfo;
@@ -382,10 +381,6 @@ public abstract class PyPackageManagementService extends PackageManagementServic
myInterpreterPath = sdk != null ? sdk.getHomePath() : null;
}
public static @Nullable PyPackageInstallationErrorDescription createFromMessage(@Nullable @NlsContexts.DetailedDescription String message) {
return message != null ? new PyPackageInstallationErrorDescription(message, null, null, null, null, null) : null;
}
public @Nullable @NlsSafe String getPackageName() {
return myPackageName;
}
@@ -5,7 +5,6 @@ import com.intellij.execution.configurations.GeneralCommandLine;
import com.intellij.execution.configurations.ParamsGroup;
import com.intellij.remote.RemoteFile;
import com.intellij.remote.RemoteProcessUtil;
import com.intellij.remote.RemoteSdkProperties;
import com.intellij.util.PathMapper;
import com.jetbrains.python.debugger.PyDebugRunner;
import com.jetbrains.python.run.PythonCommandLineState;
@@ -26,10 +25,6 @@ public final class PyCommandLineStateUtil {
private PyCommandLineStateUtil() { }
public static void remap(@NotNull RemoteSdkProperties sdkProperties, @NotNull GeneralCommandLine commandLine, @NotNull PathMapper pathMapper) {
remap(sdkProperties.getInterpreterPath(), commandLine, pathMapper);
}
public static void remap(@NotNull String interpreterPath, @NotNull GeneralCommandLine commandLine, @NotNull PathMapper pathMapper) {
ParamsGroup paramsGroup = commandLine.getParametersList().getParamsGroup(PythonCommandLineState.GROUP_SCRIPT);
remapParameters(interpreterPath, pathMapper, paramsGroup, commandLine.getWorkDirectory());
@@ -17,13 +17,7 @@ package com.jetbrains.python.remote;
public interface PyCredentialsContribution<T> {
boolean isValid(T credentials);
boolean isPackageManagementEnabled();
boolean isSpecificCoverageAttach();
boolean isSpecificCoveragePatch();
boolean isRemoteProcessStartSupported();
}
@@ -3,5 +3,4 @@ package com.jetbrains.python.remote;
public interface PyRemoteProcessControl extends RemoteProcessControl {
PyRemoteSocketToLocalHostProvider getRemoteSocketToLocalHostProvider();
}
@@ -3,7 +3,6 @@ package com.jetbrains.python.remote;
import com.google.common.net.HostAndPort;
import com.intellij.execution.KillableProcess;
import com.intellij.execution.configurations.GeneralCommandLine;
import com.intellij.execution.process.AnsiEscapeDecoder;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.Key;
@@ -88,17 +87,6 @@ public final class PyRemoteProcessHandler extends BaseRemoteProcessHandler<Remot
}
public static @NotNull PyRemoteProcessHandler createProcessHandler(@NotNull RemoteProcess remoteProcess,
@Nullable String fullInterpreterPath,
@NotNull GeneralCommandLine commandLine,
@Nullable PyRemotePathMapper pathMapper,
@NotNull PyRemoteSocketToLocalHostProvider remoteSocketProvider)
throws RemoteSdkException {
return new PyRemoteProcessHandler(remoteProcess,
commandLine.getCommandLineString(fullInterpreterPath), commandLine.getCharset(),
pathMapper, remoteSocketProvider, false);
}
public static @NotNull PyRemoteProcessHandler createProcessHandler(@NotNull RemoteProcess remoteProcess,
@NotNull String commandLine,
@NotNull Charset charset,
@@ -108,14 +96,6 @@ public final class PyRemoteProcessHandler extends BaseRemoteProcessHandler<Remot
return new PyRemoteProcessHandler(remoteProcess, commandLine, charset, pathMapper, remoteSocketProvider, isRunWithPty);
}
public static @NotNull PyRemoteProcessHandler createProcessHandler(@NotNull RemoteProcess remoteProcess,
@NotNull String commandLine,
@NotNull Charset charset,
@Nullable PyRemotePathMapper pathMapper,
@NotNull PyRemoteSocketToLocalHostProvider remoteSocketProvider) {
return createProcessHandler(remoteProcess, commandLine, charset, pathMapper, remoteSocketProvider, false);
}
@Override
public void notifyTextAvailable(@NotNull String text, @NotNull Key outputType) {
if (isRunWithPty()) {
@@ -177,9 +157,4 @@ public final class PyRemoteProcessHandler extends BaseRemoteProcessHandler<Remot
public @NotNull PyPositionConverter createPositionConverter(@NotNull PyDebugProcess debugProcess) {
return new PyRemotePositionConverter(debugProcess, myPathMapper);
}
@Override
public PyRemoteSocketToLocalHostProvider getRemoteSocketToLocalHostProvider() {
return myRemoteSocketProvider;
}
}
@@ -3,8 +3,6 @@ package com.jetbrains.python.remote;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.remote.RemoteFile;
import com.intellij.util.PathMappingSettings;
import org.jetbrains.annotations.NotNull;
import java.io.File;
@@ -13,7 +11,6 @@ public class PyRemoteSourceItem {
private final String myPath;
private final String myRootPath;
private final int mySize;
private String myLocalPrefix = null;
public PyRemoteSourceItem(String path, String rootPath, int size) {
@@ -22,19 +19,6 @@ public class PyRemoteSourceItem {
mySize = size;
}
public boolean shouldCopy(String basePath) {
File localFile = getLocalFile(basePath);
return shouldCopyTo(localFile);
}
public boolean shouldCopyTo(File localFile) {
return !localFile.exists() || localFile.length() != getSize();
}
public File getLocalFile(String basePath) {
return new File(basePath, getLocalRelativePath());
}
public String getPath() {
return myPath;
}
@@ -47,37 +31,10 @@ public class PyRemoteSourceItem {
return mySize;
}
public String getLocalRelativePath() {
if (myLocalPrefix != null) {
return myLocalPrefix + (getModule().startsWith("?") ? "" : "/") + getModule();
}
else {
return getModule();
}
}
public String getModule() {
return myPath.substring(myRootPath.length());
}
public String getArcPath() {
return getLocalRelativePath();
}
public void setLocalPrefix(String localPrefix) {
localPrefix = StringUtil.trimEnd(localPrefix, "/");
myLocalPrefix = localPrefix;
}
public String getLocalPrefix() {
return myLocalPrefix;
}
public void addRootMappingTo(@NotNull PathMappingSettings settings, @NotNull String sourcesLocalPath) {
settings.addMappingCheckUnique(
FileUtil.toCanonicalPath(new File(sourcesLocalPath, generateRootFolderName()).getAbsolutePath()), getRootPath());
}
public static String localPathForRemoteRoot(@NotNull String sourcesLocalPath, @NotNull String remoteRoot) {
return FileUtil.toCanonicalPath(new File(sourcesLocalPath, generateRootFolderNameFor(normalize(remoteRoot))).getAbsolutePath());
}
@@ -92,16 +49,6 @@ public class PyRemoteSourceItem {
}
}
public String generateRootFolderName() {
if (getPath().equals(getRootPath())) // this is an egg for example
{
return RemoteFile.createRemoteFile(getPath()).getName();
}
else {
return generateRootFolderNameFor(getRootPath());
}
}
private static @NotNull String generateRootFolderNameFor(String path) {
return String.valueOf(path.hashCode());
}
@@ -12,7 +12,6 @@ import com.intellij.remote.RemoteMappingsManager;
import com.intellij.remote.RemoteSdkAdditionalData;
import com.intellij.remote.RemoteSdkProperties;
import com.intellij.util.PathMappingSettings;
import com.intellij.util.containers.ContainerUtil;
import com.jetbrains.python.PyBundle;
import com.jetbrains.python.extensions.ProgressManagerExtKt;
import com.jetbrains.python.remote.PyRemotePathMapper.PyPathMappingType;
@@ -29,10 +28,6 @@ public abstract class PythonRemoteInterpreterManager {
public static final String PYTHON_PREFIX = "python";
public static @Nullable PythonRemoteInterpreterManager getInstance() {
return ContainerUtil.getFirstItem(EP_NAME.getExtensionList());
}
/**
* @deprecated use {@link java.nio.file.Path}
*/
@@ -1,16 +0,0 @@
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.jetbrains.python.remote;
/**
* The exception is thrown when no implementation of
* {@link PythonRemoteInterpreterManager#EP_NAME} extension point is available,
* what means that Python SSH Interpreter plugin is disabled by user (or it
* was failed to load because of internal problems).
*/
public class PythonRemoteInterpreterPluginNotAvailableException extends RuntimeException {
private static final String ERROR_MESSAGE = "Remote interpreter can't be executed. Please enable the Python SSH Interpreter plugin.";
public PythonRemoteInterpreterPluginNotAvailableException() {
super(ERROR_MESSAGE);
}
}
@@ -1,20 +1,11 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.jetbrains.python.remote;
import com.intellij.execution.ExecutionException;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.openapi.project.Project;
import com.intellij.remote.RemoteConnectionCredentialsWrapper;
import com.intellij.remote.RemoteCredentials;
import com.intellij.remote.RemoteSdkProperties;
import com.intellij.util.PathMappingSettings;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.text.MessageFormat;
import java.util.List;
import java.util.function.Consumer;
/**
* This service provides functionality for SSH remote interpreters. It is
@@ -26,26 +17,6 @@ public interface PythonSshInterpreterManager {
ExtensionPointName<PythonSshInterpreterManager> EP_NAME = ExtensionPointName.create("Pythonid.sshInterpreterManager");
void copyFromRemote(
@NotNull Project project,
@NotNull RemoteCredentials credentials,
@NotNull RemoteSdkProperties sdkProperties,
@NotNull List<PathMappingSettings.PathMapping> mapping
);
@NotNull RemoteCredentials getRemoteCredentials(
@NotNull RemoteConnectionCredentialsWrapper wrapper,
@Nullable Project project,
boolean allowSynchronousInteraction
) throws InterruptedException, ExecutionException;
void produceRemoteCredentials(
@NotNull RemoteConnectionCredentialsWrapper wrapper,
@Nullable Project project,
boolean allowSynchronousInteraction,
@NotNull Consumer<RemoteCredentials> consumer
);
final class Factory {
public static @Nullable PythonSshInterpreterManager getInstance() {
var extensions = EP_NAME.getExtensionList();
@@ -5,7 +5,6 @@ import com.intellij.ui.PanelWithAnchor;
import org.jetbrains.annotations.NonNls;
import javax.swing.JComponent;
import java.awt.event.ActionListener;
import java.util.function.Consumer;
@@ -16,7 +15,5 @@ public interface AbstractPyCommonOptionsForm extends AbstractPythonRunConfigurat
void subscribe();
void addInterpreterComboBoxActionListener(ActionListener listener);
void addInterpreterModeListener(Consumer<Boolean> listener);
}
@@ -6,7 +6,6 @@ import com.intellij.execution.configurations.GeneralCommandLine;
import com.intellij.execution.process.AnsiEscapeDecoder;
import com.intellij.execution.process.KillableProcessHandler;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.registry.Registry;
import org.jetbrains.annotations.NotNull;
import java.nio.charset.Charset;
@@ -15,10 +14,6 @@ public class PythonProcessHandler extends KillableProcessHandler implements Ansi
private final AnsiEscapeDecoder myAnsiEscapeDecoder = new AnsiEscapeDecoder();
public static boolean softKillOnWin() {
return Registry.is("kill.windows.processes.softly", false);
}
public PythonProcessHandler(@NotNull GeneralCommandLine commandLine) throws ExecutionException {
super(commandLine);
}