PsiElement (@NotNull PsiElement typeHintExpression) { // Values from PSI stubs and regular type comments PsiElement fragmentOwner = typeHintExpression.getContainingFile().getUserData(FRAGMENT_OWNER); if (fragmentOwner != null) { return fragmentOwner; } // Values from function type comments else if (typeHintExpression.getContainingFile() instanceof PyFunctionTypeAnnotationFile) { return PyPsiUtils.getRealContext(typeHintExpression); } else { return typeHintExpression; } }