Revision 1416
Added by Aaron Marcuse-Kubitza almost 13 years ago
bin/map | ||
---|---|---|
169 | 169 |
return process_rows(process_row, rows) |
170 | 170 |
|
171 | 171 |
def map_table(col_names, rows): |
172 |
col_names_ct = len(col_names) |
|
172 | 173 |
col_idxs = util.list_flip(col_names) |
173 | 174 |
|
174 | 175 |
i = 0 |
... | ... | |
185 | 186 |
def get_value(in_, row): |
186 | 187 |
try: return row.list[in_] |
187 | 188 |
except IndexError: return None |
188 |
def wrap_row(row): return util.ListDict(row, col_names, col_idxs) |
|
189 |
def wrap_row(row): |
|
190 |
return util.ListDict(util.list_as_length(row, col_names_ct), |
|
191 |
col_names, col_idxs) # handle CSV rows of different lengths |
|
189 | 192 |
|
190 | 193 |
return map_rows(get_value, util.WrapIter(wrap_row, rows)) |
191 | 194 |
|
Also available in: Unified diff
bin/map: map_table(): wrap_row(): Use util.list_as_length() to handle CSV rows of different lengths