Project

General

Profile

« Previous | Next » 

Revision 3723

ch_root: Don't require both the input and output mappings to contain their respective new roots, since sometimes only one or the other root is being subset. This will occur, for example, in mappings that are flat on the input but normalized on the output, such as VegCSV.

View differences:

bin/ch_root
36 36
            row[i], n = re.subn(configs[i]['in_root_re'], r'',
37 37
                configs[i]['root']+row[i])
38 38
            return n > 0
39
        if row[0] != '' and sub(0):
40
            if row[1] != '' and not sub(1): raise SystemExit('Map error: Root "'
41
                +configs[1]['in_root']+'" is not contained in output mapping: '
42
                +row[1])
39
        if row[0] != '' and sub(0) and (row[1] == '' or sub(1)):
43 40
            writer.writerow(row)
44 41

  
45 42
main()

Also available in: Unified diff