Parse header record (100)
4556
def parse_100_row(row: list, file_name: str) -> HeaderRecord:
    
    return HeaderRecord(
        row[1],
        parse_datetime(row[2]),
        row[3],
        row[4],
        file_name,
    )
1034285
function readRecord() {
    if (index >= text.length) {
      return EOF;
    }
    var record = [];
    for (var field = readField(); field != EOR; field = readField()) {
      record.push(field);
    }
    return record;
  }
498543
def parse(self):
        
        reader = self.split_records()
        for line in reader:
            self.cur_record += 1
            if not line:
                continue
            stmt_line = self.parse_record(line)
            if stmt_line:
                stmt_line.assert_valid()
                self.statement.lines.append(stmt_line)
        return self.statement
160835
function parseHeaders(headers) {
    var out = {};
    var position = 0;
    while (position < headers.length) {
        var nameLength = headers.readUInt8(position++);
        var name = headers.slice(position, position + nameLength).toString();
        position += nameLength;
        switch (headers.readUInt8(position++)) {
            case 0 /* boolTrue */:
                out[name] = {
                    type: BOOLEAN_TAG,
                    value: true
                };
                break;
            case 1 /* boolFalse */:
                out[name] = {
                    type: BOOLEAN_TAG,
                    value: false
                };
                break;
            case 2 /* byte */:
                out[name] = {
                    type: BYTE_TAG,
                    value: headers.readInt8(position++)
                };
                break;
            case 3 /* short */:
                out[name] = {
                    type: SHORT_TAG,
                    value: headers.readInt16BE(position)
                };
                position += 2;
                break;
            case 4 /* integer */:
                out[name] = {
                    type: INT_TAG,
                    value: headers.readInt32BE(position)
                };
                position += 4;
                break;
            case 5 /* long */:
                out[name] = {
                    type: LONG_TAG,
                    value: new Int64(headers.slice(position, position + 8))
                };
                position += 8;
                break;
            case 6 /* byteArray */:
                var binaryLength = headers.readUInt16BE(position);
                position += 2;
                out[name] = {
                    type: BINARY_TAG,
                    value: headers.slice(position, position + binaryLength)
                };
                position += binaryLength;
                break;
            case 7 /* string */:
                var stringLength = headers.readUInt16BE(position);
                position += 2;
                out[name] = {
                    type: STRING_TAG,
                    value: headers.slice(
                        position,
                        position + stringLength
                    ).toString()
                };
                position += stringLength;
                break;
            case 8 /* timestamp */:
                out[name] = {
                    type: TIMESTAMP_TAG,
                    value: new Date(
                        new Int64(headers.slice(position, position + 8))
                            .valueOf()
                    )
                };
                position += 8;
                break;
            case 9 /* uuid */:
                var uuidChars = headers.slice(position, position + 16)
                    .toString('hex');
                position += 16;
                out[name] = {
                    type: UUID_TAG,
                    value: uuidChars.substr(0, 8) + '-' +
                        uuidChars.substr(8, 4) + '-' +
                        uuidChars.substr(12, 4) + '-' +
                        uuidChars.substr(16, 4) + '-' +
                        uuidChars.substr(20)
                };
                break;
            default:
                throw new Error('Unrecognized header type tag');
        }
    }
    return out;
}
803830
def _parse_block_header(line):
    
    level = line[1]
    one, _rest = line[4:].split(')=', 1)
    name, _rest = _rest.split('(', 1)
    seqcount, _rest = _rest.split(')', 1)
    params = _rest.strip('{}:')
    # try:
    #     params = dict((key, float(val))
    #             for key, val in (pair.split('=')
    #                 for pair in _rest[1:-2].split(',')))
    # except ValueError:
    #     # Couldn't convert params to key-val pairs, for whatever reason
    #     logging.warn("Failed to parse CMA params: %s", _rest[1:-2])
    #     params = {}
    return int(level), int(one), name, int(seqcount), params
1326951
function parse(headers) {
    var output = {}, i, p, k, v;
    headers = headers || '';
    headers = headers.replace('\r', '');
    headers = headers.split('\n');
    for(i = 0;i < headers.length;i++) {
      p = headers[i].indexOf(':');
      k = headers[i].substr(0, p);
      v = headers[i].substr(p + 1);
      if(k && v) {
        k = k.replace(/^\s+/, '').replace(/\s+$/, '');
        v = v.replace(/^\s+/, '').replace(/\s+$/, '');
        output[k.toLowerCase()] = v;
      }
    }
    return output;
  }
