void (@NotNull PyReferenceExpression node) { final PyExceptPart exceptPart = PsiTreeUtil.getParentOfType(node, PyExceptPart.class); if (exceptPart != null) { final PyExpression exceptClass = exceptPart.getExceptClass(); if (exceptClass != null && "ImportError".equals(exceptClass.getText())) return; } final PsiElement resolveResult = resolve(node); final PyFromImportStatement importStatement = PsiTreeUtil.getParentOfType(node, PyFromImportStatement.class); if (importStatement != null) { final PsiElement element = importStatement.resolveImportSource(); if (resolveResult != null && element != resolveResult.getContainingFile()) return; } @NlsSafe String deprecationMessage = null; if (resolveResult instanceof PyFunction) { deprecationMessage = ((PyFunction)resolveResult).getDeprecationMessage(); } else if (resolveResult instanceof PyFile) { deprecationMessage = ((PyFile)resolveResult).getDeprecationMessage(); } if (deprecationMessage != null) { ASTNode nameElement = node.getNameElement(); registerProblem(nameElement == null ? node : nameElement.getPsi(), deprecationMessage, ProblemHighlightType.LIKE_DEPRECATED); } }