#NEWLINE# @ classmethod #NEWLINE# def build_buckets( cls , spec ) : #NEWLINE# #INDENT# def uniq_list( seq ) : #NEWLINE# #INDENT# seen = set ( ) #NEWLINE# seen_add = seen . add #NEWLINE# return [ x for x in seq if ( ( x not in seen ) and ( not seen_add ( x ) ) ) ] #NEWLINE# #UNINDENT# tag_specs = spec . split ( ',' ) #NEWLINE# struct = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for tag_spec in tag_specs : #NEWLINE# #INDENT# if ( ':' in tag_spec ) : #NEWLINE# #INDENT# tag_spec = tag_spec . split ( ':' , 2 ) #NEWLINE# tag = tag_spec [ 0 ] #NEWLINE# buckets = tag_spec [ 1 ] . split ( '|' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# tag = tag_spec #NEWLINE# buckets = [ ] #NEWLINE# #UNINDENT# buckets . append ( '' ) #NEWLINE# struct [ tag ] = uniq_list ( buckets ) #NEWLINE# #UNINDENT# return struct