boolean (Object element, PsiElement context) { if (!(element instanceof PsiElement psiElement)) { return false; } PsiElement definition = PsiTreeUtil.getParentOfType(psiElement, PyDocStringOwner.class, false, PyStatementList.class); if (definition != null) { if (PsiTreeUtil.getParentOfType(psiElement, PyParameterList.class) == null) { return true; } PyParameter param = PsiTreeUtil.getParentOfType(psiElement, PyParameter.class); if (param != null) { PyExpression defaultValue = param.getDefaultValue(); if (defaultValue != null && PsiTreeUtil.isAncestor(defaultValue, psiElement, false)) { return true; } } return false; } return true; }