It extracts irc msg arguments.
976934
def extract_args(self, data):
        
        args = []
        data = data.strip(' ')
        if ':' in data:
            lhs, rhs = data.split(':', 1)
            if lhs: args.extend(lhs.rstrip(' ').split(' '))
            args.append(rhs)
        else:
           args.extend(data.split(' '))
        return tuple(args)
509811
def _parse_args():
    """"""
    parser = argparse.ArgumentParser(description='{} service.'.
                                     format(__service_id__))
    parser.add_argument('--random_errors', action='store_true',
                        help='Enable random errors')
    parser.add_argument('-v', action='store_true',
                        help='Verbose mode (enable debug printing)')
    parser.add_argument('-vv', action='store_true', help='Extra verbose mode')
    args = parser.parse_args()

    if args.vv:
        init_logger(log_level='DEBUG', show_log_origin=True)
    elif args.v:
        init_logger(logger_name='sip.ec.master_controller', log_level='DEBUG')
    else:
        init_logger(log_level='INFO')

    return args
888824
def parse_out_ips(message):
    """"""

    ips = []
    for entry in message.answer:
        for rdata in entry.items:
            ips.append(rdata.to_text())
    return ips
747704
def _process_line(self, line):
        
        m = self._rfc_1459_command_regexp.match(line)
        prefix = m.group('prefix')
        tags = self._process_tags(m.group('tags'))
        source = self._process_prefix(prefix)
        command = self._process_command(m.group('command'))
        arguments = self._process_arguments(m.group('argument'))
        if not self.real_server_name:
            self.real_server_name = prefix

        # Translate numerics into more readable strings.
        command = irc.events.numeric.get(command, command)
        if command not in ["privmsg", "notice"]:
            return super(ServerConnection3, self)._process_line(line)

        event = Event3("all_raw_messages", self.get_server_name(),
                       None, [line], tags=tags)
        self._handle_event(event)

        target, msg = arguments[0], arguments[1]
        messages = irc.ctcp.dequote(msg)
        command = self._resolve_command(command, target)
        for m in messages:
            self._handle_message(tags, source, command, target, m)
1027921
def ctcp_unpack_message(info):
    """"""
    verb = info['verb']
    message = info['params'][1]

    # NOTE: full CTCP dequoting and unpacking is not done here, only a subset
    #   this is because doing the full thing breaks legitimate messages

    # basics
    infos = []

    X_QUOTE = '\\'
    X_DELIM = '\x01'

    # tagged data
    messages = str(message).split(X_DELIM)

    for i in range(len(messages)):
        msg = messages[i]
        new_info = dict(info)

        if i % 2 == 0:  # is normal message)
            if not msg:
                continue
            new_info['params'] = new_info['params'][:1]
            new_info['params'].append(msg)
        else:
            if verb in ['privnotice', 'pubnotice']:
                new_info['verb'] = 'ctcp_reply'
            else:
                new_info['verb'] = 'ctcp'
            if ' ' in msg.lstrip():
                new_info['ctcp_verb'], new_info['ctcp_text'] = msg.lstrip().split(' ', 1)
            else:
                new_info['ctcp_verb'] = msg.lstrip()
                new_info['ctcp_text'] = ''

            new_info['ctcp_verb'] = new_info['ctcp_verb'].lower()

        infos.append([new_info['verb'], new_info])

    # ctcp-level dequoting
    for i in range(len(infos)):
        if infos[i][NAME_ATTR] == 'ctcp':
            attrs = ['ctcp_verb', 'ctcp_text']
        else:
            attrs = ['params']

        for attr in attrs:
            if isinstance(infos[i][INFO_ATTR][attr], (list, tuple)):
                raw_messages = infos[i][INFO_ATTR][attr]
            else:
                raw_messages = [infos[i][INFO_ATTR][attr]]

            messages = []
            for raw in raw_messages:
                unquoted = ''
                while len(raw):
                    char = raw[0]
                    raw = raw[1:]

                    if char == X_QUOTE:
                        if not len(raw):
                            continue
                        key = raw[0]
                        raw = raw[1:]

                        if key == 'a':
                            unquoted += X_DELIM
                        elif key == X_QUOTE:
                            unquoted += X_QUOTE
                        else:
                            unquoted += key
                    else:
                        unquoted += char
                messages.append(unquoted)

            if isinstance(infos[i][INFO_ATTR][attr], (list, tuple)):
                infos[i][INFO_ATTR][attr] = messages
            else:
                infos[i][INFO_ATTR][attr] = messages[0]

    return infos
