PyType () { PyExceptPart exceptPart = PsiTreeUtil.getParentOfType(this, PyExceptPart.class); if (exceptPart == null || exceptPart.getTarget() != this) { return null; } final PyExpression exceptClass = exceptPart.getExceptClass(); if (exceptClass instanceof PyReferenceExpression) { final PsiElement element = ((PyReferenceExpression)exceptClass).getReference().resolve(); if (element instanceof PyClass) { return new PyClassTypeImpl((PyClass)element, false); } } return null; }