boolean (final ASTNode node) { if (node.getTreeParent().getElementType() != PyElementTypes.ASSIGNMENT_EXPRESSION && PsiTreeUtil.getParentOfType(node.getPsi(), PyComprehensionElement.class, true, PyDocStringOwner.class) != null) { return false; } final ASTNode functionNode = TreeUtil.findParent(node, PyElementTypes.FUNCTION_DECLARATION); final ASTNode qualifierNode = node.findChildByType(PythonDialectsTokenSetProvider.getInstance().getReferenceExpressionTokens()); if (functionNode != null && qualifierNode != null) { if (PyUtil.isNewMethod(functionNode.getPsi())) { return true; } final ASTNode parameterList = functionNode.findChildByType(PyElementTypes.PARAMETER_LIST); assert parameterList != null; final ASTNode[] children = parameterList.getChildren(PyElementTypes.FORMAL_PARAMETER_SET); if (children.length > 0 && children[0].getText().equals(qualifierNode.getText())) { return true; } } return functionNode == null && qualifierNode == null; }