MCPcopy Create free account
hub / github.com/bterwijn/memory_graph / nested_list

Function nested_list

memory_graph/utils.py:173–184  ·  view source on GitHub ↗

Returns a nested list with the given 'sizes' for test purposes.

(sizes, i=0, value=[0])

Source from the content-addressed store, hash-verified

171 return type(data).__name__
172
173def nested_list(sizes, i=0, value=[0]):
174 """ Returns a nested list with the given 'sizes' for test purposes. """
175 if i == len(sizes)-1:
176 data = []
177 for _ in range(sizes[i]):
178 data.append( value[0] )
179 value[0]+=1
180 else:
181 data = []
182 for size in range(sizes[i]):
183 data.append( nested_list(sizes,i+1) )
184 return data
185
186def my_round(value):
187 """ Rounds the value to the nearest integer rounding '.5' up consistantly. """

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected