Repository: redis/redis-py
File: redis/cluster.py (Python)

Code before:
        if raise_on_error or len(errors) > 0:
            self._raise_first_error(
                response,
                self._command_queue,
            )

        # We have to run response callbacks manually
        data = []
        for r, cmd in zip(response, self._command_queue):
            if not isinstance(r, Exception):
                command_name = cmd.args[0]
                if command_name in self._pipe.cluster_response_callbacks:
                    r = self._pipe.cluster_response_callbacks[command_name](
                        r, **cmd.options
                    )
            data.append(r)
        return data

    def reset(self):
        self._command_queue = []

        # make sure to reset the connection state in the event that we were
        # watching something
        if self._transaction_connection:
            try:
                # call this manually since our unwatch or
                # immediate_execute_command methods can call reset()
                if self._watching:
                    self._transaction_connection.send_command("UNWATCH")
                    self._transaction_connection.read_response()
                # we can safely return the connection to the pool here since we're
                # sure we're no longer WATCHing anything
                node = self._nodes_manager.find_connection_owner(
                    self._transaction_connection
                )
                node.redis_connection.connection_pool.release(
                    self._transaction_connection
                )
                self._transaction_connection = None
            except self.CONNECTION_ERRORS:
                # disconnect will also remove any previous WATCHes
                if self._transaction_connection:
                    self._transaction_connection.disconnect()

        # clean up the other instance attributes
        self._watching = False
        self._explicit_transaction = False
        self._pipeline_slots = set()
        self._executing = False

    def send_cluster_commands(

Review comment (suggestion):
Please move the comment about the `unwatch` command execution inside the if block.

Code after:
            self._raise_first_error(
                response,
                self._command_queue,
            )

        # We have to run response callbacks manually
        data = []
        for r, cmd in zip(response, self._command_queue):
            if not isinstance(r, Exception):
                command_name = cmd.args[0]
                if command_name in self._pipe.cluster_response_callbacks:
                    r = self._pipe.cluster_response_callbacks[command_name](
                        r, **cmd.options
                    )
            data.append(r)
        return data

    def reset(self):
        self._command_queue = []

        # make sure to reset the connection state in the event that we were
        # watching something
        if self._transaction_connection:
            try:
                if self._watching:
                    # call this manually since our unwatch or
                    # immediate_execute_command methods can call reset()
                    self._transaction_connection.send_command("UNWATCH")
                    self._transaction_connection.read_response()
                # we can safely return the connection to the pool here since we're
                # sure we're no longer WATCHing anything
                node = self._nodes_manager.find_connection_owner(
                    self._transaction_connection
                )
                node.redis_connection.connection_pool.release(
                    self._transaction_connection
                )
                self._transaction_connection = None
            except self.CONNECTION_ERRORS:
                # disconnect will also remove any previous WATCHes
                if self._transaction_connection:
                    self._transaction_connection.disconnect()

        # clean up the other instance attributes
        self._watching = False
        self._explicit_transaction = False
        self._pipeline_slots = set()
        self._executing = False

    def send_cluster_commands(
        self, stack, raise_on_error=True, allow_redirections=True