Project

General

Profile

« Previous | Next » 

Revision 2031

bin/map: map_table(): Resolve each prefix into a separate mapping, which is collision-eliminated, instead of resolving values from multiple prefixes when each individual row is mapped

View differences:

bin/map
255 255
                if metadata_value(in_) == None:
256 256
                    try: names = get_with_prefix(col_idxs, prefixes, in_)
257 257
                    except KeyError: pass
258
                    else: mappings.append([names, out])
258
                    else: mappings[len(mappings):] = [[v, out] for v in names]
259
                        # can't use += because that uses assignment
259 260
            
260
            def get_value(in_, row):
261
                return util.coalesce(*util.list_subset(row.list, in_))
261
            def get_value(in_, row): return row.list[in_]
262 262
            def wrap_row(row):
263 263
                return util.ListDict(util.list_as_length(row, col_names_ct),
264 264
                    col_names, col_idxs) # handle CSV rows of different lengths

Also available in: Unified diff