mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-18 20:41:22 +07:00
[python] Pattern variable can be used mass cleanup
GitOrigin-RevId: 04229dfd0912fbc846d4b1d5e3726ef6c9c005c6
This commit is contained in:
committed by
intellij-monorepo-bot
parent
582c1c03e9
commit
2152c276dc
@@ -342,7 +342,7 @@ public final class AddImportHelper {
|
||||
if (fromImportStatement.getRelativeLevel() > 0) {
|
||||
return new ImportPriorityChoice(ImportPriority.PROJECT, "explicit relative import");
|
||||
}
|
||||
resolveAnchor = ((PyFromImportStatement)importStatement).getImportSource();
|
||||
resolveAnchor = fromImportStatement.getImportSource();
|
||||
resolved = fromImportStatement.resolveImportSource();
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -32,7 +32,7 @@ public class PyMoveAttributeToInitQuickFix extends PsiUpdateModCommandQuickFix {
|
||||
final PyAssignmentStatement assignment = PsiTreeUtil.getParentOfType(element, PyAssignmentStatement.class);
|
||||
if (containingClass == null || assignment == null) return;
|
||||
|
||||
AddFieldQuickFix.addFieldToInit(project, containingClass, ((PyTargetExpression)element).getName(), x -> assignment);
|
||||
AddFieldQuickFix.addFieldToInit(project, containingClass, targetExpression.getName(), x -> assignment);
|
||||
removeDefinition(assignment);
|
||||
}
|
||||
|
||||
|
||||
@@ -685,7 +685,7 @@ public final class PyCallExpressionHelper {
|
||||
}
|
||||
}
|
||||
PsiElement possible_class = firstArgRef.getReference().resolve();
|
||||
if (possible_class instanceof PyClass first_class && ((PyClass)possible_class).isNewStyleClass(context)) {
|
||||
if (possible_class instanceof PyClass first_class && first_class.isNewStyleClass(context)) {
|
||||
return new Maybe<>(getSuperCallTypeForArguments(context, first_class, args[1]));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ public class PyReferenceExpressionImpl extends PyElementImpl implements PyRefere
|
||||
|
||||
for (ResolveResult resolveResult : node.myReferenceExpression.getReference(resolveContext).multiResolve(false)) {
|
||||
final PsiElement element = resolveResult.getElement();
|
||||
if (element instanceof PyTargetExpression target && follow.test((PyTargetExpression)element)) {
|
||||
if (element instanceof PyTargetExpression target && follow.test(target)) {
|
||||
|
||||
final List<PsiElement> assignedFromElements = context.maySwitchToAST(target)
|
||||
? Collections.singletonList(target.findAssignedValue())
|
||||
|
||||
@@ -213,7 +213,7 @@ public final class PyExtractMethodUtil {
|
||||
final List<PsiElement> scope = new ArrayList<>();
|
||||
if (owner instanceof PyFunction pyFunction) {
|
||||
scope.add(pyFunction.getStatementList());
|
||||
final PyClass containingClass = ((PyFunction)owner).getContainingClass();
|
||||
final PyClass containingClass = pyFunction.getContainingClass();
|
||||
if (containingClass != null) {
|
||||
for (PyFunction function : containingClass.getMethods()) {
|
||||
if (!function.equals(owner) && !function.equals(generatedMethod)) {
|
||||
|
||||
Reference in New Issue
Block a user