Send out the escape sequence which will accomplish the desired state
343558
public function outputEscapeSequence() {

        // send out any escaping to implement anything sitting in the desired state
        $this->output($this->generator->generate($this->currentState, $this->desiredState));

        // copy the current state to the now achieved desired state
        $this->currentState = clone $this->desiredState;
    }
5822
private void escape(String value) {
        int n = value.length();
        int i = 0;
        for (int j = 0; j < n; ++j) {
            int k = ESCAPED_CHARS.indexOf(value.charAt(j));
            if (k >= 0) {
                if (i < j) {
                    append(value, i, j);
                }
                append(ESCAPE_SEQ[k]);
                i = j + 1;
            }
        }
        if (i < n) {
            append(value, i, n);
        }
    }
28968
def send_exit(cls, sock, payload=b''):
    """"""
    cls.write_chunk(sock, ChunkType.EXIT, payload)
173607
def _send(self, command):
        
        command = command.encode('utf-8')
        log.debug('>> ' + command)
        self.conn.oqueue.put(command)
784344
def escape(s):
    """"""
    if not isinstance(s, bytes):
        s = s.encode('utf-8')
    return quote(s, safe='~')
595617
public void send(CharSequence text) {
    int currentIndex = 0;
    while (currentIndex < text.length()) {
      char currentCharacter = text.charAt(currentIndex);
      if (AndroidKeys.hasAndroidKeyEvent(currentCharacter)) {
        // The next character is special and must be sent individually
        int keyCode = AndroidKeys.keyCodeFor(currentCharacter);
        if (keyCode == KeyEvent.KEYCODE_HOME) {
          throw new RuntimeException(
              "It is not possible to simulate the HOME key using instrumentation. " +
              "Please use adb, e.g. 'adb shell input keyevent 3'.");
        }
        SelendroidLogger.debug("Send keys, sending special key code");
        instrumentation.sendKeyDownUpSync(keyCode);
        currentIndex++;
      } else {
        // There is at least one "normal" character, that is a character
        // represented by a plain Unicode character that can be sent with
        // sendStringSync. So send as many such consecutive normal characters
        // as possible in a single String.
        int nextSpecialKey = indexOfSpecialKey(text, currentIndex);
        SelendroidLogger.debug("Send keys, sending string");
        instrumentation.sendStringSync(text.subSequence(currentIndex, nextSpecialKey).toString());
        currentIndex = nextSpecialKey;
      }
    }
  }
526633
def write(self, req, ino, buf, off, fi):
        
        self.reply_err(req, errno.EROFS)
135377
def prompt(msg, default=None):
    ""
    if default is not None:
        msg = '{} ({})'.format(msg, repr(default))
    msg = '{}: '.format(msg)
    try:
        s = input(msg)
    except KeyboardInterrupt:
        exit(1)
    except EOFError:
        s = ''
    if not s:
        s = default
    return s
1281200
public void sendTriState(String codeWord) {
        if (transmitterPin != null) {
            for (int nRepeat = 0; nRepeat < repeatTransmit; nRepeat++) {
                for (int i = 0; i < codeWord.length(); ++i) {
                    switch (codeWord.charAt(i)) {
                        case '0':
                            this.sendT0();
                            break;
                        case 'F':
                            this.sendTF();
                            break;
                        case '1':
                            this.sendT1();
                            break;
                    }
                }
                this.sendSync();
            }
            transmitterPin.low();
        }
    }
302711
def escape(string, escape_pattern):
    """"""
    try:
        return string.translate(escape_pattern)
    except AttributeError:
        warnings.warn("Non-string-like data passed. "
                      "Attempting to convert to 'str'.")
        return str(string).translate(tag_escape)
307891
def underline(self, action):
        '''
        '''
        if action == 'off':
            action = '0'
            self.send(chr(27)+chr(45)+action)
        else:
            self.send(chr(27)+chr(45)+action)
310698
private static void escape(OutputAccessor out, int charToEscape) {

        out.write('\\');
        out.write('u');
        if (charToEscape > 0xFF) {
            int hi = (charToEscape >> 8) & 0xFF;
            out.write(HEX_BYTES[hi >> 4]);
            out.write(HEX_BYTES[hi & 0xF]);
            charToEscape &= 0xFF;
        } else {
            out.write((byte) '0');
            out.write((byte) '0');
        }
        // We know it's a control char, so only the last 2 chars are non-0
        out.write(HEX_BYTES[charToEscape >> 4]);
        out.write(HEX_BYTES[charToEscape & 0xF]);
    }
414783
public byte[] sendUnbindResp(OutputStream os, int commandStatus,
            int sequenceNumber) throws IOException {
        byte[] b = pduComposer.unbindResp(commandStatus, sequenceNumber);
        writeAndFlush(os, b);
        return b;
    }
375118
def escape_control_chars!(string)
      string.gsub!(CONTROL_CHARACTERS) do |character|
        UTF8Encoding::REPLACEMENT_SCHEME[character]
      end
      string
    end
969817
def flexifunction_command_ack_send(self, command_type, result, force_mavlink1=False):
                '''
                

                '''
                return self.send(self.flexifunction_command_ack_encode(command_type, result), force_mavlink1=force_mavlink1)
247201
private String escape(final String string, final State inState) {
        if (string == null) { return null; }
        State state = inState;
        final int length = string.length();
        for (int index = 0; index < length; index++) {
            /* We don't do anything with the protocol separator */
            if (state == State.HOST && string.indexOf(PROTOCOL_SEPARATOR) == index) {
                index += PROTOCOL_SEPARATOR.length();
                continue;
            }
            final char c = string.charAt(index);
            if (HOST_SEPARATOR.matches(c) && state == State.HOST) {
                state = State.PATH;
            }
            if (FRAG_SEPARATOR.matches(c) && state != State.FRAGMENT && state != State.QUERY_PARAM) {
                /* Switch state - don't do anything with this character */
                state = State.FRAGMENT;
            } else if (QUERY_SEPARATOR.matches(c) && (state == State.PATH || state == State.HOST)) {
                /* Switch state - don't do anything with this character */
                state = State.QUERY;
            } else {
                final String encodeString = encodeCharAtIndex(string, index, state);
                if (encodeString != null) {
                    /* We are supposed to encode this character - recursively call for the remainder of the string */
                    return string.substring(0, index) + encodeString + escape(string.substring(index + 1), state);
                }
            }
        }
        return string;
    }
413341
def handle(send, msg, args):
    """"""
    output = textutils.gen_xkcd_sub(msg, True)
    if output is None:
        return
    if args['type'] == 'action':
        send("correction: * %s %s" % (args['nick'], output))
    else:
        send("%s actually meant: %s" % (args['nick'], output))