Ref<PyType> (@NotNull PsiElement resolved, @NotNull Context context) { if (resolved instanceof PySubscriptionExpression subsExpr) { final PyExpression operand = subsExpr.getOperand(); final Collection<String> operandNames = resolveToQualifiedNames(operand, context.getTypeContext()); if (operandNames.contains(TYPE) || operandNames.contains(PyNames.TYPE)) { final PyExpression indexExpr = subsExpr.getIndexExpression(); if (indexExpr != null) { if (resolveToQualifiedNames(indexExpr, context.getTypeContext()).contains(ANY)) { return Ref.create(PyBuiltinCache.getInstance(resolved).getTypeType()); } return getAsClassObjectType(indexExpr, context); } // Map Type[Something] with unsupported type parameter to Any, instead of generic type for the class "type" return Ref.create(); } } // Replace plain non-parametrized Type with its builtin counterpart else if (TYPE.equals(getQualifiedName(resolved))) { return Ref.create(PyBuiltinCache.getInstance(resolved).getTypeType()); } return null; }