Revision 1146
Added by Aaron Marcuse-Kubitza almost 13 years ago
map | ||
---|---|---|
121 | 121 |
doc0_root = doc0.documentElement |
122 | 122 |
if out_label == None: out_label = doc0_root.tagName |
123 | 123 |
|
124 |
def process_rows(process_row, rows): |
|
124 |
def process_rows(process_row, rows, col_names=None):
|
|
125 | 125 |
'''Processes input rows |
126 | 126 |
@param process_row(in_row, i) |
127 | 127 |
''' |
... | ... | |
130 | 130 |
if i < start: continue |
131 | 131 |
if end != None and i >= end: break |
132 | 132 |
process_row(row, i) |
133 |
|
|
133 | 134 |
row_ready(i, row) |
134 | 135 |
row_ct = i-start+1 |
135 | 136 |
return row_ct |
... | ... | |
161 | 162 |
|
162 | 163 |
cur = sql.select(in_db, table=in_root, fields=None, conds=None, |
163 | 164 |
limit=end, start=0) |
164 |
col_idxs = dict((v, i) for i, v in enumerate(sql.col_names(cur)))
|
|
165 |
col_idxs = util.list_flip(sql.col_names(cur))
|
|
165 | 166 |
|
166 | 167 |
mappings_new = [] |
167 | 168 |
for i, mapping in enumerate(mappings): |
... | ... | |
189 | 190 |
map_ = dict(mappings) |
190 | 191 |
reader = csv.reader(sys.stdin) |
191 | 192 |
cols = reader.next() |
192 |
col_idxs = dict([(value, idx) for idx, value in enumerate(cols)])
|
|
193 |
col_idxs = util.list_flip(cols)
|
|
193 | 194 |
|
194 | 195 |
mappings_new = [] |
195 | 196 |
for i, mapping in enumerate(mappings): |
Also available in: Unified diff
bin/map: Use new util.list_flip()