mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Python: unused symbols removed
GitOrigin-RevId: ea7dc3c43777f2b33e3284f782620ae8cdef04a2
This commit is contained in:
committed by
intellij-monorepo-bot
parent
53ded717a4
commit
29ec21d7bd
@@ -15,8 +15,6 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* @author Alexei Orischenko
|
||||
@@ -65,15 +63,6 @@ public final class PythonStringUtil {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isEmail(String s) {
|
||||
if (!StringUtil.isEmpty(s)) {
|
||||
Pattern p = Pattern.compile("^[\\w\\.-]+@([\\w\\-]+\\.)+[a-z]{2,4}$");
|
||||
Matcher m = p.matcher(s);
|
||||
return m.matches();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static @NotNull String getFirstPrefix(String s, String separator) {
|
||||
if (s != null) {
|
||||
int pos = s.indexOf(separator);
|
||||
|
||||
@@ -42,10 +42,6 @@ public class FileReferenceWithOneContext extends FileReference {
|
||||
super(fileReferenceSet, range, index, text);
|
||||
}
|
||||
|
||||
public FileReferenceWithOneContext(FileReference original) {
|
||||
super(original);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Collection<PsiFileSystemItem> getContextsForBindToElement(VirtualFile curVFile, Project project, FileReferenceHelper helper) {
|
||||
return getContexts();
|
||||
|
||||
@@ -199,14 +199,6 @@ public final class PyPsiUtils {
|
||||
return PyPsiUtilsCore.getChildByFilter(element, filter, number);
|
||||
}
|
||||
|
||||
public static void addBeforeInParent(final @NotNull PsiElement anchor, final PsiElement @NotNull ... newElements) {
|
||||
final ASTNode anchorNode = anchor.getNode();
|
||||
LOG.assertTrue(anchorNode != null);
|
||||
for (PsiElement newElement : newElements) {
|
||||
anchorNode.getTreeParent().addChild(newElement.getNode(), anchorNode);
|
||||
}
|
||||
}
|
||||
|
||||
public static void removeElements(final PsiElement @NotNull ... elements) {
|
||||
final ASTNode parentNode = elements[0].getParent().getNode();
|
||||
LOG.assertTrue(parentNode != null);
|
||||
|
||||
@@ -127,13 +127,6 @@ public final class StubAwareComputation<Psi extends PsiElement, CustomStub, Resu
|
||||
public @NotNull <Result> StubAwareComputation<Psi, CustomStub, Result> overAst(@NotNull Function<Psi, Result> astComputation) {
|
||||
return new StubAwareComputation<>(this, null, astComputation, null, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see StubAwareComputation#overAstStubLike(Function)
|
||||
*/
|
||||
public @NotNull <Result> StubAwareComputation<Psi, CustomStub, Result> overAstStubLike(@NotNull Function<Psi, Result> astStubLikeComputation) {
|
||||
return new StubAwareComputation<>(this, null, null, astStubLikeComputation, null);
|
||||
}
|
||||
}
|
||||
|
||||
private final @NotNull PsiToStubConversion<Psi, ?, CustomStub> myConversion;
|
||||
|
||||
@@ -108,14 +108,6 @@ public final class PythonEnvUtil {
|
||||
addPathToEnv(env, PYTHONPATH, value);
|
||||
}
|
||||
|
||||
public static void mergePythonPath(@NotNull Map<String, String> from, @NotNull Map<String, String> to) {
|
||||
String value = from.get(PYTHONPATH);
|
||||
if (value != null) {
|
||||
Set<String> paths = Sets.newHashSet(value.split(File.pathSeparator));
|
||||
addToPythonPath(to, paths);
|
||||
}
|
||||
}
|
||||
|
||||
public static @NotNull Map<String, String> setPythonDontWriteBytecode(@NotNull Map<String, String> env) {
|
||||
env.put(PYTHONDONTWRITEBYTECODE, "1");
|
||||
return env;
|
||||
|
||||
@@ -1,17 +1,5 @@
|
||||
// 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.module;
|
||||
|
||||
import com.intellij.ide.util.projectWizard.ModuleBuilder;
|
||||
import com.intellij.platform.DirectoryProjectGenerator;
|
||||
|
||||
public abstract class PyModuleServiceEx extends PyModuleService {
|
||||
/**
|
||||
* Creates a ModuleBuilder that creates a Python module and runs the specified DirectoryProjectGenerator to perform
|
||||
* further initialization. The showGenerationSettings() method on the generator is not called, and the generateProject() method
|
||||
* receives null as the 'settings' parameter.
|
||||
*
|
||||
* @param generator the generator to run for configuring the project
|
||||
* @return the created module builder instance
|
||||
*/
|
||||
public abstract ModuleBuilder createPythonModuleBuilder(DirectoryProjectGenerator generator);
|
||||
}
|
||||
|
||||
@@ -4,22 +4,16 @@ package com.jetbrains.python.module;
|
||||
import com.intellij.facet.Facet;
|
||||
import com.intellij.facet.FacetConfiguration;
|
||||
import com.intellij.facet.FacetManager;
|
||||
import com.intellij.ide.util.projectWizard.ModuleBuilder;
|
||||
import com.intellij.openapi.fileTypes.FileTypeManager;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.platform.DirectoryProjectGenerator;
|
||||
import com.intellij.util.Consumer;
|
||||
import com.jetbrains.python.facet.PythonFacetSettings;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
final class PyModuleServiceImpl extends PyModuleServiceEx {
|
||||
@Override
|
||||
public ModuleBuilder createPythonModuleBuilder(DirectoryProjectGenerator generator) {
|
||||
return new PythonModuleBuilderBase(generator);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFileIgnored(@NotNull VirtualFile file) {
|
||||
|
||||
@@ -45,11 +45,6 @@ public final class PyNamespacePackagesService implements PersistentStateComponen
|
||||
return module.getService(PyNamespacePackagesService.class);
|
||||
}
|
||||
|
||||
public @NotNull List<String> getNamespacePackageFolders() {
|
||||
removeInvalidNamespacePackageFolders();
|
||||
return Collections.unmodifiableList(myTools.getFoldersAsStrings());
|
||||
}
|
||||
|
||||
@Transient
|
||||
public @NotNull List<VirtualFile> getNamespacePackageFoldersVirtualFiles() {
|
||||
removeInvalidNamespacePackageFolders();
|
||||
|
||||
@@ -259,12 +259,6 @@ public abstract class PythonProjectGenerator<T extends PyNewProjectSettings> ext
|
||||
void stateChanged();
|
||||
}
|
||||
|
||||
public void fireStateChanged() {
|
||||
for (SettingsListener listener : myListeners) {
|
||||
listener.stateChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public void afterProjectGenerated(final @NotNull Project project) {
|
||||
}
|
||||
|
||||
|
||||
@@ -3,11 +3,9 @@ package com.jetbrains.python.newProject.steps;
|
||||
|
||||
import com.intellij.execution.target.TargetEnvironmentConfiguration;
|
||||
import com.intellij.facet.ui.ValidationResult;
|
||||
import com.intellij.ide.impl.ProjectUtil;
|
||||
import com.intellij.ide.util.projectWizard.AbstractNewProjectStep;
|
||||
import com.intellij.ide.util.projectWizard.ProjectSettingsStepBase;
|
||||
import com.intellij.ide.util.projectWizard.WebProjectTemplate;
|
||||
import com.intellij.openapi.application.PathManager;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.ui.LabeledComponent;
|
||||
@@ -21,8 +19,6 @@ import com.intellij.platform.DirectoryProjectGenerator;
|
||||
import com.intellij.ui.HideableDecorator;
|
||||
import com.intellij.util.ObjectUtils;
|
||||
import com.intellij.util.PathUtil;
|
||||
import com.intellij.util.PlatformUtils;
|
||||
import com.intellij.util.concurrency.annotations.RequiresEdt;
|
||||
import com.jetbrains.python.PyBundle;
|
||||
import com.jetbrains.python.configuration.PyConfigurableInterpreterList;
|
||||
import com.jetbrains.python.newProject.PyFrameworkProjectGenerator;
|
||||
@@ -43,7 +39,6 @@ import org.jetbrains.annotations.Nullable;
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.io.File;
|
||||
import java.nio.file.Path;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -116,10 +111,6 @@ public class ProjectSpecificSettingsStep<T extends PyNewProjectSettings> extends
|
||||
return interpreterPanel.getSdk();
|
||||
}
|
||||
|
||||
public boolean installFramework() {
|
||||
return myInstallFramework;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerValidators() {
|
||||
super.registerValidators();
|
||||
@@ -348,20 +339,4 @@ public class ProjectSpecificSettingsStep<T extends PyNewProjectSettings> extends
|
||||
.sorted(new PreferredSdkComparator())
|
||||
.toList();
|
||||
}
|
||||
|
||||
/**
|
||||
* If {@link PythonProjectGenerator} {@link PythonProjectGenerator#supportsWelcomeScript()},
|
||||
* {@link ProjectSpecificSettingsStep} and inheritors should ask use if one should be created, and return true if so.
|
||||
*/
|
||||
@RequiresEdt
|
||||
public boolean createWelcomeScript() {
|
||||
return false;
|
||||
}
|
||||
|
||||
private static @NotNull File getBaseDir() {
|
||||
if (PlatformUtils.isDataSpell() && Path.of(ProjectUtil.getBaseDir()).startsWith(PathManager.getConfigDir())) {
|
||||
return new File(ProjectUtil.getUserHomeProjectDir());
|
||||
}
|
||||
return new File(ProjectUtil.getBaseDir());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@ import com.intellij.ui.dsl.builder.Align
|
||||
import com.intellij.ui.dsl.builder.bindSelected
|
||||
import com.intellij.ui.dsl.builder.bindText
|
||||
import com.intellij.ui.dsl.builder.panel
|
||||
import com.intellij.util.concurrency.annotations.RequiresEdt
|
||||
import com.jetbrains.python.PyBundle.message
|
||||
import com.jetbrains.python.newProject.PyNewProjectSettings
|
||||
import com.jetbrains.python.newProject.PythonProjectGenerator
|
||||
@@ -79,9 +78,6 @@ class PythonProjectSpecificSettingsStep<T : PyNewProjectSettings>(
|
||||
return createContentPanelWithAdvancedSettingsPanel()
|
||||
}
|
||||
|
||||
@RequiresEdt
|
||||
override fun createWelcomeScript(): Boolean = createScript.get()
|
||||
|
||||
/**
|
||||
* Returns the project location that is either:
|
||||
* - constructed using two parts (using the values from "Location" and "Name" fields) for Python project types ("Pure Python", "Django",
|
||||
@@ -180,10 +176,6 @@ class PythonProjectSpecificSettingsStep<T : PyNewProjectSettings>(
|
||||
}
|
||||
}
|
||||
|
||||
override fun installFramework(): Boolean {
|
||||
return true
|
||||
}
|
||||
|
||||
override fun onPanelSelected() {
|
||||
interpreterPanel?.onShown()
|
||||
}
|
||||
|
||||
@@ -123,18 +123,6 @@ public abstract class PyAbstractPackageCache {
|
||||
return myPackages.containsKey(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns available package versions sorted in the reversed order using
|
||||
* {@link com.intellij.webcore.packaging.PackageVersionComparator} so that the latest version is the first on the list
|
||||
* or {@code null} if the given package is not contained in the cache or this feature is not available.
|
||||
*
|
||||
* @param packageName case-insensitive name of a package
|
||||
*/
|
||||
public @Nullable List<String> getVersions(@NotNull String packageName) {
|
||||
final PackageInfo packageInfo = myPackages.get(packageName);
|
||||
return packageInfo != null ? packageInfo.getVersions() : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format("%s(size=%d): %s...", getClass().getSimpleName(), myPackages.size(),
|
||||
|
||||
@@ -24,14 +24,6 @@ public class PyCondaPackageManagerImpl extends PyPackageManagerImpl {
|
||||
public static final String PYTHON = "python";
|
||||
public boolean useConda = true;
|
||||
|
||||
public boolean useConda() {
|
||||
return useConda;
|
||||
}
|
||||
|
||||
public void useConda(boolean conda) {
|
||||
useConda = conda;
|
||||
}
|
||||
|
||||
PyCondaPackageManagerImpl(final @NotNull Sdk sdk) {
|
||||
super(sdk);
|
||||
}
|
||||
|
||||
@@ -128,16 +128,6 @@ public class PyPackageManagementService extends PackageManagementServiceEx {
|
||||
return result;
|
||||
}
|
||||
|
||||
public Map<String, List<RepoPackage>> getAllPackagesByRepository() {
|
||||
Map<String, List<RepoPackage>> result = new HashMap<>();
|
||||
result.put(PyPIPackageUtil.PYPI_LIST_URL, getCachedPyPIPackages());
|
||||
List<String> repositories = getAdditionalRepositories();
|
||||
for (String repo : repositories) {
|
||||
result.put(repo, PyPIPackageUtil.INSTANCE.getAdditionalPackages(List.of(repo)));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private static @NotNull List<String> getAdditionalRepositories() {
|
||||
return PyPackageService.getInstance().additionalRepositories;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user