Finish reading and send text
510148
def participate(self):
        """"""
        try:
            logger.info("Entering participate method")
            ready = WebDriverWait(self.driver, 10).until(
                EC.element_to_be_clickable((By.ID, "finish-reading"))
            )
            stimulus = self.driver.find_element_by_id("stimulus")
            story = stimulus.find_element_by_id("story")
            story_text = story.text
            logger.info("Stimulus text:")
            logger.info(story_text)
            ready.click()
            submit = WebDriverWait(self.driver, 10).until(
                EC.element_to_be_clickable((By.ID, "submit-response"))
            )
            textarea = WebDriverWait(self.driver, 10).until(
                EC.element_to_be_clickable((By.ID, "reproduction"))
            )
            textarea.clear()
            text = self.transform_text(story_text)
            logger.info("Transformed text:")
            logger.info(text)
            textarea.send_keys(text)
            submit.click()
            return True
        except TimeoutException:
            return False
687702
def finish(self) -> None:
        """"""
        if (
            self._expected_content_remaining is not None
            and self._expected_content_remaining != 0
            and not self.stream.closed()
        ):
            self.stream.close()
            raise httputil.HTTPOutputError(
                "Tried to write %d bytes less than Content-Length"
                % self._expected_content_remaining
            )
        if self._chunking_output:
            if not self.stream.closed():
                self._pending_write = self.stream.write(b"0\r\n\r\n")
                self._pending_write.add_done_callback(self._on_write_complete)
        self._write_finished = True
        # If the app finished the request while we're still reading,
        # divert any remaining data away from the delegate and
        # close the connection when we're done sending our response.
        # Closing the connection is the only way to avoid reading the
        # whole input body.
        if not self._read_finished:
            self._disconnect_on_finish = True
        # No more data is coming, so instruct TCP to send any remaining
        # data immediately instead of waiting for a full packet or ack.
        self.stream.set_nodelay(True)
        if self._pending_write is None:
            self._finish_request(None)
        else:
            future_add_done_callback(self._pending_write, self._finish_request)
542695
function sendText (req, res, next, data) {
  setContentType(req, res,
    ["text", "html", "text/*", "application/*"],                // allow these types
    ["json", "*/json", "+json", "application/octet-stream"]);   // don't allow these types

  util.debug("Serializing the response as a string");
  res.send(_(data).toString());
}
50575
def read_text(self, text):
        
        logger.info('Reading: "%s"' % text)
        msg_id = 'RT000%s' % self.msg_counter
        kqml_perf = _get_perf(text, msg_id)
        self.reply_counter += 1
        self.msg_counter += 1
        self.send(kqml_perf)
58550
function send () {
      sent = true;
      // next tick it to avoid express catching runtime error in the callback
      //   getting caught by express and triggering app's error handler
      process.nextTick(function () {
        res.emit('finish');
        cb(null, res, body);
      });
    }
123486
async def send(self, clear=True, parse_mode=()):
        
        await self._client.send_message(
            self._peer, self.text, reply_to=self.reply_to_msg_id,
            link_preview=self.link_preview, parse_mode=parse_mode,
            clear_draft=clear
        )
42898
def sendDAT(self):
        """"""
        finished = False
        blocknumber = self.context.next_block
        # Test hook
        if DELAY_BLOCK and DELAY_BLOCK == blocknumber:
            import time
            log.debug("Deliberately delaying 10 seconds...")
            time.sleep(10)
        dat = None
        blksize = self.context.getBlocksize()
        buffer = self.context.fileobj.read(blksize)
        log.debug("Read %d bytes into buffer", len(buffer))
        if len(buffer) < blksize:
            log.info("Reached EOF on file %s"
                % self.context.file_to_transfer)
            finished = True
        dat = TftpPacketDAT()
        dat.data = buffer
        dat.blocknumber = blocknumber
        self.context.metrics.bytes += len(dat.data)
        log.debug("Sending DAT packet %d", dat.blocknumber)
        self.context.sock.sendto(dat.encode().buffer,
                                 (self.context.host, self.context.tidport))
        if self.context.packethook:
            self.context.packethook(dat)
        self.context.last_pkt = dat
        return finished
1371939
def send_line(self, line, ending=None):
        
        if ending is None:
            ending = self.LINE_ENDING
        return self.send(line + ending)
