List<PsiElement> (@NotNull PsiElement anchor, @NotNull PyFunction generatedMethod) { final ScopeOwner owner = ScopeUtil.getScopeOwner(anchor); if (owner instanceof PsiFile) return Collections.emptyList(); final List<PsiElement> scope = new ArrayList<>(); if (owner instanceof PyFunction pyFunction) { scope.add(pyFunction.getStatementList()); final PyClass containingClass = ((PyFunction)owner).getContainingClass(); if (containingClass != null) { for (PyFunction function : containingClass.getMethods()) { if (!function.equals(owner) && !function.equals(generatedMethod)) { scope.add(function.getStatementList()); } } } } return scope; }