Project

General

Profile

« Previous | Next » 

Revision 3757

ch_root: Support column headers without a root, for non-hierarchical formats such as DwC

View differences:

bin/ch_root
27 27
    cols = reader.next()
28 28
    for i in xrange(len(configs)):
29 29
        config = configs[i]
30
        label, config['root'] = maps.col_info(cols[i], require_root=True)[:2]
31
        cols[i] = label+':'+config['out_root']
30
        cols[i], config['root'] = maps.col_info(cols[i])[:2]
31
        
32
        if config['root'] != None: cols[i] += ':'+config['out_root']
33
        else:
34
            assert config['out_root'] == ''
35
            config['root'] = ''
36
        
32 37
        config['in_root_re'] = r'^'+re.escape(config['in_root'])+r'(?=\b|\W|$)'
33 38
    writer.writerow(cols)
34 39
    for row in reader:

Also available in: Unified diff