Project

General

Profile

« Previous | Next » 

Revision 4047

bin/map: Preventing collisions if multiple inputs mapping to same output: Made collision suffix configurable so it can easily be changed

View differences:

map
36 36
import xml_func
37 37
import xml_parse
38 38

  
39
collision_suffix = '/_alt/'
40

  
39 41
def get_with_prefix(map_, prefixes, key):
40 42
    '''Gets all entries for the given key with any of the given prefixes
41 43
    @return tuple(found_key, found_value)
......
257 259
                idxs = outputs_idxs.setdefault(out, default)
258 260
                if idxs is not default: # key existed, so there was a collision
259 261
                    if idxs.count == 1: # first key does not yet have /_alt/#
260
                        mappings[idxs.first][1] += '/_alt/0'
261
                    mappings[i][1] += '/_alt/'+str(idxs.count)
262
                        mappings[idxs.first][1] += collision_suffix+'0'
263
                    mappings[i][1] += collision_suffix+str(idxs.count)
262 264
                    idxs.count += 1
263 265
            
264 266
            id_node = None

Also available in: Unified diff