1316223
def parse_subdomain_record(domain_name, rec, block_height, parent_zonefile_hash, parent_zonefile_index, zonefile_offset, txid, domain_zonefiles_missing, resolver=None):
        
        # sanity check: need 'txt' record list
        txt_entry = rec['txt']
        if not isinstance(txt_entry, list):
            raise ParseError("Tried to parse a TXT record with only a single <character-string>")
       
        entries = {}    # parts of the subdomain record
        for item in txt_entry:
            # coerce string
            if isinstance(item, unicode):
                item = str(item)

            key, value = item.split('=', 1)
            value = value.replace('\\=', '=')  # escape '='
            
            if key in entries:
                raise ParseError("Duplicate TXT entry '{}'".format(key))

            entries[key] = value

        pubkey = entries[SUBDOMAIN_PUBKEY]
        n = entries[SUBDOMAIN_N]
        if SUBDOMAIN_SIG in entries:
            sig = entries[SUBDOMAIN_SIG]
        else:
            sig = None
        
        try:
            zonefile_parts = int(entries[SUBDOMAIN_ZF_PARTS])
        except ValueError:
            raise ParseError("Not an int (SUBDOMAIN_ZF_PARTS)")
        
        try:
            n = int(n)
        except ValueError:
            raise ParseError("Not an int (SUBDOMAIN_N)")

        b64_zonefile = "".join([entries[SUBDOMAIN_ZF_PIECE % zf_index] for zf_index in range(zonefile_parts)])
        
        is_subdomain, _, _ = is_address_subdomain(rec['name'])
        subd_name = None
        if not is_subdomain:
            # not a fully-qualified subdomain, which means it ends with this domain name
            try:
                assert is_name_valid(str(domain_name)), domain_name
                subd_name = str(rec['name'] + '.' + domain_name)
                assert is_address_subdomain(subd_name)[0], subd_name
            except AssertionError as ae:
                if BLOCKSTACK_DEBUG:
                    log.exception(ae)

                raise ParseError("Invalid names: {}".format(ae))

        else:
            # already fully-qualified
            subd_name = rec['name']
            
        return Subdomain(str(subd_name), str(domain_name), str(pubkey), int(n), base64.b64decode(b64_zonefile), str(sig), block_height, parent_zonefile_hash, parent_zonefile_index, zonefile_offset, txid, domain_zonefiles_missing=domain_zonefiles_missing, resolver=resolver)
655902
def _parse_content_type_header(header):
    

    tokens = header.split(';')
    content_type, params = tokens[0].strip(), tokens[1:]
    params_dict = {}
    items_to_strip = "\"' "

    for param in params:
        param = param.strip()
        if param:
            key, value = param, True
            index_of_equals = param.find("=")
            if index_of_equals != -1:
                key = param[:index_of_equals].strip(items_to_strip)
                value = param[index_of_equals + 1:].strip(items_to_strip)
            params_dict[key.lower()] = value
    return content_type, params_dict
919321
def parse_header(cls, value='*/*'):
        """"""
        yield from sorted((
            cls.from_string(token.strip())
            for token in value.split(',')
            if token.strip()
        ), reverse=True)
137773
def parse_headers(self, req, name, field):
        """"""
        return get_value(req.headers, name, field)
358037
def parse_header(input_array):
    """"""
    codec = struct.unpack(mmtf.utils.constants.NUM_DICT[4], input_array[0:4])[0]
    length = struct.unpack(mmtf.utils.constants.NUM_DICT[4], input_array[4:8])[0]
    param = struct.unpack(mmtf.utils.constants.NUM_DICT[4], input_array[8:12])[0]
    return codec,length,param,input_array[12:]
408843
def _parse_and_check_header(self, data):
        """"""
        (start, self.pins, self.vid, self.pid, crc) = struct.unpack('<BIBBB',
                                                                    data)
        test_crc = crc32(data[:-1]) & 0x0ff
        if start == 0xEB and crc == test_crc:
            return True
        return False
825014
function parseHeader(authHeader, callback){
        try {
            var parts=authHeader.split(/:/),
                username=parts[0],
                password=parts[1];

            callback(null, {username: username, password: password});
        }
        catch(ex){
            callback(ex);
        }
    }
