PyType (@NotNull TypeEvalContext context) { PyExpression target = null; PyExpression source = null; final PyForPart forPart = PsiTreeUtil.getParentOfType(this, PyForPart.class); if (forPart != null) { final PyExpression expr = forPart.getTarget(); if (PsiTreeUtil.isAncestor(expr, this, false)) { target = expr; source = forPart.getSource(); } } final PyComprehensionElement comprh = PsiTreeUtil.getParentOfType(this, PyComprehensionElement.class); if (comprh != null) { for (PyComprehensionForComponent c : comprh.getForComponents()) { final PyExpression expr = c.getIteratorVariable(); if (PsiTreeUtil.isAncestor(expr, this, false)) { target = expr; source = c.getIteratedList(); } } } if (source != null) { final PyType sourceType = context.getType(source); final PyType type = getIterationType(sourceType, source, this, context); if (type instanceof PyTupleType && target instanceof PyTupleExpression) { return PyTypeChecker.getTargetTypeFromTupleAssignment(this, (PyTupleExpression)target, (PyTupleType)type); } if (target == this && type != null) { return type; } } return null; }