AnnotationInfo (@NotNull PyTargetExpression target, TypeEvalContext context) { final PyElement validTargetParent = PsiTreeUtil.getParentOfType(target, PyForPart.class, PyWithItem.class, PyAssignmentStatement.class); assert validTargetParent != null; final PsiElement topmostTarget = PsiTreeUtil.findPrevParent(validTargetParent, target); final StringBuilder builder = new StringBuilder(); final List<PyType> types = new ArrayList<>(); final ArrayList<TextRange> typeRanges = new ArrayList<>(); generateNestedTypeHint(topmostTarget, context, builder, types, typeRanges); return new AnnotationInfo(builder.toString(), types, typeRanges); }