402241
def encodeMsg(self, mesg):
        ''''''

        fmt = self.locs.get('log:fmt')
        if fmt == 'jsonl':
            s = json.dumps(mesg, sort_keys=True) + '\n'
            buf = s.encode()
            return buf

        elif fmt == 'mpk':
            buf = s_msgpack.en(mesg)
            return buf

        mesg = f'Unknown encoding format: {fmt}'
        raise s_exc.SynErr(mesg=mesg)
449222
def getMessage(self):
        
        if isinstance(self.msg, numpy.ndarray):
            msg = self.array2string(self.msg)
        else:
            msg = str(self.msg)
        if self.args:
            a2s = self.array2string
            if isinstance(self.args, Dict):
                args = {k: (a2s(v) if isinstance(v, numpy.ndarray) else v)
                        for (k, v) in self.args.items()}
            elif isinstance(self.args, Sequence):
                args = tuple((a2s(a) if isinstance(a, numpy.ndarray) else a)
                             for a in self.args)
            else:
                raise TypeError("Unexpected input '%s' with type '%s'" % (self.args,
                                                                          type(self.args)))
            msg = msg % args
        return msg
411531
def parse_args():
    """"""
    parser = argparse.ArgumentParser(
        description=HELPTEXT,
        epilog="This application is powered by elks with superpowers!")
    parser.add_argument('--version', action='store_true',
                        help="Display elkme version and exit")
    parser.add_argument('-v', '--verbose', action='count',
                        help="Debug output", default=0)
    parser.add_argument('message', metavar='message', type=str, nargs='*',
                        help="The message to be sent (<160 characters)")
    parser.add_argument('-f', '--file', metavar='file', action='store',
                        help="""File to read message from (only the
                        first 160 characters are sent)""")
    parser.add_argument('-t', '--to', dest='to', action='store',
                        help="Phone number to receive the text message")
    parser.add_argument('-s', '--sender', '--from', dest='sender',
                        action='store', help="""
                        Sender of the message. See 46elks' API documentation
                        for valid formats""")
    parser.add_argument('-u', '--username', dest='username', action='store',
                        help="Your API username from https://www.46elks.com/")
    parser.add_argument('-p', '--password', dest='password', action='store',
                        help="Your API password from https://www.46elks.com/")
    parser.add_argument('--flash', action='store_true',
                        help="Send SMS as a flash-SMS")
    parser.add_argument('-l', '--length', metavar='length',
            action='store', type=int, default=160,
            help='Maximum length of the message')
    parser.add_argument('-c', '--config', dest='configfile',
                        help="""Location of the custom configuration file""")
    parser.add_argument('--saveconf', dest='saveconf',
                        action='count', help="""
                        Generates a configuration file from the commandline
                        options and exits.""")
    parser.add_argument('--editconf', action='store_true', help="""
                        Opens the configuration file in your $EDITOR""")
    return parser.parse_args()
423513
def formatted_message( severity, msg )
      msg = String === msg ? msg : msg.inspect

      if args = _matched( msg )
        args.first.call msg, args.last
      elsif proc = configuration[:severities][severity]
        proc.call msg
      else
        msg
      end
    end
