List<RatedResolveResult> (@NotNull PyQualifiedExpression element, @NotNull TypeEvalContext context) { final String referencedName = element.getReferencedName(); // resolve implicit __class__ inside method if (element instanceof PyReferenceExpression && PyNames.__CLASS__.equals(referencedName) && !LanguageLevel.forElement(element).isPython2()) { final PyFunction containingFunction = PsiTreeUtil.getParentOfType(element, PyFunction.class); if (containingFunction != null) { final PyClass containingClass = containingFunction.getContainingClass(); if (containingClass != null) { final PyResolveProcessor processor = new PyResolveProcessor(referencedName); PyResolveUtil.scopeCrawlUp(processor, element, referencedName, containingFunction); if (processor.getElements().isEmpty()) { final PyType objectType = PyBuiltinCache.getInstance(element).getObjectType(); if (objectType != null) { final PyResolveContext resolveContext = PyResolveContext.defaultContext(context); final List<? extends RatedResolveResult> results = objectType.resolveMember(PyNames.__CLASS__, element, AccessDirection.of(element), resolveContext); if (results != null) { return new SmartList<>(results); } } } } } } return Collections.emptyList(); }