Query<PsiElement> (@NotNull PsiElement nameIdentifier, @NotNull TypeEvalContext context) { if (!(nameIdentifier.getParent() instanceof PyTargetExpression)) return null; final List<PsiElement> result = new ArrayList<>(); final PyClass containingClass = PsiTreeUtil.getParentOfType(nameIdentifier, PyClass.class); if (containingClass != null) { for (PyClass ancestor : containingClass.getAncestorClasses(context)) { final PyTargetExpression attribute = ancestor.findClassAttribute(nameIdentifier.getText(), false, context); if (attribute != null) { result.add(attribute); } } } return new CollectionQuery<>(result); }