File: hava.py

package info (click to toggle)
python-screed 1.1.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 820 kB
  • sloc: python: 3,356; makefile: 169; sh: 32; javascript: 16
file content (31 lines) | stat: -rw-r--r-- 1,124 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# Copyright (c) 2016, The Regents of the University of California.

from __future__ import absolute_import
from . import DBConstants
from .utils import to_str

FieldTypes = (('hava', DBConstants._INDEXED_TEXT_KEY),
              ('quarzk', DBConstants._STANDARD_TEXT),
              ('muchalo', DBConstants._STANDARD_TEXT),
              ('fakours', DBConstants._STANDARD_TEXT),
              ('selimizicka', DBConstants._STANDARD_TEXT),
              ('marshoon', DBConstants._STANDARD_TEXT))


def hava_iter(handle):
    """
    Iterator over a 'hava' sequence file, returning records. handle
    is a handle to a file opened for reading
    """
    data = {}
    line = to_str(handle.readline().strip())
    while line:
        data['hava'] = line
        data['quarzk'] = to_str(handle.readline().strip())
        data['muchalo'] = to_str(handle.readline().strip())
        data['fakours'] = to_str(handle.readline().strip())
        data['selimizicka'] = to_str(handle.readline().strip())
        data['marshoon'] = to_str(handle.readline().strip())

        line = to_str(handle.readline().strip())
        yield data