PyClass (PyExpression argument) { PsiElement firstElement = ((PyReferenceExpression)argument).followAssignmentsChain(getResolveContext()).getElement(); PyClass firstClass = null; if (firstElement instanceof PyClass) firstClass = (PyClass)firstElement; else if (firstElement instanceof PyExpression) { PyType first_type = myTypeEvalContext.getType((PyExpression)firstElement); if (first_type instanceof PyClassType) { firstClass = ((PyClassType)first_type).getPyClass(); } } return firstClass; }