class_docstr: RESP2 protocol implementation
class_docstr_tok: ["RESP2","protocol","implementation"]
code: def _read_response(self, disable_decoding=False):
      raw = self._buffer.readline()
      if not raw:
          raise ConnectionError(SERVER_CLOSED_CONNECTION_ERROR)
  
      byte, response = raw[:1], raw[1:]
  
      # server returned an error
      if byte == b"-":
          response = response.decode("utf-8", errors="replace")
          error = self.parse_error(response)
          # if the error is a ConnectionError, raise immediately so the user
          # is notified
          if isinstance(error, ConnectionError):
              raise error
          # otherwise, we're dealing with a ResponseError that might belong
          # inside a pipeline response. the connection's read_response()
          # and/or the pipeline's execute() will raise this error if
          # necessary, so just return the exception instance here.
          return error
      # single value
      elif byte == b"+":
          pass
      # int value
      elif byte == b":":
          return int(response)
      # bulk response
      elif byte == b"$" and response == b"-1":
          return None
      elif byte == b"$":
          response = self._buffer.read(int(response))
      # multi-bulk response
      elif byte == b"*" and response == b"-1":
          return None
      elif byte == b"*":
          response = [
              self._read_response(disable_decoding=disable_decoding)
              for i in range(int(response))
          ]
      else:
          raise InvalidResponse(f"Protocol Error: {raw!r}")
  
      if disable_decoding is False:
          response = self.encoder.decode(response)
      return response
  
file_path: redis-py/redis/_parsers/resp2.py
imports: from typing import Any, Union
  from ..exceptions import ConnectionError, InvalidResponse, ResponseError
  from ..typing import EncodableT
  from .base import _AsyncRESPBase, _RESPBase
  from .socket import SERVER_CLOSED_CONNECTION_ERROR
label_desc: Use image node_id 2 for calling the _RESP2Parser obj's underlying member method code with example usage: obj._read_response(disable_decoding) and returns: response, error, int, None, None