1077391
function parseHeaders(xhr) {
  const pairs = xhr.getAllResponseHeaders().trim().split('\n');
  const headers = {};
  pairs.forEach((header) => {
    const split = header.trim().split(':');
    const key = split.shift().trim().toLowerCase();
    const value = split.join(':').trim();
    headers[key] = value;
  });
  return headers;
}
938333
def parse(self):
        """"""

        self.parse_fields()
        records = []
        for line in self.t['data'].split('\n'):
            if EMPTY_ROW.match(line):
                continue
            row = [self.autoconvert(line[start_field:end_field+1])
                   for start_field, end_field in self.fields]
            records.append(tuple(row))
        self.records = records
1288814
def parse_from_rsb(header: bytearray) -> dict:
    
    params = {}

    params["text_header_size"] = struct.unpack('I', header[0:4])[0]

    params["events_num"] = struct.unpack('i', header[8:12])[0]

    start_time = struct.unpack('Q', header[16:24])[0]
    params["start_time"] = datetime.fromtimestamp(start_time).isoformat()
    end_time = struct.unpack('Q', header[24:32])[0]
    params["end_time"] = datetime.fromtimestamp(end_time).isoformat()

    params["filepath"] = header[32: 32 + 255].rstrip(b'\0').decode("cp1251")

    params["num_blocks"] = struct.unpack('i', header[288:292])[0]

    params["aquisition_time"] = struct.unpack('i', header[292:296])[0]

    params["blocks_in_file"] = struct.unpack('i', header[296:300])[0]

    params["waitTime"] = struct.unpack('i', header[300:304])[0]

    params["threshold"] = struct.unpack('d', header[312:320])[0]

    sync_params_num = struct.unpack('I', header[336:340])[0]
    sync_params = np.unique(np.frombuffer(header[320:336], np.uint32)
                            [:sync_params_num])
    params["synchro_control"] = []
    for param in sync_params:
        if param == 0:
            params["synchro_control"].append("Default")
        else:
            params["synchro_control"].append(list(synchro_control.keys())
                                             [list(synchro_control.values())
                                              .index(param)])

    params["sample_freq"] = struct.unpack('d', header[344:352])[0]
    params["pre_history"] = struct.unpack('I', header[352:356])[0]

    params["packet_number"] = struct.unpack('i', header[356:360])[0]

    params["b_size"] = struct.unpack('I', header[360:364])[0]

    params["hysteresis"] = struct.unpack('I', header[364:368])[0]

    params["channel_number"] = struct.unpack('I', header[368:372])[0]

    ch_params = []

    for i in range(params["channel_number"]):
        ch_data = header[372 + 56 * i: 372 + 56 * (i + 1)]
        ch_param = {}

        param_num = struct.unpack('I', ch_data[36:40])[0]
        ch_params_raw = np.unique(np.frombuffer(ch_data[4:36],
                                                np.uint32)[:param_num])
        ch_param["params"] = []
        for param in ch_params_raw:
            if param == 0:
                ch_param["params"].append("Default")
            else:
                ch_param["params"].append(list(channel_control.keys())
                                          [list(channel_control.values())
                                           .index(param)])

        ch_param["adjustment"] = struct.unpack('d', ch_data[44:52])[0]
        ch_param["gain"] = struct.unpack('I', ch_data[52:56])[0]
        ch_params.append(ch_param)

    params["channel"] = ch_params

    synchro_channel = {}
    sync_ch_par_num = struct.unpack('I', header[632:636])[0]
    sync_ch_params_raw = np.unique(np.frombuffer(header[600:632],
                                                 np.uint32)[:sync_ch_par_num])

    synchro_channel["params"] = []
    for param in sync_ch_params_raw:
        if param == 0:
            synchro_channel["params"].append("Default")
        else:
            synchro_channel["params"] \
                .append(list(synchro_channel_control.keys())
                        [list(synchro_channel_control.values()).index(param)])

    synchro_channel_type = struct.unpack('I', header[304:308])[0]
    synchro_channel["type"] = list(synchro_channel_types.keys())[
        list(synchro_channel_types.values()).index(synchro_channel_type)]

    synchro_channel["gain"] = struct.unpack('I', header[636:640])[0]

    params["synchro_channel"] = synchro_channel

    params["err_lang"] = struct.unpack('I', header[640:644])[0]
    params["board_name"] = header[644:644 + 255].rstrip(b'\0').decode("cp1251")

    params["board_id"] = struct.unpack('I', header[900:904])[0]

    return params
62274
def _parse_results(self, results, cached_records):
        
        parser = xml.sax.make_parser()
        handler = RecordsHandler(cached_records)
        parser.setContentHandler(handler)
        parser.parse(results)
        return handler.records