77118
def _parse_line(self, line):
        
        msg_info = {'raw_message': line}
        if ': ' in line:
            info, msg = [i.strip() for i in line.split(': ', 1)]
            msg_info['message'] = msg

            info_splits = info.split()
            if len(info_splits) == 5:
                msg_info['timestamp'] = ' '.join(info_splits[:3])
                msg_info['hostname'] = info_splits[3]
                msg_info['procname'] = info_splits[4]
        return msg_info
132952
private String extractAttributes(SoyMsg msg) {
    StringBuilder attributes = new StringBuilder();
    Matcher matcher = MESSAGE_ATTRIBUTE_PATTERN.matcher(msg.getDesc());
    while (matcher.find()) {
      attributes.append(matcher.group());
    }
    return attributes.toString();
  }
600279
function (clientArguments) {
  var grepRegex = /^--grep=(.*)$/;

  if (Object.prototype.toString.call(clientArguments) === '[object Array]') {
    var indexOfGrep = indexOf(clientArguments, '--grep');

    if (indexOfGrep !== -1) {
      return clientArguments[indexOfGrep + 1]
    }

    return map(filter(clientArguments, function (arg) {
      return grepRegex.test(arg)
    }), function (arg) {
      return arg.replace(grepRegex, '$1')
    })[0] || ''
  } else if (typeof clientArguments === 'string') {
    var match = /--grep=([^=]+)/.exec(clientArguments);

    return match ? match[1] : ''
  }
}
590694
def _extract_image_urls(arg: Message_T) -> List[str]:
    """"""
    arg_as_msg = Message(arg)
    return [s.data['url'] for s in arg_as_msg
            if s.type == 'image' and 'url' in s.data]
804126
def to_irc(self):
        
        ignore_re = re.compile('[\x03\x02\x1D\x1F\x16\x0F]')
        text = ignore_re.sub('', self.text)
        if self.color and self.bg_color:
            return '\x03%02d,%02d%s' % (self.color.to_8bit().to_irc(),
                                        self.bg_color.to_8bit().to_irc(),
                                        text)
        elif self.color:
            c = self.color.to_8bit()
            if c.is_color():
                return '\x03%02d%s' % (c.to_irc(), text)
            else:
                return '\x03\x0f' + text
        elif self.bg_color:
            return '\x0301,%02d%s' % (self.bg_color.to_8bit().to_irc(), text)
        else:
            return '\x03\x0f' + text
964935
def extract_girc_colours(msg, fill_last):
    
    if not len(msg):
        return '', ''

    if ']' not in msg or not msg.startswith('['):
        return '', msg

    original_msg = msg

    colours, msg = msg.split(']', 1)
    colours = colours.lstrip('[')

    if ',' in colours:
        fore, back = colours.split(',')
        if fore not in colour_name_to_code or back not in colour_name_to_code:
            return '', original_msg
        fore = colour_name_to_code[fore]
        back = colour_name_to_code[back]
        return '{},{}'.format(fore, back.zfill(2) if fill_last else back), msg
    else:
        if colours not in colour_name_to_code:
            return '', original_msg
        fore = colour_name_to_code[colours]
        return '{}'.format(fore.zfill(2) if fill_last else fore), msg
739651
function getTrueMsg (msg) {
  if (msg) return msg
  msg = msg || ''
  if (terst.autoMsg === true) { //experimental
    var params = getParams(T)
    for (var i = 0 ; i < params.length; ++i) {
      try {
        var e = eval(params[i].param)
      } catch (err) {
        console.error(err)
      }
      if (typeof e === 'boolean' && e === false) {
        msg = params[i].param
        return msg
      } 
    }
  }
}
307841
def get_message(self, level, alert, value, **kwargs):
        
        target, ntype = kwargs.get('target'), kwargs.get('ntype')

        msg_type = 'telegram' if ntype == 'graphite' else 'short'
        tmpl = TEMPLATES[ntype][msg_type]
        generated = tmpl.generate(
            level=level, reactor=self.reactor, alert=alert,
            value=value, target=target,)
        return generated.decode().strip()