コード例 #1
0
 def read_file(self,f):
     blockoflines = Mio.generReadUntil(f,'}')
     for line in blockoflines:
         key = Mio.findKey(line,'','=').strip()
         value = Mio.findKey(line,'{','}').strip()
         if key == 'author':
             authors = AuthorList()
             authors.new_authors_from_line(value)
             self.authors = authors
         else:
             if key == 'title':
                 value = Title(value)
             setattr(self,key,value)
コード例 #2
0
ファイル: cadd_io.py プロジェクト: amardahiya/PythonModules
def yield_file_items(f, filetag, commentmarker='#'):
    for line in Mio.yield_no_comments(f, comment=commentmarker):
        words = line.strip().split(':')
        key, value = words[0].strip(), words[1].strip()
        isfile = key.startswith(filetag)
        if isfile:  # strip filetag
            key = Mio.findKey(key, filetag, '')
        yield (key, value, isfile)
コード例 #3
0
ファイル: cadd_io.py プロジェクト: varunprajan/PythonModules
def yield_file_items(f,filetag,commentmarker='#'):
    for line in Mio.yield_no_comments(f,comment=commentmarker):
        words = line.strip().split(':')
        key, value = words[0].strip(), words[1].strip()
        isfile = key.startswith(filetag)
        if isfile: # strip filetag
            key = Mio.findKey(key,filetag,'')
        yield (key, value, isfile)
コード例 #4
0
def getLineInfo(line):
    key = Mio.findKey(line, '', '=').rstrip()
    value = Mio.findKey(line, '{', '}')
    return key, value
コード例 #5
0
def getReferenceKey(line):
    articletype = Mio.findKey(line, '@', '{')
    key = Mio.findKey(line, '{', ',')
    return articletype, key
コード例 #6
0
 def get_type_key(self,line):
     articletype = Mio.findKey(line,'@','{')
     key = Mio.findKey(line,'{',',')
     return articletype, key
コード例 #7
0
def getLineInfo(line):
    key = Mio.findKey(line,'','=').rstrip()
    value = Mio.findKey(line,'{','}')
    return key, value
コード例 #8
0
def getReferenceKey(line):
    articletype = Mio.findKey(line,'@','{')
    key = Mio.findKey(line,'{',',')
    return articletype, key