def initialize_grid(obj_count, x_size, y_size, token): # for example http://localhost:5000/init-grid/10/600/600/abc GMS["mgm"] = GridManager(utils.StoreType.matrix, obj_count, x_size, y_size, 40) GMS["hgm"] = GridManager(utils.StoreType.hashed, obj_count, x_size, y_size, 40) BOXES = utils.generate_objects(obj_count, x_size, y_size, 120, 120, 40) for box in BOXES: GMS["mgm"].add_box(box) GMS["hgm"].add_box(box) return utils.get_grids_json(GMS, BOXES)
def initialize_grid(obj_count, x_size, y_size, token): # for example http://localhost:5000/init-grid/10/600/600/abc GMS['mgm'] = GridManager(utils.StoreType.matrix, obj_count, x_size, y_size, 40) GMS['hgm'] = GridManager(utils.StoreType.hashed, obj_count, x_size, y_size, 40) BOXES = utils.generate_objects(obj_count, x_size, y_size, 120, 120, 40) for box in BOXES: GMS['mgm'].add_box(box) GMS['hgm'].add_box(box) return utils.get_grids_json(GMS, BOXES)
def test_object_generator(count): assert len(utils.generate_objects(count, 1000, 1000, 100, 100, 64)) == count