Ref<PyType> (@NotNull PsiElement resolved, @NotNull Context context) { if (resolved instanceof PySubscriptionExpression subscriptionExpr) { final Collection<String> operandNames = resolveToQualifiedNames(subscriptionExpr.getOperand(), context.getTypeContext()); if (ContainerUtil.exists(operandNames, name -> name.equals(LITERAL) || name.equals(LITERAL_EXT))) { return Optional .ofNullable(subscriptionExpr.getIndexExpression()) .map(index -> PyLiteralType.Companion.fromLiteralParameter(index, context.getTypeContext())) .map(Ref::create) .orElse(null); } } return null; }