1008809
private void sendTextToServer() {
        statusLabel.setText("");
        conceptList.clear();

        // don't do anything if we have no text
        final String text = mainTextArea.getText();
        if (text.length() < 1) {
            statusLabel.setText(messages.pleaseEnterTextLabel());
            return;
        }

        // disable interaction while we wait for the response
        glassPanel.setPositionAndShow();

        // build up the AnalysisRequest JSON object
        // start with any options
        final JSONArray options = new JSONArray();
        setSemanticTypesOption(types, options);
        // defaults
        options.set(options.size(), new JSONString("word_sense_disambiguation"));
        options.set(options.size(), new JSONString("composite_phrases 8"));
        options.set(options.size(), new JSONString("no_derivational_variants"));
        options.set(options.size(), new JSONString("strict_model"));
        options.set(options.size(), new JSONString("ignore_word_order"));
        options.set(options.size(), new JSONString("allow_large_n"));
        options.set(options.size(), new JSONString("restrict_to_sources SNOMEDCT_US"));

        final JSONObject analysisRequest = new JSONObject();
        analysisRequest.put("text", new JSONString(text));
        analysisRequest.put("options", options);

        // send the input to the server
        final RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, webserviceUrl);
        builder.setHeader("Content-Type", MediaType.APPLICATION_JSON);
        builder.setRequestData(analysisRequest.toString());

        // create the async callback
        builder.setCallback(new SnomedRequestCallback(conceptList, statusLabel, glassPanel, typeCodeToDescription));

        // send the request
        try { builder.send(); }
        catch (final RequestException e) {
            statusLabel.setText(messages.problemPerformingAnalysisLabel());
            GWT.log("There was a problem performing the analysis: " + e.getMessage(), e);
            glassPanel.hide();
        }
    }
1374611
async def send(self, data: Union[bytes, str], final: bool = True):
        
        MsgType = TextMessage if isinstance(data, str) else BytesMessage
        data = MsgType(data=data, message_finished=final)
        data = self._connection.send(event=data)
        await self._sock.send_all(data)
847933
private void sendCompleteStatus() {
        // may be the correct duration
        int duration = (lastMessageTs > 0) ? Math.max(0, lastMessageTs - streamStartTS.get()) : 0;
        if (log.isDebugEnabled()) {
            log.debug("sendCompleteStatus - duration: {} bytes sent: {}", duration, bytesSent.get());
        }
        sendOnPlayStatus(StatusCodes.NS_PLAY_COMPLETE, duration, bytesSent.get());
    }
544001
function sendCommand(sensor, cmd, callback)
{
    // commands need to be terminated with a carriage return
    cmd += "\r";
    sensor.writeDataStr(cmd);

    // wait up to 1 second
    if (sensor.dataAvailable(1000))
    {
	console.log("Returned: " + sensor.readDataStr(1024));
    }
    else
	console.log("Timed out waiting for response");

    if (callback)
	callback();
}
1269708
def on_message_received(self, msg):
        
        if self.is_stopped:
            raise RuntimeError("reader has already been stopped")
        else:
            self.buffer.put(msg)
830130
def send(self, data):
        
        self.stdin.write(data)
        self.stdin.flush()
945478
def complete(self, msg):
        """"""
        if _debug: IOCB._debug("complete(%d) %r", self.ioID, msg)

        if self.ioController:
            # pass to controller
            self.ioController.complete_io(self, msg)
        else:
            # just fill in the data
            self.ioState = COMPLETED
            self.ioResponse = msg
            self.trigger()
1296176
def write(self, text, fg='black', bg='white'):
        ''''''
        try:
            self.parent_pipe_send.send(Text(text, fg, bg))
        except Exception:
            pass
678679
def send(self, message, _sender=None):
        """"""
        if not _sender:
            context = get_context()
            if context:
                _sender = context.ref
        if self._cell:
            if not self._cell.stopped:
                self._cell.receive(message, _sender)
                return
            else:
                self._cell = None
        if not self.is_local:
            if self.uri.node != self.node.nid:
                self.node.send_message(message, remote_ref=self, sender=_sender)
            else:
                self._cell = self.node.guardian.lookup_cell(self.uri)
                self.is_local = True
                self._cell.receive(message, _sender)
        else:
            if self.node and self.node.guardian:
                cell = self.node.guardian.lookup_cell(self.uri)
                if cell:
                    cell.receive(message, _sender)  # do NOT set self._cell--it will never be unset and will cause a memleak
                    return
            if ('_watched', ANY) == message:
                message[1].send(('terminated', self), _sender=self)
            elif (message == ('terminated', ANY) or message == ('_unwatched', ANY) or message == ('_node_down', ANY) or
                  message == '_stop' or message == '_kill' or message == '__done'):
                pass
            else:
                Events.log(DeadLetter(self, message, _sender))