Creates the parsed_lines dict which keeps all record data in document order indexed by the record type.
13861
def _split_lines(self):
        ''''''
        parsed_lines = {}
        for rt in all_record_types:
            parsed_lines[rt] = []
        parsed_lines[0] = []

        for line in self.lines:
            linetype = line[0:6]
            if linetype in all_record_types:
                parsed_lines[linetype].append(line)
            else:
                parsed_lines[0].append(line)

        self.parsed_lines = parsed_lines
        self._update_structure_lines()
379262
def process_line(self, record):
        ""
        cleaned = []

        for key in self.vcf_fields:
            out = self.process_column(key, getattr(record, key))
            if isinstance(out, (list, tuple)):
                cleaned.extend(out)
            else:
                cleaned.append(out)

        for key in self.info_fields:
            out = self.process_column(key, record.INFO.get(key, None))
            if isinstance(out, (list, tuple)):
                cleaned.extend(out)
            else:
                cleaned.append(out)

        return cleaned
918267
def _prepare_record(record, index, doc_type):
        
        if current_app.config['INDEXER_REPLACE_REFS']:
            data = copy.deepcopy(record.replace_refs())
        else:
            data = record.dumps()

        data['_created'] = pytz.utc.localize(record.created).isoformat() \
            if record.created else None
        data['_updated'] = pytz.utc.localize(record.updated).isoformat() \
            if record.updated else None

        # Allow modification of data prior to sending to Elasticsearch.
        before_record_index.send(
            current_app._get_current_object(),
            json=data,
            record=record,
            index=index,
            doc_type=doc_type,
        )

        return data
1129906
function Record(line, header) {
    // Returns a VCF record.
    //
    // `line` - a line of the VCF file that represents an individual record.
    // `header` - the parsed VCF header.
    var vals = line.split('\t');
    this.initializeRecord(vals, header);

    if (this.CHROM)   this.CHROM   = parseChrom(this.CHROM, header);
    if (this.POS)     this.POS     = parsePos(this.POS, header);
    if (this.ID)      this.ID      = parseId(this.ID, header);
    if (this.REF)     this.REF     = parseRef(this.REF, header);
    if (this.ALT)     this.ALT     = parseAlt(this.ALT, header);
    if (this.QUAL)    this.QUAL    = parseQual(this.QUAL, header);
    if (this.FILTER)  this.FILTER  = parseFilter(this.FILTER, header);
    if (this.INFO)    this.INFO    = parseInfo(this.INFO, header);
    if (this.FORMAT)  this.FORMAT  = parseFormat(this.FORMAT, header);
    this.__KEY__ = genKey(this, header);

    for (var idx = 0; idx < header.sampleNames.length; idx++) {
      var sampleName = header.sampleNames[idx],
          sample = this[sampleName];
      if (sample) {
        this[sampleName] = parseSample(sample, this.FORMAT, header);
      }
    }
  }
113346
def seqrecord2sequence(record, qlen, index):
    
    # aligned_len = sum(map(str.isupper, str(record.seq)))
    # assert qlen == aligned_len, (
    #         "Aligned sequence length %s, query %s\n%s"
    #         % (aligned_len, qlen, str(record)))

    description = (record.description.split(' ', 1)[1]
            if ' ' in record.description
            else ' ')
    return dict(index=index,
                id=record.id,
                description=description,
                dbxrefs={},
                phylum='',
                taxchar='',
                head_len=None,
                tail_len=None,
                head_seq='',
                tail_seq='',
                length=len(record.seq) - record.seq.count('-'),
                seq=str(record.seq),
                )
276854
def get_records(self):
        
        self.close()
        with open(self.path, 'r') as filep:
            first_line = filep.readline().split(',')
            if first_line[0] != self.fields[0]:
                yield first_line

            for line in filep:
                yield line.split(',')
1111539
def _load_records(self, record_type_idstrs):
        """"""
        for record_type_idstr in record_type_idstrs:
            try:
                self._init_record(record_type_idstr)
            except (ImportError, KeyError):
                pass
919361
def generate_records(self, infile):
        

        state = 0
        record = {}

        for item in self.generate_lines(infile):

            line = item['line']
            heading = item['heading']
            
            # any Markdown heading is just a caption, no image
            if heading:
                record['heading'] = True
                record['caption'] = line[1:].strip()

                state = 'caption'
                continue

            if not line[0].isspace():
                # at a potential image
                if state == 'caption':
                    yield record
                    record = {}
                    state = 0

            if state == 'caption':
                record['caption'] += '\n' + line[:-1]
                continue

            fields = line.split(',')

            # nothing there, carry on
            if not fields: continue

            image = fields[0].strip()

            if not image: continue

            record['image'] = image

            try:
                time = float(fields[1])
            except:
                time = 0

            record['time'] = time

            try:
                caption = fields[2].strip()
            except:
                caption = None

            if caption:
                record['caption'] = caption

            # yield it if we have anything
            if record:
                yield record
                record = {}
