@@ -122,25 +122,14 @@ def intermediate_to_list(configuration):
122122 result = []
123123
124124 for element in configuration :
125+ temp = {}
125126 if isinstance (element , list ):
126- result = result + intermediate_to_list (list (enumerate (element )))
127-
128- elif isinstance (element , tuple ):
129- (index , config ) = element
130- # update the keys to prefix the index
131- temp = {}
132- for key , value in config .items ():
133- # write the new key
134- temp ['{i}.{key}' .format (i = index + 1 , key = key )] = value
135- config = temp
136- # now the keys are updated with the index
137- # reduce to atoms the new config
138- # by recursively calling yourself
139- # on a list containing the new atom
140- result = result + intermediate_to_list ([config ])
127+ for index , el in enumerate (element ):
128+ for key , value in el .items ():
129+ temp ['{i}.{key}' .format (i = index + 1 , key = key )] = value
130+ result = result + intermediate_to_list ([temp ])
141131
142132 elif isinstance (element , dict ):
143- temp = {}
144133 for key , value in element .items ():
145134 if isinstance (value , string_types ) or isinstance (value , int ):
146135 temp [key ] = value
0 commit comments