[python] packages moved to com.jetbrains.python package, as whole community.python.impl must be there

GitOrigin-RevId: 339a5be4b4c260ce0c31ee2245870ef953065b2d
This commit is contained in:
Ilya.Kazakevich
2024-01-11 16:18:42 +01:00
committed by intellij-monorepo-bot
parent 8c5a1c6c2e
commit f8a5625f99
52 changed files with 425 additions and 177 deletions

View File

@@ -18,6 +18,8 @@ package com.jetbrains.extensions
import com.intellij.openapi.module.Module
import com.intellij.openapi.projectRoots.Sdk
import com.intellij.openapi.roots.ModuleRootManager
import org.jetbrains.annotations.ApiStatus.ScheduledForRemoval
@Deprecated(message = "Moved to com.jetbrains.python")
@ScheduledForRemoval
fun Module.getSdk(): Sdk? = ModuleRootManager.getInstance(this).sdk

View File

@@ -1,18 +1,4 @@
/*
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// 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.extensions
import com.intellij.openapi.module.Module
@@ -34,9 +20,14 @@ import com.jetbrains.python.psi.resolve.*
import com.jetbrains.python.psi.stubs.PyModuleNameIndex
import com.jetbrains.python.psi.types.TypeEvalContext
import com.jetbrains.python.sdk.PySdkUtil
import org.jetbrains.annotations.ApiStatus
import java.util.*
/**
* @deprecated moved to {@link com.jetbrains.python.extensions}
*/
@ApiStatus.ScheduledForRemoval
@Deprecated(message = "Moved to com.jetbrains.python")
interface ContextAnchor {
val sdk: Sdk?
val project: Project
@@ -47,6 +38,11 @@ interface ContextAnchor {
}
}
/**
* @deprecated moved to {@link com.jetbrains.python.extensions}
*/
@ApiStatus.ScheduledForRemoval
@Deprecated(message = "Moved to com.jetbrains.python")
class ModuleBasedContextAnchor(val module: Module) : ContextAnchor {
override val sdk: Sdk? = module.getSdk()
override val project: Project = module.project
@@ -58,16 +54,11 @@ class ModuleBasedContextAnchor(val module: Module) : ContextAnchor {
}
}
class ProjectSdkContextAnchor(override val project: Project, override val sdk: Sdk?) : ContextAnchor {
override val qualifiedNameResolveContext: PyQualifiedNameResolveContext? = sdk?.let { fromSdk(project, it) }
override val scope: GlobalSearchScope = GlobalSearchScope.projectScope(project) //TODO: Check if project scope includes SDK
override fun getRoots(): Array<VirtualFile> {
val manager = ProjectRootManager.getInstance(project)
return super.getRoots() + manager.contentRoots + manager.contentSourceRoots
}
}
/**
* @deprecated moved to {@link com.jetbrains.python.extensions}
*/
@ApiStatus.ScheduledForRemoval
@Deprecated(message = "Moved to com.jetbrains.python")
data class QNameResolveContext(
val contextAnchor: ContextAnchor,
/**
@@ -86,9 +77,21 @@ data class QNameResolveContext(
val allowInaccurateResult: Boolean = false
)
/**
* @return qname part relative to root
* @deprecated moved to {@link com.jetbrains.python.extensions}
*/
@ApiStatus.ScheduledForRemoval
@Deprecated(message = "Moved to com.jetbrains.python")
fun QualifiedName.resolveToElement(context: QNameResolveContext, stopOnFirstFail: Boolean = false): PsiElement? {
return getElementAndResolvableName(context, stopOnFirstFail)?.element
}
/**
* @deprecated moved to {@link com.jetbrains.python.extensions}
*/
@ApiStatus.ScheduledForRemoval
@Deprecated(message = "Moved to com.jetbrains.python")
fun QualifiedName.getRelativeNameTo(root: QualifiedName): QualifiedName? {
if (Collections.indexOfSubList(components, root.components) == -1) {
return null
@@ -97,22 +100,31 @@ fun QualifiedName.getRelativeNameTo(root: QualifiedName): QualifiedName? {
}
/**
* Resolves qname of any symbol to appropriate PSI element.
* Shortcut for [getElementAndResolvableName]
* @see [getElementAndResolvableName]
* @deprecated moved to {@link com.jetbrains.python.extensions}
*/
fun QualifiedName.resolveToElement(context: QNameResolveContext, stopOnFirstFail: Boolean = false): PsiElement? {
return getElementAndResolvableName(context, stopOnFirstFail)?.element
@ApiStatus.ScheduledForRemoval
@Deprecated(message = "Moved to com.jetbrains.python")
class ProjectSdkContextAnchor(override val project: Project, override val sdk: Sdk?) : com.jetbrains.python.extensions.ContextAnchor {
override val qualifiedNameResolveContext: PyQualifiedNameResolveContext? = sdk?.let { fromSdk(project, it) }
override val scope: GlobalSearchScope = GlobalSearchScope.projectScope(project) //TODO: Check if project scope includes SDK
override fun getRoots(): Array<VirtualFile> {
val manager = ProjectRootManager.getInstance(project)
return super.getRoots() + manager.contentRoots + manager.contentSourceRoots
}
}
/**
* @deprecated moved to {@link com.jetbrains.python.extensions}
*/
@ApiStatus.ScheduledForRemoval
@Deprecated(message = "Moved to com.jetbrains.python")
data class NameAndElement(val name: QualifiedName, val element: PsiElement)
/**
* Resolves qname of any symbol to PSI element popping tail until element becomes resolved or only one time if stopOnFirstFail
* @return element and longest name that was resolved successfully.
* @see [resolveToElement]
* @deprecated moved to {@link com.jetbrains.python.extensions}
*/
@ApiStatus.ScheduledForRemoval
@Deprecated(message = "Moved to com.jetbrains.python")
fun QualifiedName.getElementAndResolvableName(context: QNameResolveContext, stopOnFirstFail: Boolean = false): NameAndElement? {
var currentName = QualifiedName.fromComponents(this.components)

View File

@@ -0,0 +1,9 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
/**
* @deprecated moved to {@link com.jetbrains.python.extensions}
*/
@ApiStatus.ScheduledForRemoval
@Deprecated
package com.jetbrains.extensions;
import org.jetbrains.annotations.ApiStatus;

View File

@@ -1,21 +1,16 @@
// 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.extensions.python
package com.jetbrains.extensions.python;
import com.jetbrains.python.nameResolver.FQNamesProvider
import com.jetbrains.python.nameResolver.NameResolverTools
import com.jetbrains.python.psi.PyAssignmentStatement
import com.jetbrains.python.psi.PyCallExpression
import com.jetbrains.python.psi.PyPossibleClassMember
import org.jetbrains.annotations.ApiStatus
/**
* Checks if ``foo = SomeExpr()`` where foo is class attribute
*/
val PyCallExpression.isClassAttribute: Boolean
get() =
(parent as? PyAssignmentStatement)?.targets?.filterIsInstance<PyPossibleClassMember>()?.any { it.containingClass != null } == true
/**
* Checks if callee has certain name. Only name is checked, so import aliases aren't supported, but it works pretty fast
* @deprecated moved to {@link com.jetbrains.python.extensions}
*/
@ApiStatus.ScheduledForRemoval
@Deprecated(message = "Moved to com.jetbrains.python")
fun PyCallExpression.isCalleeName(vararg names: FQNamesProvider): Boolean = NameResolverTools.isCalleeShortCut(this, *names)

View File

@@ -0,0 +1,9 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
/**
* @deprecated moved to {@link com.jetbrains.python.extensions}
*/
@ApiStatus.ScheduledForRemoval
@Deprecated
package com.jetbrains.extensions.python;
import org.jetbrains.annotations.ApiStatus;

View File

@@ -13,10 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jetbrains.python.extensions
/**
* Extension methods for various classes.
* Methods are transparent for Kotlin, while in Java you must use following pattern: class MyClass has extensions in MyClassExtKt.
* @author Ilya.Kazakevich
*/
package com.jetbrains.extensions;
import com.intellij.openapi.module.Module
import com.intellij.openapi.projectRoots.Sdk
import com.intellij.openapi.roots.ModuleRootManager
fun Module.getSdk(): Sdk? = ModuleRootManager.getInstance(this).sdk

View File

@@ -0,0 +1,168 @@
// 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.extensions
import com.intellij.openapi.module.Module
import com.intellij.openapi.project.Project
import com.intellij.openapi.projectRoots.Sdk
import com.intellij.openapi.roots.ModuleRootManager
import com.intellij.openapi.roots.OrderRootType
import com.intellij.openapi.roots.ProjectRootManager
import com.intellij.openapi.vfs.VirtualFile
import com.intellij.psi.PsiDirectory
import com.intellij.psi.PsiElement
import com.intellij.psi.PsiManager
import com.intellij.psi.search.GlobalSearchScope
import com.intellij.psi.util.QualifiedName
import com.jetbrains.python.PyNames
import com.jetbrains.python.psi.PyClass
import com.jetbrains.python.psi.PyFile
import com.jetbrains.python.psi.resolve.*
import com.jetbrains.python.psi.stubs.PyModuleNameIndex
import com.jetbrains.python.psi.types.TypeEvalContext
import com.jetbrains.python.sdk.PySdkUtil
import java.util.*
interface ContextAnchor {
val sdk: Sdk?
val project: Project
val qualifiedNameResolveContext: PyQualifiedNameResolveContext?
val scope: GlobalSearchScope
fun getRoots(): Array<VirtualFile> {
return sdk?.rootProvider?.getFiles(OrderRootType.CLASSES) ?: emptyArray()
}
}
class ModuleBasedContextAnchor(val module: Module) : ContextAnchor {
override val sdk: Sdk? = module.getSdk()
override val project: Project = module.project
override val qualifiedNameResolveContext: PyQualifiedNameResolveContext = fromModule(module)
override val scope: GlobalSearchScope = module.moduleContentScope
override fun getRoots(): Array<VirtualFile> {
val manager = ModuleRootManager.getInstance(module)
return super.getRoots() + manager.contentRoots + manager.sourceRoots
}
}
class ProjectSdkContextAnchor(override val project: Project, override val sdk: Sdk?) : ContextAnchor {
override val qualifiedNameResolveContext: PyQualifiedNameResolveContext? = sdk?.let { fromSdk(project, it) }
override val scope: GlobalSearchScope = GlobalSearchScope.projectScope(project) //TODO: Check if project scope includes SDK
override fun getRoots(): Array<VirtualFile> {
val manager = ProjectRootManager.getInstance(project)
return super.getRoots() + manager.contentRoots + manager.contentSourceRoots
}
}
data class QNameResolveContext(
val contextAnchor: ContextAnchor,
/**
* Used for language level etc
*/
val sdk: Sdk? = contextAnchor.sdk,
val evalContext: TypeEvalContext,
/**
* If not provided resolves against roots only. Resolved also against this folder otherwise
*/
val folderToStart: VirtualFile? = null,
/**
* Use index, plain dirs with Py2 and so on. May resolve names unresolvable in other cases, but may return false results.
*/
val allowInaccurateResult: Boolean = false
)
/**
* @return qname part relative to root
*/
fun QualifiedName.getRelativeNameTo(root: QualifiedName): QualifiedName? {
if (Collections.indexOfSubList(components, root.components) == -1) {
return null
}
return subQualifiedName(root.componentCount, componentCount)
}
/**
* Resolves qname of any symbol to appropriate PSI element.
* Shortcut for [getElementAndResolvableName]
* @see [getElementAndResolvableName]
*/
fun QualifiedName.resolveToElement(context: QNameResolveContext, stopOnFirstFail: Boolean = false): PsiElement? {
return getElementAndResolvableName(context, stopOnFirstFail)?.element
}
data class NameAndElement(val name: QualifiedName, val element: PsiElement)
/**
* Resolves qname of any symbol to PSI element popping tail until element becomes resolved or only one time if stopOnFirstFail
* @return element and longest name that was resolved successfully.
* @see [resolveToElement]
*/
fun QualifiedName.getElementAndResolvableName(context: QNameResolveContext, stopOnFirstFail: Boolean = false): NameAndElement? {
var currentName = QualifiedName.fromComponents(this.components)
var element: PsiElement? = null
var lastElement: String? = null
var psiDirectory: PsiDirectory? = null
var resolveContext = context.contextAnchor.qualifiedNameResolveContext?.copyWithMembers() ?: return null
if (PySdkUtil.getLanguageLevelForSdk(context.sdk).isPy3K || context.allowInaccurateResult) {
resolveContext = resolveContext.copyWithPlainDirectories()
}
if (context.folderToStart != null) {
psiDirectory = PsiManager.getInstance(context.contextAnchor.project).findDirectory(context.folderToStart)
}
// Drill as deep, as we can
while (currentName.componentCount > 0 && element == null) {
if (psiDirectory != null) { // Resolve against folder
// There could be folder and module on the same level. Empty folder should be ignored in this case.
element = resolveModuleAt(currentName, psiDirectory, resolveContext).filterNot {
it is PsiDirectory && it.children.filterIsInstance<PyFile>().isEmpty()
}.firstOrNull()
}
if (element == null) { // Resolve against roots
element = resolveQualifiedName(currentName, resolveContext).firstOrNull()
}
if (element != null || stopOnFirstFail) {
break
}
lastElement = currentName.lastComponent!!
currentName = currentName.removeLastComponent()
}
if (lastElement != null && element is PyClass) {
// Drill in class
//TODO: Support nested classes
val method = element.findMethodByName(lastElement, true, context.evalContext)
if (method != null) {
return NameAndElement(currentName.append(lastElement), method)
}
}
if (element == null && this.firstComponent != null && context.allowInaccurateResult) {
// If name starts with file which is not in root nor in folders -- use index.
val nameToFind = this.firstComponent!!
val pyFile = PyModuleNameIndex.find(nameToFind, context.contextAnchor.project, false).firstOrNull() ?: return element
val folder =
if (pyFile.name == PyNames.INIT_DOT_PY) { // We are in folder
pyFile.virtualFile.parent.parent
}
else {
pyFile.virtualFile.parent
}
return getElementAndResolvableName(context.copy(folderToStart = folder))
}
return if (element != null) NameAndElement(currentName, element) else null
}

View File

@@ -1,5 +1,5 @@
// Copyright 2000-2017 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.extensions
package com.jetbrains.python.extensions
import org.intellij.lang.regexp.psi.RegExpPattern
import java.util.regex.Pattern

View File

@@ -0,0 +1,21 @@
// 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.extensions.python
import com.jetbrains.python.nameResolver.FQNamesProvider
import com.jetbrains.python.nameResolver.NameResolverTools
import com.jetbrains.python.psi.PyAssignmentStatement
import com.jetbrains.python.psi.PyCallExpression
import com.jetbrains.python.psi.PyPossibleClassMember
/**
* Checks if ``foo = SomeExpr()`` where foo is class attribute
*/
val PyCallExpression.isClassAttribute: Boolean
get() =
(parent as? PyAssignmentStatement)?.targets?.filterIsInstance<PyPossibleClassMember>()?.any { it.containingClass != null } == true
/**
* Checks if callee has certain name. Only name is checked, so import aliases aren't supported, but it works pretty fast
*/
fun PyCallExpression.isCalleeName(vararg names: FQNamesProvider): Boolean = NameResolverTools.isCalleeShortCut(this, *names)

View File

@@ -18,12 +18,14 @@ package com.jetbrains.extensions
import com.intellij.psi.PsiFileSystemItem
import com.intellij.psi.util.QualifiedName
import com.jetbrains.python.psi.PyPsiFacade
import org.jetbrains.annotations.ApiStatus
/**
* @author Ilya.Kazakevich
* @deprecated moved to {@link com.jetbrains.python.extensions}
*/
fun PsiFileSystemItem.getQName(): QualifiedName? {
@ApiStatus.ScheduledForRemoval
@Deprecated(message = "Moved to com.jetbrains.python.extensions")
fun PsiFileSystemItem.getQName(): QualifiedName? {
val name = PyPsiFacade.getInstance(this.project).findShortestImportableName(this.virtualFile, this) ?: return null
return QualifiedName.fromDottedString(name)
}

View File

@@ -15,19 +15,14 @@
*/
package com.jetbrains.extensions.python
import com.jetbrains.python.extensions.isNameMatches
import com.jetbrains.python.nameResolver.FQNamesProvider
import com.jetbrains.python.extensions.inherits
import com.jetbrains.python.psi.PyClass
import com.jetbrains.python.psi.types.PyClassLikeType
import com.jetbrains.python.psi.types.TypeEvalContext
import org.jetbrains.annotations.ApiStatus
/**
* @author Ilya.Kazakevich
* @deprecated moved to {@link com.jetbrains.python.extensions}
*/
fun PyClass.inherits(evalContext: TypeEvalContext, parentNames: Set<String>): Boolean =
this.getAncestorTypes(evalContext).filterNotNull().mapNotNull(PyClassLikeType::getClassQName).any(parentNames::contains)
fun PyClass.inherits(evalContext: TypeEvalContext, vararg parentNames: String): Boolean = this.inherits(evalContext, parentNames.toHashSet())
fun PyClass.inherits(evalContext: TypeEvalContext?, parentNames: FQNamesProvider): Boolean =
this.getAncestorClasses(evalContext).any(parentNames::isNameMatches)
@ApiStatus.ScheduledForRemoval
@Deprecated(message = "Moved to com.jetbrains.python.extensions")
fun PyClass.inherits(evalContext: TypeEvalContext, vararg parentNames: String ): Boolean = inherits(evalContext, parentNames.toHashSet())

View File

@@ -4,7 +4,7 @@ package com.jetbrains.python.codeInsight.intentions
import com.intellij.openapi.editor.Editor
import com.intellij.openapi.project.Project
import com.intellij.psi.PsiFile
import com.jetbrains.extensions.getQName
import com.jetbrains.python.extensions.getQName
import com.jetbrains.python.psi.PyFile
/**

View File

@@ -3,7 +3,7 @@ package com.jetbrains.python.codeInsight.stdlib
import com.intellij.psi.PsiElement
import com.intellij.psi.util.QualifiedName
import com.jetbrains.extensions.getQName
import com.jetbrains.python.extensions.getQName
import com.jetbrains.python.PyNames
import com.jetbrains.python.codeInsight.PyCustomMember
import com.jetbrains.python.psi.PyFile

View File

@@ -0,0 +1,29 @@
/*
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jetbrains.python.extensions
import com.intellij.psi.PsiFileSystemItem
import com.intellij.psi.util.QualifiedName
import com.jetbrains.python.psi.PyPsiFacade
/**
* @author Ilya.Kazakevich
*/
fun PsiFileSystemItem.getQName(): QualifiedName? {
val name = PyPsiFacade.getInstance(this.project).findShortestImportableName(this.virtualFile, this) ?: return null
return QualifiedName.fromDottedString(name)
}

View File

@@ -0,0 +1,32 @@
/*
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jetbrains.python.extensions
import com.jetbrains.python.nameResolver.FQNamesProvider
import com.jetbrains.python.psi.PyClass
import com.jetbrains.python.psi.types.PyClassLikeType
import com.jetbrains.python.psi.types.TypeEvalContext
/**
* @author Ilya.Kazakevich
*/
fun PyClass.inherits(evalContext: TypeEvalContext, parentNames: Set<String>): Boolean =
this.getAncestorTypes(evalContext).filterNotNull().mapNotNull(PyClassLikeType::getClassQName).any(parentNames::contains)
fun PyClass.inherits(evalContext: TypeEvalContext, vararg parentNames: String): Boolean = this.inherits(evalContext, parentNames.toHashSet())
fun PyClass.inherits(evalContext: TypeEvalContext?, parentNames: FQNamesProvider): Boolean =
this.getAncestorClasses(evalContext).any(parentNames::isNameMatches)

View File

@@ -4,7 +4,7 @@ package com.jetbrains.python.testing
import com.intellij.psi.PsiDirectory
import com.intellij.psi.PsiElement
import com.intellij.util.Processor
import com.jetbrains.extensions.python.inherits
import com.jetbrains.python.extensions.inherits
import com.jetbrains.python.psi.PyClass
import com.jetbrains.python.psi.PyFile
import com.jetbrains.python.psi.PyFunction

View File

@@ -1,7 +1,7 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
@file:Suppress("ReplaceJavaStaticMethodWithKotlinAnalog")
package com.jetbrains
package com.jetbrains.python
import com.intellij.codeInsight.completion.CompletionResultSet
import com.intellij.codeInsight.lookup.LookupElement
@@ -31,15 +31,11 @@ import com.intellij.util.indexing.FindSymbolParameters
import com.intellij.util.indexing.IdFilter
import com.intellij.util.textCompletion.TextFieldWithCompletion
import com.intellij.util.ui.JBUI
import com.jetbrains.extensions.ContextAnchor
import com.jetbrains.extensions.QNameResolveContext
import com.jetbrains.extensions.getQName
import com.jetbrains.extensions.python.toPsi
import com.jetbrains.extensions.resolveToElement
import com.jetbrains.python.PyBundle
import com.jetbrains.python.PyGotoSymbolContributor
import com.jetbrains.python.PyNames
import com.jetbrains.python.PyTreeChooserDialog
import com.jetbrains.python.extensions.ContextAnchor
import com.jetbrains.python.extensions.QNameResolveContext
import com.jetbrains.python.extensions.getQName
import com.jetbrains.python.extensions.toPsi
import com.jetbrains.python.extensions.resolveToElement
import com.jetbrains.python.psi.PyFile
import com.jetbrains.python.psi.PyQualifiedNameOwner
import com.jetbrains.python.psi.PyTypedElement

View File

@@ -6,7 +6,7 @@ import com.intellij.codeInsight.template.postfix.templates.editable.PostfixTempl
import com.intellij.openapi.util.NlsSafe
import com.intellij.psi.util.PsiTreeUtil
import com.intellij.psi.util.QualifiedName
import com.jetbrains.extensions.python.inherits
import com.jetbrains.python.extensions.inherits
import com.jetbrains.python.PyBundle
import com.jetbrains.python.PyNames
import com.jetbrains.python.psi.*

View File

@@ -1,7 +1,5 @@
/*
* Copyright 2000-2017 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.extensions.python
// 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.extensions
import com.intellij.openapi.fileChooser.FileChooserDescriptor
import com.jetbrains.python.PyNames

View File

@@ -1,5 +1,5 @@
// Copyright 2000-2020 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.extensions.python
// 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.extensions
import com.intellij.openapi.progress.ProgressIndicator
import com.intellij.openapi.progress.ProgressManager

View File

@@ -1,5 +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.extensions.python
// 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.extensions
import com.jetbrains.python.FunctionParameter
import com.jetbrains.python.psi.PyFunction

View File

@@ -1,7 +1,7 @@
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
@file:JvmName("PythonProjectExt")
package com.jetbrains.extensions
package com.jetbrains.python.extensions
import com.intellij.openapi.project.Project
import com.intellij.openapi.project.modules

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jetbrains.extensions
package com.jetbrains.python.extensions
import com.intellij.openapi.util.registry.RegistryValue

View File

@@ -1,5 +1,5 @@
// Copyright 2000-2017 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.extensions
package com.jetbrains.python.extensions
import com.jetbrains.python.FunctionParameter
import com.jetbrains.python.psi.PyArgumentList

View File

@@ -1,5 +1,5 @@
// 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.extensions
// 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.extensions
import com.intellij.openapi.vfs.LocalFileSystem
import com.intellij.openapi.vfs.VirtualFile

View File

@@ -1,5 +1,5 @@
// Copyright 2000-2018 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.extensions.python
// 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.extensions
import com.intellij.openapi.project.Project
import com.intellij.openapi.vfs.VirtualFile

View File

@@ -0,0 +1,8 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
/**
* Extension methods for various classes.
* Methods are transparent for Kotlin, while in Java you must use following pattern: class MyClass has extensions in MyClassExtKt.
* @author Ilya.Kazakevich
*/
package com.jetbrains.python.extensions;

View File

@@ -6,7 +6,7 @@ import com.intellij.openapi.components.service
import com.intellij.openapi.diagnostic.thisLogger
import com.intellij.openapi.project.Project
import com.intellij.openapi.startup.ProjectActivity
import com.jetbrains.extensions.hasPython
import com.jetbrains.python.extensions.hasPython
import com.jetbrains.python.packaging.PyPIPackageRanking
import com.jetbrains.python.packaging.pip.PypiPackageCache
import kotlinx.coroutines.Dispatchers

View File

@@ -1,5 +1,5 @@
// Copyright 2000-2017 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.reflection
// 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.reflection
import java.beans.Introspector
import java.beans.PropertyDescriptor

View File

@@ -10,7 +10,7 @@ import com.intellij.openapi.vcs.checkin.CheckinEnvironment;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.util.ArrayUtilRt;
import com.intellij.vcsUtil.VcsUtil;
import com.jetbrains.extensions.ModuleExtKt;
import com.jetbrains.python.extensions.ModuleExtKt;
import org.jetbrains.annotations.NotNull;
import java.util.Arrays;

View File

@@ -17,12 +17,12 @@ import com.intellij.remote.RemoteSdkAdditionalData;
import com.intellij.remote.RemoteSdkProperties;
import com.intellij.util.PathMappingSettings;
import com.intellij.util.containers.ContainerUtil;
import com.jetbrains.extensions.python.ProgressManagerExtKt;
import com.jetbrains.python.PyBundle;
import com.jetbrains.python.PythonHelpersLocator;
import com.jetbrains.python.console.PyConsoleProcessHandler;
import com.jetbrains.python.console.PydevConsoleCommunication;
import com.jetbrains.python.console.PythonConsoleView;
import com.jetbrains.python.extensions.ProgressManagerExtKt;
import com.jetbrains.python.remote.PyRemotePathMapper.PyPathMappingType;
import kotlin.jvm.functions.Function0;
import org.jdom.Element;

View File

@@ -8,7 +8,7 @@ import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory
import com.intellij.openapi.ui.TextBrowseFolderListener
import com.intellij.openapi.vfs.LocalFileSystem
import com.intellij.openapi.vfs.VirtualFile
import com.jetbrains.extensions.python.withPythonFiles
import com.jetbrains.python.extensions.withPythonFiles
open class PyBrowseActionListener
@JvmOverloads

View File

@@ -11,7 +11,6 @@ import com.intellij.openapi.actionSystem.ex.ActionUtil
import com.intellij.openapi.actionSystem.impl.SimpleDataContext
import com.intellij.openapi.editor.Editor
import com.intellij.openapi.editor.EditorCustomElementRenderer
import com.intellij.openapi.editor.impl.EditorImpl
import com.intellij.openapi.project.DumbAwareAction
import com.intellij.openapi.project.Project
import com.intellij.openapi.ui.JBPopupMenu
@@ -19,7 +18,7 @@ import com.intellij.openapi.vfs.VirtualFile
import com.intellij.psi.search.FilenameIndex
import com.intellij.psi.search.GlobalSearchScope
import com.intellij.refactoring.actions.RenameElementAction
import com.jetbrains.extensions.python.toPsi
import com.jetbrains.python.extensions.toPsi
import com.jetbrains.python.PyBundle
import java.awt.Point
import java.awt.event.MouseEvent

View File

@@ -19,9 +19,9 @@ import com.intellij.ui.PanelWithAnchor;
import com.intellij.ui.UserActivityProviderComponent;
import com.intellij.ui.components.JBComboBoxLabel;
import com.intellij.util.containers.ContainerUtil;
import com.jetbrains.extensions.python.FileChooserDescriptorExtKt;
import com.jetbrains.python.PyBundle;
import com.jetbrains.python.debugger.PyDebuggerOptionsProvider;
import com.jetbrains.python.extensions.FileChooserDescriptorExtKt;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;

View File

@@ -11,10 +11,10 @@ import com.intellij.ui.RawCommandLineEditor
import com.intellij.ui.components.JBComboBoxLabel
import com.intellij.ui.dsl.builder.*
import com.intellij.ui.layout.selected
import com.jetbrains.PySymbolFieldWithBrowseButton
import com.jetbrains.extensions.ModuleBasedContextAnchor
import com.jetbrains.extensions.ProjectSdkContextAnchor
import com.jetbrains.isPythonModule
import com.jetbrains.python.PySymbolFieldWithBrowseButton
import com.jetbrains.python.extensions.ModuleBasedContextAnchor
import com.jetbrains.python.extensions.ProjectSdkContextAnchor
import com.jetbrains.python.isPythonModule
import com.jetbrains.python.PyBundle
import java.util.*
import javax.swing.ButtonGroup

View File

@@ -14,10 +14,10 @@ import com.intellij.openapi.vfs.LocalFileSystem
import com.intellij.psi.PsiFileSystemItem
import com.intellij.ui.TextAccessor
import com.intellij.ui.components.fields.ExtendableTextField
import com.jetbrains.PySymbolFieldWithBrowseButton
import com.jetbrains.extensions.ModuleBasedContextAnchor
import com.jetbrains.extensions.ProjectSdkContextAnchor
import com.jetbrains.isPythonModule
import com.jetbrains.python.PySymbolFieldWithBrowseButton
import com.jetbrains.python.extensions.ModuleBasedContextAnchor
import com.jetbrains.python.extensions.ProjectSdkContextAnchor
import com.jetbrains.python.isPythonModule
import com.jetbrains.python.PyBundle
import com.jetbrains.python.run.PythonRunConfiguration
import java.awt.GridBagConstraints

View File

@@ -8,9 +8,9 @@ import com.intellij.openapi.vfs.LocalFileSystem
import com.intellij.openapi.vfs.VirtualFile
import com.intellij.psi.PsiElement
import com.intellij.psi.util.QualifiedName
import com.jetbrains.extensions.ModuleBasedContextAnchor
import com.jetbrains.extensions.QNameResolveContext
import com.jetbrains.extensions.resolveToElement
import com.jetbrains.python.extensions.ModuleBasedContextAnchor
import com.jetbrains.python.extensions.QNameResolveContext
import com.jetbrains.python.extensions.resolveToElement
import com.jetbrains.python.psi.types.TypeEvalContext
import com.jetbrains.python.run.AbstractPythonRunConfiguration
import com.jetbrains.python.run.PythonRunConfigurationForm

View File

@@ -9,7 +9,7 @@ import com.intellij.psi.PsiElement
import com.intellij.psi.PsiFileSystemItem
import com.intellij.psi.PsiNamedElement
import com.intellij.psi.util.PsiTreeUtil
import com.jetbrains.extensions.getQName
import com.jetbrains.python.extensions.getQName
import com.jetbrains.python.psi.PyQualifiedNameOwner
import com.jetbrains.python.run.UndoRefactoringCompletionListener

View File

@@ -13,7 +13,7 @@ import com.intellij.openapi.actionSystem.AnAction
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.project.Project
import com.intellij.psi.PsiFile
import com.jetbrains.extensions.python.toPsi
import com.jetbrains.python.extensions.toPsi
import com.jetbrains.python.PyBundle
import com.jetbrains.python.packaging.PyExecutionException
import com.jetbrains.python.run.PythonRunConfigurationProducer

View File

@@ -1,19 +1,5 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jetbrains.serialization;
// 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.serialization;
import com.intellij.util.xmlb.Accessor;
import com.intellij.util.xmlb.SerializationFilterBase;

View File

@@ -1,19 +1,5 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jetbrains.serialization;
// 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.serialization;
import com.intellij.util.xmlb.Accessor;
import com.intellij.util.xmlb.SerializationFilter;

View File

@@ -7,7 +7,7 @@ import com.intellij.internal.statistic.eventLog.events.EventFields
import com.intellij.internal.statistic.service.fus.collectors.ProjectUsagesCollector
import com.intellij.openapi.progress.ProgressManager
import com.intellij.openapi.project.Project
import com.jetbrains.extensions.getSdk
import com.jetbrains.python.extensions.getSdk
import com.jetbrains.python.packaging.PyPIPackageCache
import com.jetbrains.python.packaging.PyPackageManager
import com.jetbrains.python.packaging.management.PythonPackageManager

View File

@@ -11,7 +11,7 @@ import com.intellij.openapi.module.Module
import com.intellij.openapi.module.ModuleManager
import com.intellij.openapi.project.Project
import com.intellij.openapi.projectRoots.Sdk
import com.jetbrains.extensions.getSdk
import com.jetbrains.python.extensions.getSdk
import com.jetbrains.python.PythonLanguage
import com.jetbrains.python.psi.LanguageLevel
import com.jetbrains.python.remote.PyRemoteSdkAdditionalDataBase

View File

@@ -20,10 +20,10 @@ import com.intellij.psi.PsiDirectory
import com.intellij.psi.PsiElement
import com.intellij.psi.PsiFile
import com.intellij.psi.util.QualifiedName
import com.jetbrains.extensions.QNameResolveContext
import com.jetbrains.extensions.getQName
import com.jetbrains.extensions.getRelativeNameTo
import com.jetbrains.extensions.resolveToElement
import com.jetbrains.python.extensions.QNameResolveContext
import com.jetbrains.python.extensions.getQName
import com.jetbrains.python.extensions.getRelativeNameTo
import com.jetbrains.python.extensions.resolveToElement
import com.jetbrains.python.PyNames
import com.jetbrains.python.psi.PyFile
import com.jetbrains.python.psi.PyQualifiedNameOwner

View File

@@ -32,17 +32,17 @@ import com.intellij.ui.components.JBTextField;
import com.intellij.uiDesigner.core.GridConstraints;
import com.intellij.util.ThreeState;
import com.intellij.util.ui.JBUI;
import com.jetbrains.PySymbolFieldWithBrowseButton;
import com.jetbrains.extensions.ContextAnchor;
import com.jetbrains.extensions.ModuleBasedContextAnchor;
import com.jetbrains.extensions.ProjectSdkContextAnchor;
import com.jetbrains.python.PySymbolFieldWithBrowseButton;
import com.jetbrains.python.extensions.ContextAnchor;
import com.jetbrains.python.extensions.ModuleBasedContextAnchor;
import com.jetbrains.python.extensions.ProjectSdkContextAnchor;
import com.jetbrains.python.psi.types.TypeEvalContext;
import com.jetbrains.python.reflection.ReflectionUtilsKt;
import com.jetbrains.python.run.AbstractPyCommonOptionsForm;
import com.jetbrains.python.run.PyBrowseActionListener;
import com.jetbrains.python.run.PyCommonOptionsFormFactory;
import com.jetbrains.python.run.targetBasedConfiguration.PyRunTargetVariant;
import com.jetbrains.reflection.ReflectionUtilsKt;
import com.jetbrains.reflection.SimplePropertiesProvider;
import com.jetbrains.python.reflection.SimplePropertiesProvider;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

View File

@@ -40,8 +40,8 @@ import com.intellij.refactoring.listeners.RefactoringElementListener
import com.intellij.remote.PathMappingProvider
import com.intellij.remote.RemoteSdkAdditionalData
import com.intellij.util.ThreeState
import com.jetbrains.extensions.*
import com.jetbrains.python.PyBundle
import com.jetbrains.python.extensions.*
import com.jetbrains.python.packaging.PyPackageManager
import com.jetbrains.python.psi.PyFile
import com.jetbrains.python.psi.PyFunction
@@ -53,10 +53,10 @@ import com.jetbrains.python.run.targetBasedConfiguration.TargetWithVariant
import com.jetbrains.python.run.targetBasedConfiguration.createRefactoringListenerIfPossible
import com.jetbrains.python.run.targetBasedConfiguration.targetAsPsiElement
import com.jetbrains.python.sdk.PythonSdkUtil
import com.jetbrains.reflection.DelegationProperty
import com.jetbrains.reflection.Properties
import com.jetbrains.reflection.Property
import com.jetbrains.reflection.getProperties
import com.jetbrains.python.reflection.DelegationProperty
import com.jetbrains.python.reflection.Properties
import com.jetbrains.python.reflection.Property
import com.jetbrains.python.reflection.getProperties
import jetbrains.buildServer.messages.serviceMessages.ServiceMessage
import jetbrains.buildServer.messages.serviceMessages.TestStdErr
import jetbrains.buildServer.messages.serviceMessages.TestStdOut

View File

@@ -11,7 +11,7 @@ import com.intellij.util.xmlb.BeanBinding
import com.jetbrains.python.testing.PyAbstractTestConfiguration
import com.jetbrains.python.testing.PyAbstractTestSettingsEditor
import com.jetbrains.python.testing.PyTestSharedForm
import com.jetbrains.reflection.getProperties
import com.jetbrains.python.reflection.getProperties
class PyAutoDetectTestConfiguration(project: Project, factory: PyAutoDetectionConfigurationFactory)
: PyAbstractTestConfiguration(project, factory) {

View File

@@ -11,7 +11,7 @@ import com.intellij.psi.util.PsiTreeUtil
import com.intellij.util.PathUtil
import com.intellij.util.Processor
import com.intellij.util.ThreeState
import com.jetbrains.extensions.getSdk
import com.jetbrains.python.extensions.getSdk
import com.jetbrains.python.psi.*
import com.jetbrains.python.psi.impl.getNamedArgument
import com.jetbrains.python.psi.stubs.PyDecoratorStubIndex

View File

@@ -18,8 +18,8 @@ import com.intellij.util.xmlb.SkipEmptySerializationFilter;
import com.intellij.util.xmlb.XmlSerializer;
import com.intellij.util.xmlb.annotations.Tag;
import com.jetbrains.python.testing.AbstractPythonTestRunConfiguration;
import com.jetbrains.serialization.AnnotationSerializationFilter;
import com.jetbrains.serialization.CompoundFilter;
import com.jetbrains.python.serialization.AnnotationSerializationFilter;
import com.jetbrains.python.serialization.CompoundFilter;
import org.jdom.Element;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

View File

@@ -27,10 +27,10 @@ import com.intellij.testFramework.fixtures.impl.ModuleFixtureBuilderImpl;
import com.intellij.testFramework.fixtures.impl.ModuleFixtureImpl;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.ui.UIUtil;
import com.jetbrains.extensions.ModuleExtKt;
import com.jetbrains.python.PyNames;
import com.jetbrains.python.PythonModuleTypeBase;
import com.jetbrains.python.PythonTestUtil;
import com.jetbrains.python.extensions.ModuleExtKt;
import com.jetbrains.python.packaging.PyCondaPackageManagerImpl;
import com.jetbrains.python.packaging.PyPackageManager;
import com.jetbrains.python.psi.LanguageLevel;

View File

@@ -31,7 +31,7 @@ import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.testFramework.EdtTestUtil;
import com.intellij.testFramework.common.ThreadLeakTracker;
import com.intellij.xdebugger.XDebuggerTestUtil;
import com.jetbrains.extensions.ModuleExtKt;
import com.jetbrains.python.extensions.ModuleExtKt;
import com.jetbrains.python.tools.sdkTools.SdkCreationType;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

View File

@@ -18,7 +18,7 @@ package com.jetbrains.env.python.testing;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.*;
import com.jetbrains.extensions.TargetWithVariantExtKt;
import com.jetbrains.python.extensions.TargetWithVariantExtKt;
import com.jetbrains.python.psi.PyClass;
import com.jetbrains.python.psi.PyFile;
import com.jetbrains.python.psi.PyFunction;