1139761
def dictionize(fields: Sequence, records: Sequence) -> Generator:
    """"""

    return (dict(zip(fields, rec)) for rec in records)
750680
def store_lineformat(rgb, lns, we, grbit, index)  # :nodoc:
    record = 0x1007     # Record identifier.
    length = 0x000C     # Number of bytes to follow.
    # rgb               # Line RGB colour.
    # lns               # Line pattern.
    # we                # Line weight.
    # grbit             # Option flags.
    # index             # Index to colour of line.

    header = [record, length].pack('vv')
    data  = [rgb].pack('V')
    data += [lns].pack('v')
    data += [we].pack('v')
    data += [grbit].pack('v')
    data += [index].pack('v')

    append(header, data)
  end
834975
def _lines(self):
        

        chunkIndices = self._listChunks()
        for chunkIndex in chunkIndices:
            with self._openChunk(chunkIndex) as chunk:
                yield from chunk._lines()
1168686
def _parse_dict(features, new_names):
        """"""
        feature_collection = OrderedDict()
        for feature_type, feature_names in features.items():
            try:
                feature_type = FeatureType(feature_type)
            except ValueError:
                ValueError('Failed to parse {}, keys of the dictionary have to be instances '
                           'of {}'.format(features, FeatureType.__name__))

            feature_collection[feature_type] = feature_collection.get(feature_type, OrderedDict())

            if feature_names is ...:
                feature_collection[feature_type] = ...

            if feature_type.has_dict() and feature_collection[feature_type] is not ...:
                feature_collection[feature_type].update(FeatureParser._parse_feature_names(feature_names, new_names))

        return feature_collection
334644
def _list_records(self, rtype=None, name=None, content=None):
        """"""
        records = [
            {
                'id': record['id'],
                'type': record['type'],
                'name': self._full_name(record['hostname']),
                'content': record['destination'],
                'priority': record['priority'],
                'ttl': self.zone_ttl,
            }
            for record in self._raw_records(None, rtype, name, content)
        ]
        LOGGER.debug('list_records: %s', records)
        return records
762605
def _get_dict(lines, start_index, indentation, deep):
    """"""

    info = {}
    current_item = None

    i = start_index
    while i < len(lines):

        current_line = lines[i]
        current_line_indentation = _get_indentation(current_line)

        # Check for multi-level returns
        if current_line_indentation < indentation:
            return info, i-1

        if current_line_indentation == indentation:
            current_item = current_line.lstrip(' ')
            info[current_item] = {}
            i = i + 1
            continue

        if i < len(lines) - 1:
            next_line_indentation = _get_indentation(lines[i+1])
        else:
            next_line_indentation = current_line_indentation

        if next_line_indentation > current_line_indentation:
            ret_dict, i = _get_dict(lines, i, current_line_indentation, deep+1)
            for key in ret_dict.keys():
                if key in info[current_item]:
                    info[current_item][key].update(ret_dict[key])
                else:
                    info[current_item][key] = ret_dict[key]
        else:
            key, value = _get_key_value(current_line)
            if key:
                info[current_item][key] = value

        # Do not return if it's the top level of recursion
        if next_line_indentation < current_line_indentation and deep > 0:
            return info, i

        i = i + 1

    return info, i
739931
def sort_by(self, *ids):
        
        # Support sorting by file_ids or keys.
        files = {str(f_.file_id): f_.key for f_ in self}
        # self.record['_files'] = [{'key': files.get(id_, id_)} for id_ in ids]
        self.filesmap = OrderedDict([
            (files.get(id_, id_), self[files.get(id_, id_)].dumps())
            for id_ in ids
        ])
        self.flush()
535150
def index_all(self):
        
        self.logger.debug('Start indexing all records under: %s',
                          self.record_path)
        with self.db.connection():
            for json_path in sorted(self.find_record_files()):
                self.index_record(json_path)
388307
def wr_header_file(self, write_fields, write_dir):
        
        # Create record specification line
        record_line = ''
        # Traverse the ordered dictionary
        for field in RECORD_SPECS.index:
            # If the field is being used, add it with its delimiter
            if field in write_fields:
                record_line += RECORD_SPECS.loc[field, 'delimiter'] + str(getattr(self, field))

        header_lines = [record_line]

        # Create segment specification lines
        segment_lines = self.n_seg * ['']
        # For both fields, add each of its elements with the delimiter
        # to the appropriate line
        for field in SEGMENT_SPECS.index:
            for seg_num in range(self.n_seg):
                segment_lines[seg_num] += SEGMENT_SPECS.loc[field, 'delimiter'] + str(getattr(self, field)[seg_num])

        header_lines = header_lines + segment_lines

        # Create comment lines (if any)
        if 'comments' in write_fields:
            comment_lines = ['# '+ comment for comment in self.comments]
            header_lines += comment_lines

        lines_to_file(self.record_name + '.hea', header_lines, write_dir)