, PyNamedElementContainer, PyStatementPart {
PyExceptPart[] EMPTY_ARRAY = new PyExceptPart[0];
@Override
diff --git a/python/python-psi-api/src/com/jetbrains/python/psi/PyForPart.java b/python/python-psi-api/src/com/jetbrains/python/psi/PyForPart.java
index 60c159743c74..e2b3ed127dcc 100644
--- a/python/python-psi-api/src/com/jetbrains/python/psi/PyForPart.java
+++ b/python/python-psi-api/src/com/jetbrains/python/psi/PyForPart.java
@@ -23,5 +23,4 @@ public interface PyForPart extends PyAstForPart, PyStatementPart {
default @Nullable PyExpression getSource() {
return (PyExpression)PyAstForPart.super.getSource();
}
-
}
diff --git a/python/python-psi-api/src/com/jetbrains/python/psi/PyFormattedStringElement.java b/python/python-psi-api/src/com/jetbrains/python/psi/PyFormattedStringElement.java
index 7ce70a61e08b..239f22801247 100644
--- a/python/python-psi-api/src/com/jetbrains/python/psi/PyFormattedStringElement.java
+++ b/python/python-psi-api/src/com/jetbrains/python/psi/PyFormattedStringElement.java
@@ -8,10 +8,10 @@ import java.util.List;
/**
* Represents an f-string, a special kind of interpolated string literal introduced in Python 3.6.
- *
+ *
* Unlike {@link PyPlainStringElement} these elements are composite and consist of several kinds of tokens
* and normal PSI trees for embedded expressions.
- *
+ *
* @see com.jetbrains.python.PyTokenTypes#FSTRING_START
* @see com.jetbrains.python.PyTokenTypes#FSTRING_TEXT
* @see PyFStringFragment
diff --git a/python/python-psi-api/src/com/jetbrains/python/psi/PyFromImportStatement.java b/python/python-psi-api/src/com/jetbrains/python/psi/PyFromImportStatement.java
index b52799fb44e1..426702b51afc 100644
--- a/python/python-psi-api/src/com/jetbrains/python/psi/PyFromImportStatement.java
+++ b/python/python-psi-api/src/com/jetbrains/python/psi/PyFromImportStatement.java
@@ -14,10 +14,12 @@ import java.util.List;
/**
* Describes "from ... import" statements.
*/
-public interface PyFromImportStatement extends PyAstFromImportStatement, PyImportStatementBase, StubBasedPsiElement,
- PyImplicitImportNameDefiner {
+public interface PyFromImportStatement
+ extends PyAstFromImportStatement, PyImportStatementBase, StubBasedPsiElement,
+ PyImplicitImportNameDefiner {
/**
* Returns a reference the module from which import is required.
+ *
* @return reference to module. If the 'from' reference is relative and consists entirely of dots, null is returned.
*/
@Override
diff --git a/python/python-psi-api/src/com/jetbrains/python/psi/PyFunction.java b/python/python-psi-api/src/com/jetbrains/python/psi/PyFunction.java
index 2eec81d318b1..abfb1f4a854d 100644
--- a/python/python-psi-api/src/com/jetbrains/python/psi/PyFunction.java
+++ b/python/python-psi-api/src/com/jetbrains/python/psi/PyFunction.java
@@ -41,9 +41,9 @@ public interface PyFunction extends PyAstFunction, StubBasedPsiElementreturn statements (including implicit returns) and yield expression.
- * In contrast with {@link TypeEvalContext#getReturnType(PyCallable)} does not consider
+ * In contrast with {@link TypeEvalContext#getReturnType(PyCallable)} does not consider
* return type annotations or any other {@link PyTypeProvider}.
- *
+ *
* @apiNote Does not cache the result.
*/
@ApiStatus.Internal
@@ -55,8 +55,8 @@ public interface PyFunction extends PyAstFunction, StubBasedPsiElementPEP-0232
+ *
* @return assignment statements for function attributes
*/
@NotNull
diff --git a/python/python-psi-api/src/com/jetbrains/python/psi/PyImportStatement.java b/python/python-psi-api/src/com/jetbrains/python/psi/PyImportStatement.java
index ad9b0d1bf325..72e2f35bb763 100644
--- a/python/python-psi-api/src/com/jetbrains/python/psi/PyImportStatement.java
+++ b/python/python-psi-api/src/com/jetbrains/python/psi/PyImportStatement.java
@@ -6,5 +6,6 @@ import com.jetbrains.python.ast.PyAstImportStatement;
import com.jetbrains.python.psi.stubs.PyImportStatementStub;
-public interface PyImportStatement extends PyAstImportStatement, PyImportStatementBase, StubBasedPsiElement, PyImplicitImportNameDefiner {
+public interface PyImportStatement
+ extends PyAstImportStatement, PyImportStatementBase, StubBasedPsiElement, PyImplicitImportNameDefiner {
}
diff --git a/python/python-psi-api/src/com/jetbrains/python/psi/PyKeyValueExpression.java b/python/python-psi-api/src/com/jetbrains/python/psi/PyKeyValueExpression.java
index e8f6b4fb7afd..309213c6a211 100644
--- a/python/python-psi-api/src/com/jetbrains/python/psi/PyKeyValueExpression.java
+++ b/python/python-psi-api/src/com/jetbrains/python/psi/PyKeyValueExpression.java
@@ -7,7 +7,7 @@ import org.jetbrains.annotations.Nullable;
public interface PyKeyValueExpression extends PyAstKeyValueExpression, PyExpression {
- PyKeyValueExpression[] EMPTY_ARRAY = new PyKeyValueExpression[0];
+ PyKeyValueExpression[] EMPTY_ARRAY = new PyKeyValueExpression[0];
@Override
default @NotNull PyExpression getKey() {
diff --git a/python/python-psi-api/src/com/jetbrains/python/psi/PyNamedParameter.java b/python/python-psi-api/src/com/jetbrains/python/psi/PyNamedParameter.java
index cd0ee242f74b..66e1288a615e 100644
--- a/python/python-psi-api/src/com/jetbrains/python/psi/PyNamedParameter.java
+++ b/python/python-psi-api/src/com/jetbrains/python/psi/PyNamedParameter.java
@@ -15,8 +15,9 @@ import org.jetbrains.annotations.Nullable;
/**
* Represents a named parameter, as opposed to a tuple parameter.
*/
-public interface PyNamedParameter extends PyAstNamedParameter, PyParameter, PsiNamedElement, PsiNameIdentifierOwner, PyExpression, PyTypeCommentOwner,
- PyAnnotationOwner, StubBasedPsiElement {
+public interface PyNamedParameter
+ extends PyAstNamedParameter, PyParameter, PsiNamedElement, PsiNameIdentifierOwner, PyExpression, PyTypeCommentOwner,
+ PyAnnotationOwner, StubBasedPsiElement {
@Override
default @Nullable PyExpression getDefaultValue() {
diff --git a/python/python-psi-api/src/com/jetbrains/python/psi/PyPsiFacade.java b/python/python-psi-api/src/com/jetbrains/python/psi/PyPsiFacade.java
index 3170339f98ba..163103d8eab5 100644
--- a/python/python-psi-api/src/com/jetbrains/python/psi/PyPsiFacade.java
+++ b/python/python-psi-api/src/com/jetbrains/python/psi/PyPsiFacade.java
@@ -20,7 +20,8 @@ public abstract class PyPsiFacade {
return project.getService(PyPsiFacade.class);
}
- public abstract @NotNull List resolveQualifiedName(@NotNull QualifiedName name, @NotNull PyQualifiedNameResolveContext context);
+ public abstract @NotNull List resolveQualifiedName(@NotNull QualifiedName name,
+ @NotNull PyQualifiedNameResolveContext context);
public abstract @NotNull PyQualifiedNameResolveContext createResolveContextFromFoothold(@NotNull PsiElement foothold);
diff --git a/python/python-psi-api/src/com/jetbrains/python/psi/PyQualifiedNameOwner.java b/python/python-psi-api/src/com/jetbrains/python/psi/PyQualifiedNameOwner.java
index f4e61dca1251..dc36e5199e50 100644
--- a/python/python-psi-api/src/com/jetbrains/python/psi/PyQualifiedNameOwner.java
+++ b/python/python-psi-api/src/com/jetbrains/python/psi/PyQualifiedNameOwner.java
@@ -16,5 +16,6 @@ public interface PyQualifiedNameOwner extends PyAstQualifiedNameOwner, PyElement
* is contained inside an element that doesn't have a qualified name.
*/
@Nullable
- @NlsSafe String getQualifiedName();
+ @NlsSafe
+ String getQualifiedName();
}
diff --git a/python/python-psi-api/src/com/jetbrains/python/psi/PyReferenceExpression.java b/python/python-psi-api/src/com/jetbrains/python/psi/PyReferenceExpression.java
index f7b1c961862e..49d1f18c7740 100644
--- a/python/python-psi-api/src/com/jetbrains/python/psi/PyReferenceExpression.java
+++ b/python/python-psi-api/src/com/jetbrains/python/psi/PyReferenceExpression.java
@@ -43,7 +43,7 @@ public interface PyReferenceExpression extends PyAstReferenceExpression, PyQuali
* Note: the returned list does not contain null values.
*/
default @NotNull List multiFollowAssignmentsChain(@NotNull PyResolveContext resolveContext) {
- return multiFollowAssignmentsChain(resolveContext, __->true);
+ return multiFollowAssignmentsChain(resolveContext, __ -> true);
}
/**
@@ -51,7 +51,7 @@ public interface PyReferenceExpression extends PyAstReferenceExpression, PyQuali
* Starts at this, expecting it to resolve to a target of an assignment.
*
* @param resolveContext resolve context
- * @param follow predicate to test if target should be followed
+ * @param follow predicate to test if target should be followed
* @return the values that could be assigned to this element via a chain of assignments, or an empty list.
* Note: the returned list does not contain null values.
*/
diff --git a/python/python-psi-api/src/com/jetbrains/python/psi/PySequencePattern.kt b/python/python-psi-api/src/com/jetbrains/python/psi/PySequencePattern.kt
index b5b0420dd514..0228670eb2ef 100644
--- a/python/python-psi-api/src/com/jetbrains/python/psi/PySequencePattern.kt
+++ b/python/python-psi-api/src/com/jetbrains/python/psi/PySequencePattern.kt
@@ -5,6 +5,6 @@ import com.jetbrains.python.ast.PyAstSequencePattern
import com.jetbrains.python.ast.findChildrenByClass
interface PySequencePattern : PyAstSequencePattern, PyPattern {
- val elements: List
+ val elements: List
get() = findChildrenByClass(PyPattern::class.java).toList()
}
diff --git a/python/python-psi-api/src/com/jetbrains/python/psi/PyStarImportElement.java b/python/python-psi-api/src/com/jetbrains/python/psi/PyStarImportElement.java
index b807b5864bef..baac4cf8b547 100644
--- a/python/python-psi-api/src/com/jetbrains/python/psi/PyStarImportElement.java
+++ b/python/python-psi-api/src/com/jetbrains/python/psi/PyStarImportElement.java
@@ -22,5 +22,6 @@ import com.jetbrains.python.psi.stubs.PyStarImportElementStub;
/**
* Marks the star in "from foo import *".
*/
-public interface PyStarImportElement extends PyAstStarImportElement, PyImplicitImportNameDefiner, StubBasedPsiElement {
+public interface PyStarImportElement
+ extends PyAstStarImportElement, PyImplicitImportNameDefiner, StubBasedPsiElement {
}
diff --git a/python/python-psi-api/src/com/jetbrains/python/psi/PyStatement.java b/python/python-psi-api/src/com/jetbrains/python/psi/PyStatement.java
index 325b7c82aa04..577005be40f9 100644
--- a/python/python-psi-api/src/com/jetbrains/python/psi/PyStatement.java
+++ b/python/python-psi-api/src/com/jetbrains/python/psi/PyStatement.java
@@ -21,5 +21,5 @@ import com.jetbrains.python.ast.PyAstStatement;
* Everything that may be an element of a statement list.
*/
public interface PyStatement extends PyAstStatement, PyElement {
- PyStatement[] EMPTY_ARRAY = new PyStatement[0];
+ PyStatement[] EMPTY_ARRAY = new PyStatement[0];
}
diff --git a/python/python-psi-api/src/com/jetbrains/python/psi/PyStringLiteralExpression.java b/python/python-psi-api/src/com/jetbrains/python/psi/PyStringLiteralExpression.java
index 41998ca7dbb9..6a231b6e4ce9 100644
--- a/python/python-psi-api/src/com/jetbrains/python/psi/PyStringLiteralExpression.java
+++ b/python/python-psi-api/src/com/jetbrains/python/psi/PyStringLiteralExpression.java
@@ -10,7 +10,7 @@ import java.util.List;
/**
* A string literal expression can consist of a number of implicitly concatenated string literals
- * each with its own set of quotes and prefixes. For instance, the following string literal expression
+ * each with its own set of quotes and prefixes. For instance, the following string literal expression
* in the right hand side of the assignment:
*
*
@@ -27,13 +27,14 @@ import java.util.List;
* decoded value, etc.
*
* @see
- * https://docs.python.org/3/reference/lexical_analysis.html#string-literal-concatenation
+ * https://docs.python.org/3/reference/lexical_analysis.html#string-literal-concatenation
* @see #getStringElements()
* @see PyStringElement
* @see PyPlainStringElement
* @see PyFormattedStringElement
*/
-public interface PyStringLiteralExpression extends PyAstStringLiteralExpression, PyLiteralExpression, StringLiteralExpression, PsiLanguageInjectionHost {
+public interface PyStringLiteralExpression
+ extends PyAstStringLiteralExpression, PyLiteralExpression, StringLiteralExpression, PsiLanguageInjectionHost {
/**
* Returns a list of implicitly concatenated string elements composing this literal expression.
*/
diff --git a/python/python-psi-api/src/com/jetbrains/python/psi/PySubscriptionExpression.java b/python/python-psi-api/src/com/jetbrains/python/psi/PySubscriptionExpression.java
index 2dcf01f7a2a9..b25149175243 100644
--- a/python/python-psi-api/src/com/jetbrains/python/psi/PySubscriptionExpression.java
+++ b/python/python-psi-api/src/com/jetbrains/python/psi/PySubscriptionExpression.java
@@ -6,7 +6,8 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-public interface PySubscriptionExpression extends PyAstSubscriptionExpression, PyQualifiedExpression, PyCallSiteExpression, PyReferenceOwner {
+public interface PySubscriptionExpression
+ extends PyAstSubscriptionExpression, PyQualifiedExpression, PyCallSiteExpression, PyReferenceOwner {
/**
* @return For {@code spam[x][y][n]} will return {@code spam} regardless number of its dimensions
diff --git a/python/python-psi-api/src/com/jetbrains/python/psi/PyTypeAliasStatement.java b/python/python-psi-api/src/com/jetbrains/python/psi/PyTypeAliasStatement.java
index 48a2ff4d2d9c..7c6c987429b7 100644
--- a/python/python-psi-api/src/com/jetbrains/python/psi/PyTypeAliasStatement.java
+++ b/python/python-psi-api/src/com/jetbrains/python/psi/PyTypeAliasStatement.java
@@ -11,8 +11,9 @@ import org.jetbrains.annotations.Nullable;
/**
* Represents Type Alias Statement added in PEP 695
*/
-public interface PyTypeAliasStatement extends PyAstTypeAliasStatement, PyStatement, PsiNameIdentifierOwner, PyTypeParameterListOwner, PyTypedElement,
- StubBasedPsiElement, PyQualifiedNameOwner, ScopeOwner {
+public interface PyTypeAliasStatement
+ extends PyAstTypeAliasStatement, PyStatement, PsiNameIdentifierOwner, PyTypeParameterListOwner, PyTypedElement,
+ StubBasedPsiElement, PyQualifiedNameOwner, ScopeOwner {
@Override
default @Nullable PyExpression getTypeExpression() {
diff --git a/python/python-psi-api/src/com/jetbrains/python/psi/PyTypeParameter.java b/python/python-psi-api/src/com/jetbrains/python/psi/PyTypeParameter.java
index 011115cf2261..cb6f9fd7cf23 100644
--- a/python/python-psi-api/src/com/jetbrains/python/psi/PyTypeParameter.java
+++ b/python/python-psi-api/src/com/jetbrains/python/psi/PyTypeParameter.java
@@ -11,7 +11,8 @@ import org.jetbrains.annotations.Nullable;
* Represents a Type Parameter that can be a part of {@link PyTypeParameterList}
* For more information see PEP 695
*/
-public interface PyTypeParameter extends PyAstTypeParameter, PyElement, PsiNameIdentifierOwner, PyTypedElement, PyQualifiedNameOwner, StubBasedPsiElement {
+public interface PyTypeParameter extends PyAstTypeParameter, PyElement, PsiNameIdentifierOwner, PyTypedElement, PyQualifiedNameOwner,
+ StubBasedPsiElement {
@Override
default @Nullable PyExpression getBoundExpression() {
diff --git a/python/python-psi-api/src/com/jetbrains/python/psi/impl/PyPsiUtils.java b/python/python-psi-api/src/com/jetbrains/python/psi/impl/PyPsiUtils.java
index 0d0c2a3b58bf..b309d10ca73f 100644
--- a/python/python-psi-api/src/com/jetbrains/python/psi/impl/PyPsiUtils.java
+++ b/python/python-psi-api/src/com/jetbrains/python/psi/impl/PyPsiUtils.java
@@ -59,6 +59,7 @@ public final class PyPsiUtils {
/**
* Finds first sibling that is neither comment, nor whitespace before given element.
+ *
* @param strict prohibit returning element itself
*/
public static @Nullable PsiElement getPrevNonCommentSibling(@Nullable PsiElement start, boolean strict) {
@@ -109,6 +110,7 @@ public final class PyPsiUtils {
/**
* Finds first sibling that is neither comment, nor whitespace after given element.
+ *
* @param strict prohibit returning element itself
*/
public static @Nullable PsiElement getNextNonCommentSibling(@Nullable PsiElement start, boolean strict) {
@@ -117,6 +119,7 @@ public final class PyPsiUtils {
/**
* Finds first token after given element that doesn't consist solely of spaces and is not empty (e.g. error marker).
+ *
* @param ignoreComments ignore commentaries as well
*/
public static @Nullable PsiElement getNextSignificantLeaf(@Nullable PsiElement element, boolean ignoreComments) {
@@ -128,6 +131,7 @@ public final class PyPsiUtils {
/**
* Finds first token before given element that doesn't consist solely of spaces and is not empty (e.g. error marker).
+ *
* @param ignoreComments ignore commentaries as well
*/
public static @Nullable PsiElement getPrevSignificantLeaf(@Nullable PsiElement element, boolean ignoreComments) {
@@ -261,7 +265,8 @@ public final class PyPsiUtils {
public static boolean isMethodContext(final PsiElement element) {
final PsiNamedElement parent = PsiTreeUtil.getParentOfType(element, PyFile.class, PyFunction.class, PyClass.class);
// In case if element is inside method which is inside class
- if (parent instanceof PyFunction && PsiTreeUtil.getParentOfType(parent, PyFile.class, PyFunction.class, PyClass.class) instanceof PyClass) {
+ if (parent instanceof PyFunction &&
+ PsiTreeUtil.getParentOfType(parent, PyFile.class, PyFunction.class, PyClass.class) instanceof PyClass) {
return true;
}
return false;
@@ -302,6 +307,7 @@ public final class PyPsiUtils {
/**
* Returns comments preceding given elements as pair of the first and the last such comments. Comments should not be
* separated by any empty line.
+ *
* @param element element comments should be adjacent to
* @return described range or {@code null} if there are no such comments
*/
@@ -348,7 +354,7 @@ public final class PyPsiUtils {
* def func():
* pass
* }
- *
+ *
* Note that in the following case it will additionally return an empty list of comments as the last element
* to distinguish between the cases when there is a blank line above the provided element and when there is not.
*
diff --git a/python/python-psi-api/src/com/jetbrains/python/psi/resolve/PyQualifiedNameResolveContext.java b/python/python-psi-api/src/com/jetbrains/python/psi/resolve/PyQualifiedNameResolveContext.java
index a40b0bbde759..21f20cc547a4 100644
--- a/python/python-psi-api/src/com/jetbrains/python/psi/resolve/PyQualifiedNameResolveContext.java
+++ b/python/python-psi-api/src/com/jetbrains/python/psi/resolve/PyQualifiedNameResolveContext.java
@@ -32,42 +32,62 @@ import org.jetbrains.annotations.Nullable;
public interface PyQualifiedNameResolveContext {
@Nullable
PsiElement getFoothold();
+
int getRelativeLevel();
+
@Nullable
Sdk getSdk();
+
@Nullable
Module getModule();
+
@NotNull
Project getProject();
+
boolean getWithoutRoots();
+
boolean getWithoutForeign();
+
boolean getWithoutStubs();
+
@NotNull
PsiManager getPsiManager();
+
boolean getWithMembers();
+
boolean getWithPlainDirectories();
+
boolean getVisitAllModules();
+
@Nullable
Sdk getEffectiveSdk();
boolean isValid();
+
@Nullable
PsiFile getFootholdFile();
+
@Nullable
PsiDirectory getContainingDirectory();
@NotNull
PyQualifiedNameResolveContext copyWithoutForeign();
+
@NotNull
PyQualifiedNameResolveContext copyWithMembers();
+
@NotNull
PyQualifiedNameResolveContext copyWithPlainDirectories();
+
@NotNull
PyQualifiedNameResolveContext copyWithRelative(int relativeLevel);
+
@NotNull
PyQualifiedNameResolveContext copyWithoutRoots();
+
@NotNull
PyQualifiedNameResolveContext copyWithRoots();
+
@NotNull
PyQualifiedNameResolveContext copyWithoutStubs();
}
\ No newline at end of file
diff --git a/python/python-psi-api/src/com/jetbrains/python/psi/stubs/PyFileStub.java b/python/python-psi-api/src/com/jetbrains/python/psi/stubs/PyFileStub.java
index aadbb82d1990..090797ff4a71 100644
--- a/python/python-psi-api/src/com/jetbrains/python/psi/stubs/PyFileStub.java
+++ b/python/python-psi-api/src/com/jetbrains/python/psi/stubs/PyFileStub.java
@@ -10,6 +10,8 @@ import java.util.List;
public interface PyFileStub extends PsiFileStub {
List getDunderAll();
+
BitSet getFutureFeatures();
+
String getDeprecationMessage();
}
diff --git a/python/python-psi-api/src/com/jetbrains/python/psi/stubs/PyFunctionStub.java b/python/python-psi-api/src/com/jetbrains/python/psi/stubs/PyFunctionStub.java
index c98429479c27..87d2c5f1e90f 100644
--- a/python/python-psi-api/src/com/jetbrains/python/psi/stubs/PyFunctionStub.java
+++ b/python/python-psi-api/src/com/jetbrains/python/psi/stubs/PyFunctionStub.java
@@ -6,9 +6,13 @@ import com.jetbrains.python.psi.PyFunction;
public interface PyFunctionStub extends NamedStub, PyAnnotationOwnerStub, PyTypeCommentOwnerStub, PyVersionSpecificStub {
String getDocString();
+
String getDeprecationMessage();
+
boolean isAsync();
+
boolean isGenerator();
+
default boolean onlyRaisesNotImplementedError() {
return false;
}
diff --git a/python/python-psi-api/src/com/jetbrains/python/psi/stubs/PyImportElementStub.java b/python/python-psi-api/src/com/jetbrains/python/psi/stubs/PyImportElementStub.java
index aa0f5c578906..1f7c67397896 100644
--- a/python/python-psi-api/src/com/jetbrains/python/psi/stubs/PyImportElementStub.java
+++ b/python/python-psi-api/src/com/jetbrains/python/psi/stubs/PyImportElementStub.java
@@ -2,14 +2,14 @@
package com.jetbrains.python.psi.stubs;
import com.intellij.psi.stubs.StubElement;
-import com.jetbrains.python.psi.PyImportElement;
import com.intellij.psi.util.QualifiedName;
+import com.jetbrains.python.psi.PyImportElement;
import org.jetbrains.annotations.Nullable;
public interface PyImportElementStub extends StubElement {
@Nullable
QualifiedName getImportedQName();
-
+
String getAsName();
}
diff --git a/python/python-psi-api/src/com/jetbrains/python/psi/stubs/PyNamedParameterStub.java b/python/python-psi-api/src/com/jetbrains/python/psi/stubs/PyNamedParameterStub.java
index 631c84a0fd51..d386d42156a4 100644
--- a/python/python-psi-api/src/com/jetbrains/python/psi/stubs/PyNamedParameterStub.java
+++ b/python/python-psi-api/src/com/jetbrains/python/psi/stubs/PyNamedParameterStub.java
@@ -7,6 +7,7 @@ import org.jetbrains.annotations.Nullable;
public interface PyNamedParameterStub extends NamedStub, PyAnnotationOwnerStub, PyTypeCommentOwnerStub {
boolean isPositionalContainer();
+
boolean isKeywordContainer();
default @Nullable String getDefaultValueText() {
diff --git a/python/python-psi-api/src/com/jetbrains/python/psi/types/PyCallableParameter.java b/python/python-psi-api/src/com/jetbrains/python/psi/types/PyCallableParameter.java
index 8c15dff9b259..6f802c5be754 100644
--- a/python/python-psi-api/src/com/jetbrains/python/psi/types/PyCallableParameter.java
+++ b/python/python-psi-api/src/com/jetbrains/python/psi/types/PyCallableParameter.java
@@ -18,7 +18,8 @@ public interface PyCallableParameter {
* Returns null if the parameter is tuple or star, or name is unknown.
*/
@Nullable
- @Nls String getName();
+ @Nls
+ String getName();
/**
* @param context type evaluation context
diff --git a/python/python-psi-api/src/com/jetbrains/python/psi/types/PyClassLikeType.java b/python/python-psi-api/src/com/jetbrains/python/psi/types/PyClassLikeType.java
index ce1b026a92f4..242fb6f3e849 100644
--- a/python/python-psi-api/src/com/jetbrains/python/psi/types/PyClassLikeType.java
+++ b/python/python-psi-api/src/com/jetbrains/python/psi/types/PyClassLikeType.java
@@ -32,6 +32,7 @@ public interface PyClassLikeType extends PyCallableType, PyWithAncestors, PyInst
boolean inherited);
// TODO: Pull to PyType at next iteration
+
/**
* Visits all class members. This method is better then bare class since it uses type info and supports not only classes but
* class-like structures as well. Consider using user-friendly wrapper {@link PyTypeUtil#getMembersOfType(PyClassLikeType, Class, boolean, TypeEvalContext)}
diff --git a/python/python-psi-api/src/com/jetbrains/python/psi/types/PyClassMembersProviderBase.java b/python/python-psi-api/src/com/jetbrains/python/psi/types/PyClassMembersProviderBase.java
index e49fe681550e..724056469c89 100644
--- a/python/python-psi-api/src/com/jetbrains/python/psi/types/PyClassMembersProviderBase.java
+++ b/python/python-psi-api/src/com/jetbrains/python/psi/types/PyClassMembersProviderBase.java
@@ -39,9 +39,9 @@ public class PyClassMembersProviderBase implements PyClassMembersProvider {
* @return found member or null
*/
public static @Nullable PsiElement resolveMemberByName(@NotNull Collection extends PyCustomMember> members,
- @NotNull String name,
- @NotNull PsiElement context,
- @NotNull PyResolveContext resolveContext) {
+ @NotNull String name,
+ @NotNull PsiElement context,
+ @NotNull PyResolveContext resolveContext) {
for (PyCustomMember member : members) {
if (member.getName().equals(name)) {
return member.resolve(context, resolveContext);
diff --git a/python/python-psi-api/src/com/jetbrains/python/psi/types/PyInstantiableType.java b/python/python-psi-api/src/com/jetbrains/python/psi/types/PyInstantiableType.java
index 9bb670c7c606..eb329ef7ef18 100644
--- a/python/python-psi-api/src/com/jetbrains/python/psi/types/PyInstantiableType.java
+++ b/python/python-psi-api/src/com/jetbrains/python/psi/types/PyInstantiableType.java
@@ -18,8 +18,8 @@ package com.jetbrains.python.psi.types;
import org.jetbrains.annotations.NotNull;
/**
- * A type that can describe either particular instantiated instance of a class or a class itself.
- *
+ * A type that can describe either particular instantiated instance of a class or a class itself.
+ *
* @author Mikhail Golubev
*/
public interface PyInstantiableType> extends PyType {
diff --git a/python/python-psi-api/src/com/jetbrains/python/psi/types/PyModuleMembersProvider.java b/python/python-psi-api/src/com/jetbrains/python/psi/types/PyModuleMembersProvider.java
index bf496e036ccf..6794dd5b9e6c 100644
--- a/python/python-psi-api/src/com/jetbrains/python/psi/types/PyModuleMembersProvider.java
+++ b/python/python-psi-api/src/com/jetbrains/python/psi/types/PyModuleMembersProvider.java
@@ -27,7 +27,9 @@ public abstract class PyModuleMembersProvider {
* @param context type evaluation context
* @return provided members
*/
- public @NotNull Collection getMembers(@NotNull PyFile module, @NotNull PointInImport point, @NotNull TypeEvalContext context) {
+ public @NotNull Collection getMembers(@NotNull PyFile module,
+ @NotNull PointInImport point,
+ @NotNull TypeEvalContext context) {
final VirtualFile vFile = module.getVirtualFile();
if (vFile != null) {
final String qName = PyPsiFacade.getInstance(module.getProject()).findShortestImportableName(vFile, module);
@@ -64,6 +66,6 @@ public abstract class PyModuleMembersProvider {
* @return provided members
*/
protected abstract @NotNull Collection getMembersByQName(@NotNull PyFile module,
- @NotNull String qName,
- @NotNull TypeEvalContext context);
+ @NotNull String qName,
+ @NotNull TypeEvalContext context);
}
diff --git a/python/python-psi-api/src/com/jetbrains/python/psi/types/PyNeverType.kt b/python/python-psi-api/src/com/jetbrains/python/psi/types/PyNeverType.kt
index 13067098759b..fbfb542eb050 100644
--- a/python/python-psi-api/src/com/jetbrains/python/psi/types/PyNeverType.kt
+++ b/python/python-psi-api/src/com/jetbrains/python/psi/types/PyNeverType.kt
@@ -8,7 +8,7 @@ import com.jetbrains.python.psi.PyExpression
import com.jetbrains.python.psi.resolve.PyResolveContext
import com.jetbrains.python.psi.resolve.RatedResolveResult
-class PyNeverType private constructor(private val name: String): PyType {
+class PyNeverType private constructor(private val name: String) : PyType {
companion object {
@JvmField val NEVER: PyNeverType = PyNeverType("Never")
@JvmField val NO_RETURN: PyNeverType = PyNeverType("NoReturn")
@@ -16,7 +16,7 @@ class PyNeverType private constructor(private val name: String): PyType {
@JvmStatic
fun PyType?.toNoReturnIfNeeded(): PyType? = if (this === NEVER) NO_RETURN else this
}
-
+
override fun getName(): String = name
override fun isBuiltin(): Boolean = true
override fun assertValid(message: String?) {}
@@ -30,7 +30,7 @@ class PyNeverType private constructor(private val name: String): PyType {
direction: AccessDirection,
resolveContext: PyResolveContext,
): List = emptyList()
-
+
override fun getCompletionVariants(
completionPrefix: String?,
location: PsiElement?,
diff --git a/python/python-psi-api/src/com/jetbrains/python/psi/types/PyTypeProviderBase.java b/python/python-psi-api/src/com/jetbrains/python/psi/types/PyTypeProviderBase.java
index bb809c0d4135..0d4c65553627 100644
--- a/python/python-psi-api/src/com/jetbrains/python/psi/types/PyTypeProviderBase.java
+++ b/python/python-psi-api/src/com/jetbrains/python/psi/types/PyTypeProviderBase.java
@@ -35,7 +35,9 @@ public class PyTypeProviderBase implements PyTypeProvider {
}
@Override
- public @Nullable Ref getParameterType(@NotNull PyNamedParameter param, @NotNull PyFunction func, @NotNull TypeEvalContext context) {
+ public @Nullable Ref getParameterType(@NotNull PyNamedParameter param,
+ @NotNull PyFunction func,
+ @NotNull TypeEvalContext context) {
return null;
}
@@ -45,7 +47,9 @@ public class PyTypeProviderBase implements PyTypeProvider {
}
@Override
- public @Nullable Ref getCallType(@NotNull PyFunction function, @NotNull PyCallSiteExpression callSite, @NotNull TypeEvalContext context) {
+ public @Nullable Ref getCallType(@NotNull PyFunction function,
+ @NotNull PyCallSiteExpression callSite,
+ @NotNull TypeEvalContext context) {
final ReturnTypeDescriptor descriptor;
synchronized (myMethodToReturnTypeMap) {
descriptor = myMethodToReturnTypeMap.get(function.getName());
@@ -120,7 +124,9 @@ public class PyTypeProviderBase implements PyTypeProvider {
myStringToReturnTypeMap.put(classQualifiedName, callback);
}
- public @Nullable Ref get(@NotNull PyFunction function, @Nullable PyCallSiteExpression callSite, @NotNull TypeEvalContext context) {
+ public @Nullable Ref get(@NotNull PyFunction function,
+ @Nullable PyCallSiteExpression callSite,
+ @NotNull TypeEvalContext context) {
return Optional
.ofNullable(function.getContainingClass())
.map(pyClass -> myStringToReturnTypeMap.get(pyClass.getQualifiedName()))
diff --git a/python/python-psi-api/src/com/jetbrains/python/psi/types/PyTypeVisitor.java b/python/python-psi-api/src/com/jetbrains/python/psi/types/PyTypeVisitor.java
index fae195586513..815da212df12 100644
--- a/python/python-psi-api/src/com/jetbrains/python/psi/types/PyTypeVisitor.java
+++ b/python/python-psi-api/src/com/jetbrains/python/psi/types/PyTypeVisitor.java
@@ -12,7 +12,7 @@ import org.jetbrains.annotations.Nullable;
* Because the "unknown" type is historically represented as {@code null} in the type system, {@code PyTypeVisitor.visitPyType(type, visitor)}
* should be used instead of direct {@code type.acceptTypeVisitor(visitor)} to properly account for possible {@code null} values.
*
- * This class gives access only to the types declared in the intellij.python.psi module.
+ * This class gives access only to the types declared in the intellij.python.psi module.
* Most actual implementations should extend {@link PyTypeVisitorExt}.
*
* There are helper {@link PyRecursiveTypeVisitor} and {@link PyCloningTypeVisitor} for recursive type
@@ -21,7 +21,7 @@ import org.jetbrains.annotations.Nullable;
* @see PyRecursiveTypeVisitor
* @see PyCloningTypeVisitor
* @see PyType#acceptTypeVisitor(PyTypeVisitor)
- * @see #visit(PyType, PyTypeVisitor)
+ * @see #visit(PyType, PyTypeVisitor)
* @see #visitUnknownType()
*/
@ApiStatus.Experimental
@@ -74,7 +74,7 @@ public abstract class PyTypeVisitor {
public T visitPyCallableParameterListType(@NotNull PyCallableParameterListType callableParameterListType) {
return visitPyType(callableParameterListType);
}
-
+
public T visitPyNeverType(@NotNull PyNeverType neverType) {
return visitPyType(neverType);
}
diff --git a/python/python-psi-api/src/com/jetbrains/python/psi/types/TypeEvalConstraints.java b/python/python-psi-api/src/com/jetbrains/python/psi/types/TypeEvalConstraints.java
index aba34515b7f9..c68322f2859a 100644
--- a/python/python-psi-api/src/com/jetbrains/python/psi/types/TypeEvalConstraints.java
+++ b/python/python-psi-api/src/com/jetbrains/python/psi/types/TypeEvalConstraints.java
@@ -39,7 +39,7 @@ public final class TypeEvalConstraints {
if (this == o) return true;
if (!(o instanceof TypeEvalConstraints that)) return false;
- return myAllowDataFlow == that.myAllowDataFlow &&
+ return myAllowDataFlow == that.myAllowDataFlow &&
myAllowStubToAST == that.myAllowStubToAST &&
myAllowCallContext == that.myAllowCallContext &&
Objects.equals(myOrigin, that.myOrigin);
diff --git a/python/python-psi-api/src/com/jetbrains/python/psi/types/TypeEvalContext.java b/python/python-psi-api/src/com/jetbrains/python/psi/types/TypeEvalContext.java
index 0e08b2f16fb1..936c3625b855 100644
--- a/python/python-psi-api/src/com/jetbrains/python/psi/types/TypeEvalContext.java
+++ b/python/python-psi-api/src/com/jetbrains/python/psi/types/TypeEvalContext.java
@@ -268,7 +268,9 @@ public sealed class TypeEvalContext {
myConstraints.myAllowStubToAST,
myConstraints.myAllowCallContext,
// code completion will always have a new PsiFile, use original file instead
- myConstraints.myOrigin != null ? myConstraints.myOrigin.getOriginalFile() : null);
+ myConstraints.myOrigin != null
+ ? myConstraints.myOrigin.getOriginalFile()
+ : null);
return project.getService(TypeEvalContextCache.class).getLibraryContext(new LibraryTypeEvalContext(constraints));
}
@@ -430,7 +432,7 @@ public sealed class TypeEvalContext {
}
private static class PyNullType implements PyType {
- private PyNullType() {}
+ private PyNullType() { }
@Override
public @Nullable List extends RatedResolveResult> resolveMember(@NotNull String name,
diff --git a/python/python-psi-impl/resources/inspectionDescriptions/PyAssertTypeInspection.html b/python/python-psi-impl/resources/inspectionDescriptions/PyAssertTypeInspection.html
index df302f1b78dd..65fd03838c1d 100644
--- a/python/python-psi-impl/resources/inspectionDescriptions/PyAssertTypeInspection.html
+++ b/python/python-psi-impl/resources/inspectionDescriptions/PyAssertTypeInspection.html
@@ -1,8 +1,8 @@
- Checks typing.assert_type(val, typ, /) calls and reports cases when val's inferred type is not
- typ.
+ Checks typing.assert_type(val, typ, /) calls and reports cases when val's inferred type is not
+ typ.
Example:
diff --git a/python/python-psi-impl/resources/inspectionDescriptions/PyInvalidCastInspection.html b/python/python-psi-impl/resources/inspectionDescriptions/PyInvalidCastInspection.html
index af47776426d0..ab14639a29fe 100644
--- a/python/python-psi-impl/resources/inspectionDescriptions/PyInvalidCastInspection.html
+++ b/python/python-psi-impl/resources/inspectionDescriptions/PyInvalidCastInspection.html
@@ -6,7 +6,8 @@
and typing.cast does not dynamically validate the type.
This check applies even to types that could theoretically have a common descendant.
- For example, it will flag a cast between two sibling classes Left and Right that both inherit from Top,
+ For example, it will flag a cast between two sibling classes Left and Right that both inherit from
+ Top,
because there is no direct inheritance relationship between them.
Example:
diff --git a/python/python-psi-impl/resources/inspectionDescriptions/PyMethodFirstArgAssignmentInspection.html b/python/python-psi-impl/resources/inspectionDescriptions/PyMethodFirstArgAssignmentInspection.html
index baab0f218925..89afe470fc0b 100644
--- a/python/python-psi-impl/resources/inspectionDescriptions/PyMethodFirstArgAssignmentInspection.html
+++ b/python/python-psi-impl/resources/inspectionDescriptions/PyMethodFirstArgAssignmentInspection.html
@@ -14,4 +14,5 @@ class Account:
As a fix, you might want to check and modify the algorithm to ensure that reassignment is needed. If everything is correct,
you can invoke intention actions for this code and opt to ignore the warning.
-
+