PyType (@NotNull PsiElement element, @NotNull Context context) { if (element instanceof PySubscriptionExpression subscriptionExpr) { final PyExpression operand = subscriptionExpr.getOperand(); final PyExpression indexExpr = subscriptionExpr.getIndexExpression(); if (indexExpr != null) { final PyType operandType = Ref.deref(getType(operand, context)); final List<PyType> indexTypes = getIndexTypes(subscriptionExpr, context); if (operandType instanceof PyClassType && !(operandType instanceof PyTupleType) && PyNames.TUPLE.equals(((PyClassType)operandType).getPyClass().getQualifiedName())) { if (indexExpr instanceof PyTupleExpression) { final PyExpression[] elements = ((PyTupleExpression)indexExpr).getElements(); if (elements.length == 2 && isEllipsis(elements[1])) { return PyTupleType.createHomogeneous(element, indexTypes.get(0)); } } return PyTupleType.create(element, indexTypes); } if (operandType != null) { return PyTypeChecker.parameterizeType(operandType, indexTypes, context.getTypeContext()); } } } return null; }