PyClassType (@NotNull final PsiElement problemElement) { if ((problemElement instanceof PyQualifiedExpression)) { final PyExpression qualifier = ((PyQualifiedExpression)problemElement).getQualifier(); if (qualifier == null) return null; final PyType type = TypeEvalContext.userInitiated(problemElement.getProject(), problemElement.getContainingFile()).getType(qualifier); return type instanceof PyClassType ? (PyClassType)type : null; } final PyClass pyClass = PsiTreeUtil.getParentOfType(problemElement, PyClass.class); return pyClass != null ? new PyClassTypeImpl(pyClass, false) : null; }