build_flat_msg

        :param id: unique id for this message
        :param msg: message dictionary to flatten
352633
def build_flat_msg(self,
                       id=None,
                       msg=None):
        

        flat_msg = {}

        if not id:
            log.error("Please pass in an id")
            return None
        if not msg:
            log.error("Please pass in a msg")
            return None

        for k in msg["data"]:
            if k == "ether":
                flat_msg.update(self.process_ether_frame(
                                    id=id,
                                    msg=msg["data"][k]))
            # end of ether
            elif k == "ip":
                flat_msg.update(self.process_ip_frame(
                                    id=id,
                                    msg=msg["data"][k]))
            # end of ip
            elif k == "ipv6":
                flat_msg.update(self.process_ipvsix_frame(
                                    id=id,
                                    msg=msg["data"][k]))
            # end of ipv6
            elif k == "tcp":
                flat_msg.update(self.process_tcp_frame(
                                    id=id,
                                    msg=msg["data"][k]))
            # end of tcp
            elif k == "udp":
                flat_msg.update(self.process_udp_frame(
                                    id=id,
                                    msg=msg["data"][k]))
            # end of udp
            elif k == "dns":
                flat_msg.update(self.process_dns_frame(
                                    id=id,
                                    msg=msg["data"][k]))
            # end of dns
            elif k == "icmp":
                flat_msg.update(self.process_icmp_frame(
                                    id=id,
                                    msg=msg["data"][k]))
            # end of icmp
            elif k == "arp":
                flat_msg.update(self.process_arp_frame(
                                    id=id,
                                    msg=msg["data"][k]))
            # end of arp
            elif k == "raw":
                flat_msg.update(self.process_raw_frame(
                                    id=id,
                                    msg=msg["data"][k]))
            # end of raw
            elif k == "padding":
                flat_msg.update(self.process_pad_frame(
                                    id=id,
                                    msg=msg["data"][k]))
            # end of pad
            else:
                log.error(("Unsupported frame type={} "
                           "please file an issue to track this "
                           "with data={} msg={}")
                          .format(k,
                                  ppj(msg["data"][k]),
                                  msg["data"]))
        # end of processing new message

        return flat_msg
611832
def _pop_states(self, msg_id):
        
        state = self._pending_state.pop(msg_id, None)
        if state:
            return [state]

        to_pop = []
        for state in self._pending_state.values():
            if state.container_id == msg_id:
                to_pop.append(state.msg_id)

        if to_pop:
            return [self._pending_state.pop(x) for x in to_pop]

        for ack in self._last_acks:
            if ack.msg_id == msg_id:
                return [ack]

        return []
606677
def unpack_messages(self, partitions_msgs):
        

        for pmsg in partitions_msgs:
            key = pmsg['_key']
            partition = pmsg['partition']
            offset = pmsg['offset']
            msg = pmsg.pop('message')
            if msg:
                try:
                    record = self.deserialize_fun(msg)
                except Exception as e:
                    log.error('Error unpacking record at partition:offset {}:{} (key: {} : {})'.format(partition, offset, key, repr(e)))
                    continue
                else:
                    if isinstance(record, dict):
                        pmsg['record'] = record
                        yield pmsg
                    else:
                        log.info('Record {} has wrong type'.format(key))
            else:
                yield pmsg
571741
def process_ip_frame(self,
                         id=None,
                         msg=None):
        

        # normalize into a dataframe
        df = json_normalize(msg)
        # convert to a flattened dictionary
        dt = json.loads(df.to_json())

        flat_msg = {}

        for k in dt:
            new_key = "ip_{}".format(k)
            flat_msg[new_key] = dt[k]["0"]
            if new_key not in self.ip_keys:
                self.ip_keys[new_key] = k
        # end of capturing all unique keys

        dt["ip_id"] = id
        self.all_ip.append(dt)

        log.debug("IP data updated:")
        log.debug(self.ip_keys)
        log.debug(self.all_ip)
        log.debug("")

        return flat_msg
1056444
def mget(msg_id, keys)
      keys = keys.map{|suffix| key(msg_id, suffix)}
      with_failover { redis.mget(*keys) }
    end
