return innermsg chunk (dict)
9452
def __make_innermsg(resource, rtype, ref, action=None, payload=None, limit=None):
        
        if action is not None and not isinstance(action, (tuple, list)):
            raise TypeError('action must be None/tuple/list')
        p = {M_RESOURCE: resource,
             M_TYPE: int(rtype),
             M_CLIENTREF: ref,
             # Ensure action path consists only of strings
             M_ACTION: tuple(u(element) for element in action) if action else None,
             M_PAYLOAD: payload}
        if limit is not None:  # Note: fmtted like "0/15" where 0 = offset, 15 = limit
            p[M_RANGE] = limit
        return p
771127
function (str) {
    str = str.split('Blockly.Msg.')[1].split(' ');
    return {
        key: str[0],
        value: str
            .splice(2, str.length)
            .join(' ')
            .slice(1, -2) // strip off initial ', and ending ';
            .replace(/\\'/g, "'")
    };
}
647996
def to_bytes(self):
        """"""
        for tokens in self.tokens:
            assert len(tokens.shape) == 2, tokens.shape
        lengths = [len(tokens) for tokens in self.tokens]
        msg = {
            "attrs": self.attrs,
            "tokens": numpy.vstack(self.tokens).tobytes("C"),
            "spaces": numpy.vstack(self.spaces).tobytes("C"),
            "lengths": numpy.asarray(lengths, dtype="int32").tobytes("C"),
            "strings": list(self.strings),
        }
        return gzip.compress(srsly.msgpack_dumps(msg))
444843
def byteswap(s):
    
    assert len(s) % 2 == 0
    parts = []
    for i in range(0, len(s), 2):
        chunk = s[i:i + 2]
        newchunk = struct.pack('<h', *struct.unpack('>h', chunk))
        parts.append(newchunk)
    return b''.join(parts)
1065294
def _perform_chunking(func_, *args, **kwargs):
    
    obj_dict = args[0]
    start_point = 0
    file_count = 0
    new_dict = {}
    resp_dict = Counter({})
    file_list = []
    while start_point < len(obj_dict[CONTENT_FIELD]):
        file_count += 1
        chunk_fn = CHUNK_POSTFIX.format(obj_dict[PRIMARY_FIELD],
                                        str(file_count).zfill(CHUNK_ZPAD))
        new_dict[PRIMARY_FIELD] = chunk_fn
        file_list.append(new_dict[PRIMARY_FIELD])
        new_dict[CONTENTTYPE_FIELD] = obj_dict[CONTENTTYPE_FIELD]
        new_dict[TIMESTAMP_FIELD] = obj_dict[TIMESTAMP_FIELD]
        end_point = file_count * MAX_PUT
        sliced = obj_dict[CONTENT_FIELD][start_point: end_point]
        new_dict[CONTENT_FIELD] = sliced
        new_dict[PART_FIELD] = True
        new_dict[PARENT_FIELD] = obj_dict[PRIMARY_FIELD]
        start_point = end_point
        new_args = (new_dict, args[1])
        resp_dict += Counter(func_(*new_args, **kwargs))

    obj_dict[CONTENT_FIELD] = b""
    obj_dict[PARTS_FIELD] = file_list
    obj_dict[PART_FIELD] = False
    new_args = (obj_dict, args[1])
    resp_dict += Counter(func_(*new_args, **kwargs))
    return resp_dict
258392
def get_message(self):
        """"""

        result = ''
        if self._data_struct is not None:
            result = self._data_struct[KEY_MESSAGE]
        return result
1041811
function flattenMessageMap(data) {
    var obj = {};
    var newKey;

    _.each(data, function(groupMessages, key) {
        _.each(groupMessages, function(message, subKey) {
            newKey = [key, subKey].join('.');
            obj[newKey] = message;
        });
    }, this);

    return obj;
}
789149
function getText(msg) {
    return msg.parts.filter(function (part) {
      return part.mime_type === 'text/plain';
    }).map(function (part) {
      return part.body;
    }).join('; ');
  }
82105
def cardChunk(key, chunk):
    
    for line in chunk:
        values = []
        sline = line.strip().split()

        for idx in range(1, len(sline)):
            values.append(sline[idx])

    return {'card': sline[0],
            'values': values}
521832
def parse(msg):
        
        sender, conn_id, path, rest = msg.split(' ', 3)
        headers, rest = tnetstring.pop(rest)
        body, _ = tnetstring.pop(rest)

        if type(headers) is str:
            headers = json.loads(headers)

        return MongrelRequest(sender, conn_id, path, headers, body)
604416
function processMultiBytePacketStop (o) {
  processMultiBytePacket(o);
  const str = o.multiPacketBuffer.toString();
  o.multiPacketBuffer = null;
  return {
    'message': str
  };
}
1303755
def to_dict(self):
        

        msg_dict = {}
        msg_dict['level'] = self.level
        msg_dict['message'] = self.message
        msg_dict['now_time'] = monotonic()
        msg_dict['created_time'] = self.created
        msg_dict['id'] = self.id
        msg_dict['count'] = self.count

        return msg_dict
383579
def walk(self) -> Iterable['MessageContent']:
        
        if self.body.has_nested:
            return chain([self], *(part.walk() for part in self.body.nested))
        else:
            return [self]
513357
def _from_dict(cls, _dict):
        """"""
        args = {}
        if 'message_type' in _dict:
            args['message_type'] = _dict.get('message_type')
        if 'text' in _dict:
            args['text'] = _dict.get('text')
        if 'options' in _dict:
            args['options'] = MessageInputOptions._from_dict(
                _dict.get('options'))
        if 'intents' in _dict:
            args['intents'] = [
                RuntimeIntent._from_dict(x) for x in (_dict.get('intents'))
            ]
        if 'entities' in _dict:
            args['entities'] = [
                RuntimeEntity._from_dict(x) for x in (_dict.get('entities'))
            ]
        if 'suggestion_id' in _dict:
            args['suggestion_id'] = _dict.get('suggestion_id')
        return cls(**args)
1211862
def _StructMessageToJsonObject(self, message):
    """"""
    fields = message.fields
    ret = {}
    for key in fields:
      ret[key] = self._ValueMessageToJsonObject(fields[key])
    return ret
151115
def pub_msg(self, msg):
        """"""
        topic = msg.get('topic')
        self.pub_socket.send_multipart(
            [pickle.dumps(topic), pickle.dumps(msg)])

        for h in self._handle_funcs.get(topic, []):
            h(msg)
536831
function getCumulativeMessages(timestamp, clientSync) {
    var msgs = [];
    if (lastSync > clientSync) {
        msgs = messages;
    } else {
        var newMsgs = messages.length;
        while (newMsgs > 0 && messages[newMsgs - 1].timestamp > timestamp) {
            newMsgs--;
        }
        for (var i = newMsgs; i < messages.length; i++) {
            msgs.push(messages[i]);
        }
    }

    var data = {};
    data.msgs = msgs;
    data.lastSync = lastSync;

    return data;
}