def render_tree(t, imgName, w=None, h=None, layout=None, tree_style=None, header=None, units="px", dpi=90): """ Render tree image into a file.""" global _QApp for nid, n in enumerate(t.traverse("preorder")): n.add_feature("_nid", nid) scene, img = init_scene(t, layout, tree_style) tree_item, n2i, n2f = render(t, img) scene.init_values(t, img, n2i, n2f) tree_item.setParentItem(scene.master_item) scene.master_item.setPos(0, 0) scene.addItem(scene.master_item) if imgName == "%%inline": imgmap = save(scene, imgName, w=w, h=h, units=units, dpi=dpi) else: x_scale, y_scale = save(scene, imgName, w=w, h=h, units=units, dpi=dpi) imgmap = get_tree_img_map(n2i, x_scale, y_scale) return imgmap
def go(gj, name): gprof = profile.wrap(profile.BUILTIN['720p'], gj) name = 'out/%s_%s_%04d' % (name, basename, time * 10000) rdr = render.Renderer(gnm, gprof) evt, buf = rmgr.queue_frame(rdr, gnm, gprof, time) evt.synchronize() save(rdr.out, name, buf) print 'Saved', name, evt.time()
def process(): try: date_exec = request.args.get('date_exec') date_exec = datetime(int(date_exec[:4]), int(date_exec[4:6]), int(date_exec[6:])) sales, fact_table, product_dim, region_dim, folder = transformation( date_exec=date_exec) save(sales, fact_table, product_dim, region_dim, folder=folder) return {"Flag": "True"} except: return {"Flag": "False"}
def render_tree(t, imgName, w=None, h=None, layout=None, \ tree_style = None, header=None, units="px"): """ Render tree image into a file.""" scene, img = init_scene(t, layout, tree_style) tree_item, n2i, n2f = render(t, img) scene.init_values(t, img, n2i, n2f) tree_item.setParentItem(scene.master_item) scene.master_item.setPos(0,0) scene.addItem(scene.master_item) save(scene, imgName, w=w, h=h, units=units) imgmap = get_tree_img_map(n2i) return imgmap
def render_tree(t, imgName, w=None, h=None, layout=None, \ tree_style = None, header=None, units="px"): """ Render tree image into a file.""" scene, img = init_scene(t, layout, tree_style) tree_item, n2i, n2f = render(t, img) scene.init_data(t, img, n2i, n2f) tree_item.setParentItem(scene.master_item) scene.master_item.setPos(0, 0) scene.addItem(scene.master_item) save(scene, imgName, w=w, h=h, units=units) imgmap = get_tree_img_map(n2i) return imgmap
def get_img(t, w=None, h=None, layout=None, tree_style=None, header=None, units="px", dpi=90): global _QApp scene, img = init_scene(t, layout, tree_style) tree_item, n2i, n2f = render(t, img) scene.init_values(t, img, n2i, n2f) tree_item.setParentItem(scene.master_item) scene.master_item.setPos(0, 0) scene.addItem(scene.master_item) x_scale, y_scale, imgdata = save(scene, "%%return", w=w, h=h, units=units, dpi=dpi) _QApp.quit() _QApp = None return imgdata, {}
def render_tree(t, imgName, w=None, h=None, layout=None, tree_style = None, header=None, units="px", dpi=90): """ Render tree image into a file.""" global _QApp for nid, n in enumerate(t.traverse("preorder")): n.add_feature("_nid", nid) scene, img = init_scene(t, layout, tree_style) tree_item, n2i, n2f = render(t, img) scene.init_values(t, img, n2i, n2f) tree_item.setParentItem(scene.master_item) scene.master_item.setPos(0,0) scene.addItem(scene.master_item) if imgName == "%%inline": imgmap = save(scene, imgName, w=w, h=h, units=units, dpi=dpi) else: x_scale, y_scale = save(scene, imgName, w=w, h=h, units=units, dpi=dpi) imgmap = get_tree_img_map(n2i, x_scale, y_scale) return imgmap
def build(): teacher_list = [] search_data = [] with open('../data/syllabus.json', 'r') as f: syllabus = json.load(f) for subject in syllabus['data']: origin_detail = subject['detail'] detail_list = [] detail_list.append(subject['title']) detail_list.append(origin_detail['day']) detail_list.append(origin_detail['target']) detail_list.append(origin_detail['purpose']) detail_list.append(origin_detail['teachingStyle']) detail_list.append(origin_detail['gradePolicy']) detail_list.append(origin_detail['finalTest']) detail_list.append(origin_detail['message']) detail_list.append(" ".join(origin_detail['keywords'])) detail_list.append(" ".join(origin_detail['contents'])) if (subject['teacher'] not in teacher_list): search_data.append({ 'text': subject['teacher'], 'type': 'teacher', 'title': '教員', 'id': hash(f'teacher:{subject["teacher"]}'), }) teacher_list.append(subject['teacher']) search_data.append({ 'text': " ".join(detail_list).strip(), 'type': 'subject', 'title': subject['title'], 'id': subject['code'] }) save('../data/search.json', {'data': search_data})
def forex_eval(params): print(f'Using params: {params}') now_str = str(datetime.now()).replace(':', '-').replace(' ', '_').split('.')[0] writer = SummaryWriter(os.path.join(log_dir, now_str)) config = helpers.get_config(config_path) if 'n_dense_layers' in params and 'n_nodes_dense_layers' in params: config['dense_params'] = [{ 'out_features': params['n_nodes_dense_layers'] } for _ in range(params['n_dense_layers'])] if 'n_conv_layers' in params and 'conv_filter_size' in params and 'conv_kernel_size' in params: config['conv_params'] = [{ 'out_channels': params['conv_filter_size'], 'kernel_size': params['conv_kernel_size'] } for _ in range(params['n_conv_layers'])] for param, value in params.items(): if param in config: config[param] = value model = train(device, writer, config, data_dir) metrics = evaluate(model, device, writer, config, data_dir, config_path) save(model, device, metrics, now_str, config, model_dir, config_path) return {k: (v, 0.0) for k, v in metrics.items() if v is not tuple}
def get_img(t, w=None, h=None, layout=None, tree_style = None, header=None, units="px", dpi=90): global _QApp scene, img = init_scene(t, layout, tree_style) tree_item, n2i, n2f = render(t, img) scene.init_values(t, img, n2i, n2f) tree_item.setParentItem(scene.master_item) scene.master_item.setPos(0,0) scene.addItem(scene.master_item) x_scale, y_scale, imgdata = save(scene, "%%return", w=w, h=h, units=units, dpi=dpi) _QApp.quit() _QApp = None return imgdata, {}
def render_tree(t, imgName, w=None, h=None, layout=None, tree_style=None, header=None, units="px", dpi=90): """ Render tree image into a file.""" scene, img = init_scene(t, layout, tree_style) tree_item, n2i, n2f = render(t, img) scene.init_values(t, img, n2i, n2f) tree_item.setParentItem(scene.master_item) scene.master_item.setPos(0, 0) scene.addItem(scene.master_item) if imgName == "%%inline": imgmap = save(scene, imgName, w=w, h=h, units=units, dpi=dpi) else: x_scale, y_scale = save(scene, imgName, w=w, h=h, units=units, dpi=dpi) imgmap = get_tree_img_map(n2i, x_scale, y_scale) return imgmap
def save(): if main.save(): return 'save thanh cong!!!' return 'false'
def receiveData(): main.save("joe", data1) print(datafier.main(request.json["data"])) print(str(main.check("joe", datafier.main(request.json["data"])))) return str(main.check("joe", datafier.main(request.json["data"])))
if __name__ == "__main__": data = load_previous() print("Got data: ", data) print_stats(data) new_rolling = [int(x) for x in input("Please enter a new data array: ").split(",")] new_array_index = len(new_rolling) - 1 new_day = date.today() print("New rolling array ", new_rolling) print("Array index: ", new_array_index) print("New last updated: ", new_day) assert new_array_index >= 0 # pad off 0s till we get to 14 while len(new_rolling) != 14: new_rolling.append(0) data.rolling_array = new_rolling data.array_index = new_array_index data.last_updated = new_day print("**** STATS HAVE BEEN CHANGED. Please review the changes *****") print_stats(data) input("Press any key to continue") save(data) print("Changes have been saved")
res = app.create(key,value) if(res): print("Key Value pair has been added successfully") elif(option == 2): print("Enter the key:") key = input() print("Enter its value:") value = input() print("Enter the time-to-live") ttl = int(input()) res = app.create(key,value,ttl) if(res): print("Key Value pair has been added successfully") elif(option == 3): print("Enter the key:") key = input() app.read(key) elif(option == 4): print("Enter the key:") key = input() app.delete(key) print("Enter your option") option = int(input()) if(option == 5): datastore = app.save() with open("library.json",'w') as file: datastore = json.dumps(datastore) file.write(datastore)