boolean (@NotNull PsiElement element) { PsiFile containingFile = element.getContainingFile(); final VirtualFile virtualFile = containingFile != null ? containingFile.getVirtualFile() : null; if (virtualFile != null && ProjectRootManager.getInstance(element.getProject()).getFileIndex().isInLibraryClasses(virtualFile)) { return false; } if (element instanceof PyTargetExpression || element instanceof PyNamedParameter) { return true; } return isBooleanLiteral(element.getParent()); }