Process a (key, value) pair
494103
def process_pair(self, key, value):
        

        old_key = key
        old_value = value

        # Create key intelligently
        keyparts = self.bspacere.split(key)
        # print keyparts

        strippable = False
        lastpart = keyparts[-1]

        if lastpart.find('\\ ') != -1:
            keyparts[-1] = lastpart.replace('\\','')

        # If no backspace is found at the end, but empty
        # space is found, strip it
        elif lastpart and lastpart[-1] == ' ':
            strippable = True

        key = ''.join(keyparts)
        if strippable:
            key = key.strip()
            old_key = old_key.strip()

        old_value = self.unescape(old_value)
        value = self.unescape(value)

        # Patch from N B @ ActiveState
        curlies = re.compile(r'\$?\{.+?\}')
        found_variables = curlies.findall(value)

        for found_variable in found_variables:
            if found_variable.startswith('$'):
                source_key = found_variable[2:-1]
            else:
                source_key = found_variable[1:-1]

            if source_key in self._properties:
                value = value.replace(found_variable, self._properties[source_key], 1)

        self._properties[key] = value.strip()

        # Check if an entry exists in pristine keys
        if key in self._keymap:
            old_key = self._keymap.get(key)
            self._origprops[old_key] = old_value.strip()
        else:
            self._origprops[old_key] = old_value.strip()
            # Store entry in keymap
            self._keymap[key] = old_key

        if key not in self._keyorder:
            self._keyorder.append(key)
397684
def _compile_key_val(self, data, indent_level):
        """"""
        buffer = ''
        for (key, val) in data.items():
            buffer += self._indent * indent_level
            # TODO: assumes key is a string
            buffer += key + ':'

            if isinstance(val, dict):
                buffer += '\n'
                buffer += self._compile_key_val(val, indent_level+1)
            elif (
                isinstance(val, list) and
                any(isinstance(i, (dict, list)) for i in val)
            ):
                buffer += self._compile_list(val, indent_level+1)
            else:
                buffer += ' '
                buffer += self._compile_value(val, indent_level)
                buffer += '\n'

        return buffer
1140212
def process_hash(tags, property, content, **opts)
      content.each do |key, value|
        key = key.to_s == '_' ? property : "#{property}:#{key}"
        value = normalized_meta_tags[value] if value.kind_of?(Symbol)
        process_tree(tags, key, value, **opts)
      end
    end
496892
def process_bind_param(self, value, dialect):
        """"""
        if value is not None:
            value = simplejson.dumps(value)
        return value
232634
def key_on(self, value):
        
        if isinstance(value, BASESTRING):
            value = (value,)
        self._key_on = value
1024416
def process_result_value(self, value, dialect):
        """"""
        if value is not None:
            value = simplejson.loads(value)
        return value
639378
def _process_key(evt):
    """"""
    key = evt.GetKeyCode()
    if key in KEYMAP:
        return KEYMAP[key], ''
    if 97 <= key <= 122:
        key -= 32
    if key >= 32 and key <= 127:
        return keys.Key(chr(key)), chr(key)
    else:
        return None, None
608433
def process_data(lines)  
      data = {}
      lines.each do |line|
        line = line.split
        key = line.first.split('.value').first
        data[key] = line.last
      end
      data
    end
490045
def handle_set_key(self):
        """"""
        track_id = self.reader.int()
        row = self.reader.int()
        value = self.reader.float()
        kind = self.reader.byte()
        logger.info(" -> track=%s, row=%s, value=%s, type=%s", track_id, row, value, kind)

        # Add or update track value
        track = self.tracks.get_by_id(track_id)
        track.add_or_update(row, value, kind)
419680
def extract_key_value(line)
      match = line.match(KEY_VALUE_PATTERN)
      if match
        key = match[1]
        value = match[2]
        [key.strip, value.strip]
      else
        []
      end
    end
18058
def comma_separated_pairs(value):
    """"""
    pairs = value.split(",")
    results = {}
    for pair in pairs:
        key, pair_value = pair.split('=')
        results[key] = pair_value
    return results
407710
def handle(self, key, value):
        '''
        
        '''
        # the master dict to return
        master = {}
        master['uuid'] = value
        master['total_pending'] = 0
        master['server_time'] = int(self.get_current_time())

        # break down key
        elements = key.split(":")
        dict = {}
        dict['spiderid'] = elements[1]
        dict['appid'] = elements[2]

        # log we received the info message
        extras = self.get_log_dict('info', dict['appid'],
                                   dict['spiderid'], master['uuid'])

        if len(elements) == 4:
            dict['crawlid'] = elements[3]
            extras = self.get_log_dict('info', dict['appid'],
                                       dict['spiderid'], master['uuid'],
                                       elements[3])
        self.logger.info('Received info request', extra=extras)

        # generate the information requested
        if 'crawlid' in dict:
            master = self._build_crawlid_info(master, dict)
        else:
            master = self._build_appid_info(master, dict)

        if self._send_to_kafka(master):
            extras['success'] = True
            self.logger.info('Sent info to kafka', extra=extras)
        else:
            extras['success'] = False
            self.logger.error('Failed to send info to kafka',
                              extra=extras)
75691
def process_row(cls, data, column_map):
        """"""
        row = {}
        for key,value in data.iteritems():
            if not value:
                value = '-'                
            elif isinstance(value, list):
                value = value[1]
            elif isinstance(value, dict):
                if 'type_name' in value:
                    if 'UnixTimeStamp' in value['type_name']:
                        value = datetime.datetime.utcfromtimestamp(value['epoch'])
                        if value == datetime.datetime(1970, 1, 1, 0, 0):
                            value = '-'

            # Assume the value is somehow well formed when we get here
            row[column_map[key]] = value
        return row
182233
def []=(name, value)
    name_pair = name_to_a(name).freeze
    hooks = assign(name_pair, value)
    hooks.each do |hook|
      hook.call(name_pair, value)
    end
    value
  end
32514
def keys_values(data, *keys):
    """"""
    values = []
    if is_mapping(data):
        for key in keys:
            if key in data:
                values.extend(ensure_list(data[key]))
    return values
616063
def handle(self, key, value):
        '''
        
        '''
        # break down key
        elements = key.split(":")

        stats = elements[1]
        appid = elements[2]
        uuid = value

        # log we received the stats request
        extras = self.get_log_dict('stats', appid, uuid=uuid)
        self.logger.info('Received {s} stats request'.format(s=stats),
            extra=extras)

        extras = {}
        if stats == 'all':
            extras = self.get_all_stats()
        elif stats == 'kafka-monitor':
            extras = self.get_kafka_monitor_stats()
        elif stats == 'redis-monitor':
            extras = self.get_redis_monitor_stats()
        elif stats == 'crawler':
            extras = self.get_crawler_stats()
        elif stats == 'spider':
            extras = self.get_spider_stats()
        elif stats == 'machine':
            extras = self.get_machine_stats()
        elif stats == 'queue':
            extras = self.get_queue_stats()
        elif stats == 'rest':
            extras = self.get_rest_stats()
        else:
            self.logger.warn('Received invalid stats request: {s}'\
                .format(s=stats),
            extra=extras)
            return

        extras['stats'] = stats
        extras['appid'] = appid
        extras['uuid'] = uuid
        extras['server_time'] = int(self.get_current_time())

        if self._send_to_kafka(extras):
            extras['success'] = True
            self.logger.info('Sent stats to kafka', extra=extras)
        else:
            extras['success'] = False
            self.logger.error('Failed to send stats to kafka', extra=extras)
433478
def emit(self, dictValues, key, value):
        
        if key and value:
            dictValues[key] = value