def _iter_decls_tsv(infile, extracolumns=None): columns = _get_columns('decls', extracolumns) for row in _tables.read_table(infile, columns, sep='\t'): if extracolumns: declinfo = row[:4] + row[-1:] extra = row[4:-1] else: declinfo = row extra = None # XXX Use something like tables.fix_row() here. declinfo = [None if v == '-' else v for v in declinfo] yield declinfo, extra
def _iter_ignored(infile, relroot): if relroot and relroot is not fsutil.USE_CWD: relroot = os.path.abspath(relroot) bogus = {_tables.EMPTY, _tables.UNKNOWN} for row in _tables.read_table(infile, IGNORED_HEADER, sep='\t'): *varidinfo, reason = row if _tables.EMPTY in varidinfo or _tables.UNKNOWN in varidinfo: varidinfo = tuple(None if v in bogus else v for v in varidinfo) if reason in bogus: reason = None varid = _info.DeclID.from_row(varidinfo) varid = varid.fix_filename(relroot, formatted=False, fixroot=False) yield varid, reason
def read_parsed(infile): # XXX Support other formats than TSV? columns = _get_columns('parsed') for row in _tables.read_table(infile, columns, sep='\t', fix='-'): yield _info.ParsedItem.from_row(row, columns)
def _iter_ignored(infile): for row in _tables.read_table(infile, IGNORED_HEADER, sep='\t'): *varidinfo, reason = row varid = _info.DeclID.from_row(varidinfo) yield varid, reason