Creates a message from a string, substituting the necessary parameters,
        that is ready to send to the socket
178739
def create_send_message(self, string_message, controller, zone=None, parameter=None):
        

        cc = hex(int(controller) - 1).replace('0x', '')  # RNET requires controller value to be zero based
        if zone is not None:
            zz = hex(int(zone) - 1).replace('0x', '')  # RNET requires zone value to be zero based
        else:
            zz = ''
        if parameter is not None:
            pr = hex(int(parameter)).replace('0x', '')
        else:
            pr = ''

        string_message = string_message.replace('@cc', cc)  # Replace controller parameter
        string_message = string_message.replace('@zz', zz)  # Replace zone parameter
        string_message = string_message.replace('@kk', KEYPAD_CODE)  # Replace keypad parameter
        string_message = string_message.replace('@pr', pr)  # Replace specific parameter to message

        # Split message into an array for each "byte" and add the checksum and end of message bytes
        send_msg = string_message.split()
        send_msg = self.calc_checksum(send_msg)
        return send_msg
1104135
function createMessage(status) {

        var message = [];

        message.push(broadcastIdentifier);
        message.push(compabilityVersion);
        message.push(netId);
        message.push(id);
        message.push(name);
        message.push(self.port);
        message.push(status);
        //message.push(mode);
        payloadLength = payload.length;
        message.push(payloadLength + ':' + payload);

        var messageString = message.join(" ");

        return new Buffer(messageString);

    }
