PyType (@NotNull PyTargetExpression target, @NotNull PyTupleExpression parentTuple, @NotNull PyTupleType assignedTupleType) { final int count = assignedTupleType.getElementCount(); final PyExpression[] elements = parentTuple.getElements(); if (elements.length == count || assignedTupleType.isHomogeneous()) { final int index = ArrayUtil.indexOf(elements, target); if (index >= 0) { return assignedTupleType.getElementType(index); } for (int i = 0; i < count; i++) { PyExpression element = elements[i]; while (element instanceof PyParenthesizedExpression) { element = ((PyParenthesizedExpression)element).getContainedExpression(); } if (element instanceof PyTupleExpression) { final PyType elementType = assignedTupleType.getElementType(i); if (elementType instanceof PyTupleType) { final PyType result = getTargetTypeFromTupleAssignment(target, (PyTupleExpression)element, (PyTupleType)elementType); if (result != null) { return result; } } } } } return null; }