class_docstr: The Post Mixin class for Client and Flow
class_docstr_tok: ["The","Post","Mixin","class","for","Client","and","Flow"]
code: def _with_retry(
      self,
      func,
      inputs,
      on_done,
      on_error,
      on_always,
      exec_endpoint,
      target_executor,
      parameters,
      request_size,
      max_attempts,
      initial_backoff,
      max_backoff,
      backoff_multiplier,
      results_in_order,
      stream,
      prefetch,
      **kwargs,
  ):
      is_document_or_documentarray = isinstance(
          inputs, Document
      ) or isinstance(inputs, DocumentArray)
      if (
          is_document_or_documentarray
          and isinstance(self.client, GRPCBaseClient)
          and max_attempts > 1
          and stream
      ):
          for attempt in range(1, max_attempts + 1):
              try:
                  return PostMixin._run_async(
                      backoff_multiplier,
                      exec_endpoint,
                      func,
                      initial_backoff,
                      inputs,
                      kwargs,
                      max_attempts,
                      max_backoff,
                      on_always,
                      on_done,
                      on_error,
                      parameters,
                      prefetch,
                      request_size,
                      results_in_order,
                      stream,
                      target_executor,
                  )
              except (
                  grpc.aio.AioRpcError,
                  InternalNetworkError,
                  ConnectionError,
              ) as err:
                  run_async(
                      wait_or_raise_err,
                      attempt=attempt,
                      err=err,
                      max_attempts=max_attempts,
                      backoff_multiplier=backoff_multiplier,
                      initial_backoff=initial_backoff,
                      max_backoff=max_backoff,
                  )
      else:
          return PostMixin._run_async(
              backoff_multiplier,
              exec_endpoint,
              func,
              initial_backoff,
              inputs,
              kwargs,
              max_attempts,
              max_backoff,
              on_always,
              on_done,
              on_error,
              parameters,
              prefetch,
              request_size,
              results_in_order,
              stream,
              target_executor,
          )
  
imports: import time
  import warnings
  from functools import partialmethod
  from typing import TYPE_CHECKING, AsyncGenerator, Dict, List, Optional, Type, Union
  import grpc.aio
  from jina.clients.base.grpc import GRPCBaseClient
  from jina.clients.base.retry import wait_or_raise_err
  from jina.excepts import InternalNetworkError
  from jina.helper import deprecate_by, get_or_reuse_loop, run_async
  from jina.importer import ImportExtensions
  from jina._docarray import Document, DocumentArray, docarray_v2
label_desc: Use image node_id 1 for calling the PostMixin obj's underlying member method code with example usage: obj._with_retry(func, inputs, on_done, on_error, on_always, exec_endpoint, target_executor, parameters, request_size, max_attempts, initial_backoff, max_backoff, backoff_multiplier, results_in_order, stream, prefetch) and returns: PostMixin, PostMixin