class_docstr: Object to encapsulate the code related to handle the data requests passing to executor and its returned values
class_docstr_tok: ["Object","to","encapsulate","the","code","related","to","handle","the","data","requests","passing","to","executor","and","its","returned","values"]
code: def _set_result(self, requests, return_data, docs):
      # assigning result back to request
      if return_data is not None:
          if isinstance(return_data, DocumentArray):
              docs = return_data
          elif isinstance(return_data, dict):
              params = requests[0].parameters
              results_key = self._KEY_RESULT
  
              if not results_key in params.keys():
                  params[results_key] = dict()
  
              params[results_key].update({self.args.name: return_data})
              requests[0].parameters = params
  
          else:
              raise TypeError(
                  f"The return type must be DocList / Dict / `None`, "
                  f"but getting {return_data!r}"
              )
  
      WorkerRequestHandler.replace_docs(
          requests[0], docs, self.args.output_array_type
      )
      return docs
  
imports: import argparse
  import asyncio
  import functools
  import json
  import os
  import tempfile
  import threading
  import uuid
  import warnings
  from typing import TYPE_CHECKING, AsyncIterator, Dict, Generator, List, Optional, Tuple, Union
  from google.protobuf.struct_pb2 import Struct
  from jina._docarray import DocumentArray, docarray_v2
  from jina.constants import __default_endpoint__
  from jina.excepts import BadConfigSource, RuntimeTerminated
  from jina.helper import get_full_version
  from jina.importer import ImportExtensions
  from jina.proto import jina_pb2
  from jina.serve.executors import BaseExecutor
  from jina.serve.instrumentation import MetricsTimer
  from jina.serve.runtimes.worker.batch_queue import BatchQueue
  from jina.types.request.data import DataRequest, SingleDocumentRequest
label_desc: Use image node_id 14 for calling the WorkerRequestHandler obj's underlying member method code with example usage: obj._set_result(requests, return_data, docs) and returns: docs