UsageGroup (@NotNull Usage usage, UsageTarget @NotNull [] targets) { if (!(usage instanceof PsiElementUsage)) return null; final PsiElement psiElement = ((PsiElementUsage)usage).getElement(); final PyClass pyClass = PsiTreeUtil.getParentOfType(psiElement, PyClass.class); if (pyClass != null) { return new PsiNamedElementUsageGroupBase<>(pyClass); } return null; }