Extract key and value from message definition
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, "'")
    };
}
712482
def parse(self, msg):
        
        #init
        dictValues = HL7Dict(self.tersersep)
        msg_ = msg.strip('\r\n ')

        # extracts separator defined in the message itself
        self.extractSeparators(dictValues, msg_)
        msg_ = msg_.replace('\r', '\n')
        lines = msg_.split('\n')
        lineNumber = 1

        # build the map of segments
        segmentNameCount, lineMap = self.buildSegmentMap(lines)
        dictValues.setSegmentsMap(segmentNameCount, lineMap)

        # Parse each line of the message : 1 line = 1 segment
        for line in lines:
            dictValues.currentLineNumber = lineNumber
            self.extractValues(dictValues, line)
            lineNumber += 1

        return dictValues
703728
function readGetItems(message, tokens) {
	message.userName = protocol.decodeString(tokens[1]);
	message.groupName = protocol.decodeString(tokens[3]);
	message.sessionId = protocol.decodeString(tokens[5]);
}
1211862
def _StructMessageToJsonObject(self, message):
    """"""
    fields = message.fields
    ret = {}
    for key in fields:
      ret[key] = self._ValueMessageToJsonObject(fields[key])
    return ret
319725
def get_message_metadata(self, key: str) -> MaildirMessage:
        
        msg = MaildirMessage()
        subpath = self._lookup(key)
        subdir, name = os.path.split(subpath)
        msg.set_subdir(subdir)
        if self.colon in name:
            msg.set_info(name.rsplit(self.colon, 1)[-1])
        msg.set_date(os.path.getmtime(os.path.join(self._path, subpath)))
        return msg
519241
def _get_ldap_msg(e):
        """"""
        msg = e
        if hasattr(e, 'message'):
            msg = e.message
            if 'desc' in e.message:
                msg = e.message['desc']
            elif hasattr(e, 'args'):
                msg = e.args[0]['desc']
        return msg
652894
function getMD5text(part) {
    var message = '';
    var constants = part.constants.map(function(field) {
      return field.type + ' ' + field.name + '=' + field.raw;
    }).join('\n');

    var fields = part.fields.map(function(field) {
      if (field.messageType) {
        return field.messageType.md5 + ' ' + field.name;
      }
      else {
        return field.type + ' ' + field.name;
      }
    }).join('\n');

    message += constants;
    if (message.length > 0 && fields.length > 0) {
      message += "\n";
    }
    message += fields;
    return message;
  }
511590
def extract_message_value(self, name):
        '''  '''
        name += ":"
        assert(self._message)
        _start = self._message.find(name)
        if _start >= 0:
            _start += len(name) + 1
            _end = self._message.find("\n", _start)
            _value = self._message[_start:_end]
            return _value.strip()

        return None
1335272
function (message) {
    var objs = [], collector = '', chr, msglen, data;

    this.data += message;
    data = new Buffer(this.data, 'utf8');

    for (var i = 0; i < data.length; i += 1) {
        chr = data[i];
        if (chr > 47 && chr < 58) {
            collector += String.fromCharCode(chr);
        } else if (chr !== 10 && chr !== 13) {
            msglen = parseInt(collector, 10);

            if (msglen + i <= data.length) {
              objs.push(JSON.parse(data.toString('utf8', i, msglen + i)));
              data = data.slice(i + msglen);
              collector = '';
              i = 0;
            } else {
              break;
            }
        }
    }
    this.data = data.toString('utf8');
    return objs;
}
107288
function extractNormalizedKeys(path) {
    const props = path.node.properties;
    const keys = [];
    let allLiteral = true;

    for (const prop of props) {
      if (t.isIdentifier(prop.key) && !prop.computed) {
        // since a key {a: 3} is equivalent to {"a": 3}, use the latter
        keys.push(t.stringLiteral(prop.key.name));
      } else if (t.isTemplateLiteral(prop.key)) {
        keys.push(t.cloneNode(prop.key));
      } else if (t.isLiteral(prop.key)) {
        keys.push(t.stringLiteral(String(prop.key.value)));
      } else {
        keys.push(t.cloneNode(prop.key));
        allLiteral = false;
      }
    }

    return { keys, allLiteral };
  }