1188347
def send_msg(self, chat_id, msg_type, **kwargs):
        
        return self.send(chat_id, msg_type, **kwargs)
1146142
def message(self, msg):
        
        for broker in self.message_brokers:
            try:
                broker(msg)
            except Exception as exc:
                utils.error(exc)
307619
@SuppressWarnings("unchecked") // The constructor guarantees the type of ImmutableList.
  private SoyMsg resurrectMsg(long id, ImmutableList<SoyMsgPart> parts) {
    return SoyMsg.builder()
        .setId(id)
        .setLocaleString(localeString)
        .setIsPlrselMsg(MsgPartUtils.hasPlrselPart(parts))
        .setParts(parts)
        .build();
  }
514068
def _generate_message_error(cls, response_code, messages, response_id):
        

        line_response_code = cls._FORMAT_RESPONSE_CODE_LINE \
            .format(response_code)
        line_response_id = cls._FORMAT_RESPONSE_ID_LINE.format(response_id)
        line_error_message = cls._FORMAT_ERROR_MESSAGE_LINE.format(
            cls._GLUE_ERROR_MESSAGE_STRING_EMPTY.join(messages)
        )

        return cls._glue_all_error_message(
            [line_response_code, line_response_id, line_error_message]
        )
228931
public SimpleDialog message(int id){
        return message(id == 0 ? null : getContext().getResources().getString(id));
    }
1049328
def build_message(self):
        
        if self.params is None:
            inline_params = ""
        else:
            # Put all params in one string
            inline_params = ""
            if type(self.params) is list:
                for x in self.params:
                    if x != self.params[0]:
                        inline_params += ", "
                    if type(x) is int:
                        inline_params += str(x)
                    else:
                        inline_params += '"{}"'.format(x)
            else:
                inline_params += '"{}"'.format(self.params)

        # Build message with that string
        self.message = self.COMMAND_BODY.format(str(self.command_id), self.method, inline_params)
392226
def warn(message, ids: [], &block)
      msg = ids.empty? ? '' : "[#{ids.map!(&:to_s).map(&:inspect).join(', ')}] "
      msg += message
      @logger.warn(msg, &block) unless (@ignored & ids).any?
    end
376390
def send_message(self, msg, connection_id=None):
        
        zmq_identity = None
        if connection_id is not None and self._connections is not None:
            if connection_id in self._connections:
                connection_info = self._connections.get(connection_id)
                if connection_info.connection_type == \
                        ConnectionType.ZMQ_IDENTITY:
                    zmq_identity = connection_info.connection
            else:
                LOGGER.debug("Can't send to %s, not in self._connections",
                             connection_id)

        self._ready.wait()

        if zmq_identity is None:
            message_bundle = [msg.SerializeToString()]
        else:
            message_bundle = [bytes(zmq_identity),
                              msg.SerializeToString()]

        try:
            asyncio.run_coroutine_threadsafe(
                self._send_message_frame(message_bundle),
                self._event_loop)
        except RuntimeError:
            # run_coroutine_threadsafe will throw a RuntimeError if
            # the eventloop is closed. This occurs on shutdown.
            pass
447795
def _get_new_msg_id(self):
        
        now = time.time() + self.time_offset
        nanoseconds = int((now - int(now)) * 1e+9)
        new_msg_id = (int(now) << 32) | (nanoseconds << 2)

        if self._last_msg_id >= new_msg_id:
            new_msg_id = self._last_msg_id + 4

        self._last_msg_id = new_msg_id
        return new_msg_id
163387
def handle_message(self, msg):
        
        self._messages.append({
            'type': msg.category,
            'module': msg.module,
            'obj': msg.obj,
            'line': msg.line,
            'column': msg.column,
            'path': msg.path,
            'symbol': msg.symbol,
            'message': str(msg.msg) or '',
            'message-id': msg.msg_id,
        })
749670
public static UniversalIdStrQueueMessage newInstance(String id, String content) {
        UniversalIdStrQueueMessage msg = newInstance(content);
        msg.setId(id);
        return msg;
    }
1171198
public String getMessage(String id, String defaultMsg) {
    return getMessage(id, lang, defaultMsg);
  }