Ref<PyType> (@NotNull PsiElement resolved, @NotNull Context context) { if (resolved instanceof PySubscriptionExpression subscriptionExpr) { final PyExpression operand = subscriptionExpr.getOperand(); Collection<String> resolvedNames = resolveToQualifiedNames(operand, context.getTypeContext()); if (resolvedNames.stream().anyMatch(name -> ANNOTATED.equals(name) || ANNOTATED_EXT.equals(name))) { final PyExpression indexExpr = subscriptionExpr.getIndexExpression(); final PyExpression type = indexExpr instanceof PyTupleExpression ? ((PyTupleExpression)indexExpr).getElements()[0] : indexExpr; if (type != null) { return getType(type, context); } } } return null; }