845329
def _extract_key_value(obj):
    """"""
    key = None; value = None

    # Parse a Value object, which includes Properties
    if isinstance(obj, Value):
        key = _construct_new_key(obj.name, obj.units)
        value = []
        if obj.scalars:
            value = [(val.value if isinstance(val, Scalar) else val)
                     for val in obj.scalars]
        elif obj.vectors and len(obj.vectors) == 1:
            value = [(val.value if isinstance(val, Scalar) else val)
                     for val in obj.vectors[0]]
        if len(value) == 1:
            value = value[0]
        elif len(value) == 0:
            value = None

    # If there is a process step, pul out its name as the value
    # TODO: resolve duplicates
    if isinstance(obj, ProcessStep):
        key = "Processing"
        value = obj.name
        
    return key, value
785013
private void extractMessage(JsonObject object) {
        // Prefer to pull the message out of meta
        JsonObject meta = object.getAsJsonObject("meta");
        if (meta != null) {
            JsonPrimitive msg = meta.getAsJsonPrimitive("msg");
            if (msg != null) {
                this.message = msg.getAsString();
                return;
            }
        }

        // Fall back on error
        JsonPrimitive error = object.getAsJsonPrimitive("error");
        if (error != null) {
            this.message = error.getAsString();
            return;
        }

        // Otherwise set a default
        this.message = "Unknown Error";
    }
1050521
def _ConvertAnyMessage(self, value, message):
    """"""
    if isinstance(value, dict) and not value:
      return
    try:
      type_url = value['@type']
    except KeyError:
      raise ParseError('@type is missing when parsing any message.')

    sub_message = _CreateMessageFromTypeUrl(type_url)
    message_descriptor = sub_message.DESCRIPTOR
    full_name = message_descriptor.full_name
    if _IsWrapperMessage(message_descriptor):
      self._ConvertWrapperMessage(value['value'], sub_message)
    elif full_name in _WKTJSONMETHODS:
      methodcaller(
          _WKTJSONMETHODS[full_name][1], value['value'], sub_message)(self)
    else:
      del value['@type']
      self._ConvertFieldValuePair(value, sub_message)
    # Sets Any message
    message.value = sub_message.SerializeToString()
    message.type_url = type_url
902536
def extract_keypairs(lines, regexer):
    """"""
    updates = {}
    for line in lines:
        # for consistency we must match the replacer and strip whitespace / newlines
        match = regexer.match(line.strip())
        if not match:
            continue
        k_v = match.groupdict()
        updates[k_v[Constants.KEY_GROUP]] = k_v[Constants.VALUE_GROUP]
    return updates
1324034
function parseMessage(message) {
  var result = {};
  message.replace(/<xml>|<\/xml>/, '').replace(/<!\[CDATA\[(.*?)\]\]>/ig, '$1').replace(/<(\w+)>(.*?)<\/\1>/g, function (_, key, value) {
    key = key.replace(/(\w)/, function (str) { return str.toLowerCase();});
    result[key] = value;
  });

  return result;
}
685987
def get_attached_message(self, key, message_type, required=False):
    """"""
    return self._spec.get_attached_message(key, message_type,
                                           tags=self._tags, required=required)
32561
def extract_from(rails_message, format: :full, source: nil)
      from = nil

      # check to see if a source is present, and if it is use the naming convention
      if source.present?
        # we'll set from here, and then fall through
        from = extract_custom(rails_message, "#{source}_from")
      end

      # if a source was specified and value found, from should already be set
      # otherwise we need to fall back to the normal from field
      from ||= rails_message[:from].formatted.first

      # try to do a complex extract on the from, and proceed from there
      from = complex_extract(from)
      return from[:value] if from[:decoded]

      case format
      when :full
        rails_message[:from].formatted.first
      when :name
        rails_message[:from].address_list.addresses.first.name
      when :address
        rails_message[:from].address_list.addresses.first.address
      end
    end