1057674
def from_bytes(self, string):
        """"""
        msg = srsly.msgpack_loads(gzip.decompress(string))
        self.attrs = msg["attrs"]
        self.strings = set(msg["strings"])
        lengths = numpy.fromstring(msg["lengths"], dtype="int32")
        flat_spaces = numpy.fromstring(msg["spaces"], dtype=bool)
        flat_tokens = numpy.fromstring(msg["tokens"], dtype="uint64")
        shape = (flat_tokens.size // len(self.attrs), len(self.attrs))
        flat_tokens = flat_tokens.reshape(shape)
        flat_spaces = flat_spaces.reshape((flat_spaces.size, 1))
        self.tokens = NumpyOps().unflatten(flat_tokens, lengths)
        self.spaces = NumpyOps().unflatten(flat_spaces, lengths)
        for tokens in self.tokens:
            assert len(tokens.shape) == 2, tokens.shape
        return self
795104
def from_buffer(string, config_path=None):
    '''
    
    '''
    status, response = callServer('put', ServerEndpoint, '/detect/stream', string,
                                  {'Accept': 'text/plain'}, False, config_path=config_path)
    return response
160408
def send_raw(self, string):
        
        if self.socket is None:
            raise ServerNotConnectedError("Not connected.")
        sender = getattr(self.socket, 'write', self.socket.send)
        try:
            sender(self._prep_message(string))
            log.debug("TO SERVER: %s", string)
        except socket.error:
            # Ouch!
            self.disconnect("Connection reset by peer.")
873969
private static String createMessage(String fieldName, String value) {
        StringBuffer buf = new StringBuffer().append("Value ");

        if (value == null) {
            buf.append("null");
        } else {
            buf.append('"');
            buf.append(value);
            buf.append('"');
        }

        buf.append(" for ").append(fieldName).append(' ').append("is not supported");
        
        return buf.toString();
    }
872147
public String createMessageData(String message) {

		messageStringBuffer.delete(0, messageStringBuffer.length());

		// Create the PRI part
		messageStringBuffer.append('<');
		int priority = facility * 8 + severity;
		messageStringBuffer.append(priority);
		messageStringBuffer.append('>');

		// Create the HEADER part.
		if (header) {
			// Add the TIMESTAMP field of the HEADER
			// Time format is "Mmm dd hh:mm:ss". For more info see rfc3164.
			long currentTime = System.currentTimeMillis();
			calendar.setTime(new Date(currentTime));

			messageStringBuffer.append(SyslogMessage.MONTHS[calendar
					.get(Calendar.MONTH)]);
			messageStringBuffer.append(' ');

			int dayOfMonth = calendar.get(Calendar.DAY_OF_MONTH);
			if (dayOfMonth < SyslogMessage.TEN) {
				messageStringBuffer.append('0');
			}
			messageStringBuffer.append(dayOfMonth);
			messageStringBuffer.append(' ');

			int hour = calendar.get(Calendar.HOUR_OF_DAY);
			if (hour < SyslogMessage.TEN) {
				messageStringBuffer.append('0');
			}
			messageStringBuffer.append(hour);
			messageStringBuffer.append(':');

			int minute = calendar.get(Calendar.MINUTE);
			if (minute < SyslogMessage.TEN) {
				messageStringBuffer.append('0');
			}
			messageStringBuffer.append(minute);
			messageStringBuffer.append(':');

			int second = calendar.get(Calendar.SECOND);
			if (second < SyslogMessage.TEN) {
				messageStringBuffer.append('0');
			}
			messageStringBuffer.append(second);
			messageStringBuffer.append(' ');

			// Add the HOSTNAME part of the message
			messageStringBuffer.append(hostname);
		}

		// Create the MSG part.
		messageStringBuffer.append(' ');
		messageStringBuffer.append(tag);
		messageStringBuffer.append(": ");
		messageStringBuffer.append(message);

		return messageStringBuffer.toString();
	}
989794
def from_bytes(VarInt, byte_string):
        '''
        
        '''
        num = byte_string
        if num[0] <= 0xfc:
            num = num[0:1]
            non_compact = False
        elif num[0] == 0xfd:
            num = num[1:3]
            non_compact = (num[-1:] == b'\x00')
        elif num[0] == 0xfe:
            num = num[1:5]
            non_compact = (num[-2:] == b'\x00\x00')
        elif num[0] == 0xff:
            num = num[1:9]
            non_compact = (num[-4:] == b'\x00\x00\x00\x00')
        if len(num) not in [1, 2, 4, 8]:
            raise ValueError('Malformed VarInt. Got: {}'
                             .format(byte_string.hex()))

        if (non_compact
            and ('overwinter' in riemann.get_current_network_name()
                 or 'sapling' in riemann.get_current_network_name())):
            raise ValueError('VarInt must be compact. Got: {}'
                             .format(byte_string.hex()))

        ret = VarInt(
            utils.le2i(num),
            length=len(num) + 1 if non_compact else 0)

        return ret
1062238
@Nonnull
    public static String constructMessage(
            @Nullable Throwable e, @Nullable String newMessage, @Nullable Object... messageParams) {
        String message;
        if (newMessage == null) {
            if (e == null) {
                message = UNKNOWN_PROBLEM;
            } else {
                message = e.getMessage();
            }
        } else {
            message = String.format(newMessage, messageParams);
        }
        return message;
    }
625818
def from_string(cls, hash, **context):
        """"""
        salt, checksum = parse_mc2(hash, cls.ident, handler=cls)

        return cls(salt=salt, checksum=checksum)
418540
function stringToStream(string) {
    let s = new stream.Readable();
    s.push(string);
    s.push(null);
    return s;
}
130524
def from_string(s):
        """"""

        if not len(s):
            raise ValueError("Invalid parameter string.")

        params = parse_qs(u(s), keep_blank_values=False)
        if not len(params):
            raise ValueError("Invalid parameter string.")

        try:
            key = params['oauth_token'][0]
        except Exception:
            raise ValueError("'oauth_token' not found in OAuth request.")

        try:
            secret = params['oauth_token_secret'][0]
        except Exception:
            raise ValueError("'oauth_token_secret' not found in " 
                "OAuth request.")

        token = Token(key, secret)
        try:
            token.callback_confirmed = params['oauth_callback_confirmed'][0]
        except KeyError:
            pass  # 1.0, no callback confirmed.
        return token
1106698
def from_string(cls, string):
        
        fields = string.split(None, 2)
        if len(fields) < 2:
            msg = "Not enough fields for public blob: {}"
            raise ValueError(msg.format(fields))
        key_type = fields[0]
        key_blob = decodebytes(b(fields[1]))
        try:
            comment = fields[2].strip()
        except IndexError:
            comment = None
        # Verify that the blob message first (string) field matches the
        # key_type
        m = Message(key_blob)
        blob_type = m.get_text()
        if blob_type != key_type:
            deets = "key type={!r}, but blob type={!r}".format(
                key_type, blob_type
            )
            raise ValueError("Invalid PublicBlob contents: {}".format(deets))
        # All good? All good.
        return cls(type_=key_type, blob=key_blob, comment=comment)
988950
def put(self, message):
        
        return self.connection.put('echo/string', data=dict(message=message))
1044587
public static String encode(String message, int offset) {
		final int len = message.length();
		final char[] plain = message.toCharArray();
		char c;
		for (int i = 0; i < len; i++) {
			c = message.charAt(i);
			if (false == Character.isLetter(c)) {
				continue;
			}
			plain[i] = encodeChar(c, offset);
		}
		return new String(plain);
	}
76175
def send_raw(self, string):
        
        log.debug('RAW: {}'.format(string))
        if self.transport is None:
            raise ServerNotConnectedError("Not connected.")

        self.transport.write(self._prep_message(string))
365556
def process_message(self,msg,sock):
    ""
    command=msg[0]
    try: f={'GET':self.get,'SET':self.set,'SUBSCRIBE':self.sub,'PUBLISH':self.pub,
      'PING':self.ping,'GETSET':self.getset,'EXPIRE':self.expire,'DEL':self.delete}[command]
    except KeyError: print msg; raise
    args=msg[1:]
    try: return f(sock,*args) if command in self.SOCK_COMMANDS else f(*args)
    except Exception as e:
      print e
      print msg
      return '-ERROR\r\n'