def opening_page(): if request.method == 'GET': return render_template('initial.html') elif request.method == 'POST': acc_got = request.form['Enter'] main_func(acc_got) return redirect(url_for('get_data'))
def set_reminder_btn_click(): # テキスト取得 date = int(self.txt.get()) with open('./data/remind_date.txt', 'a') as f: print(date, file=f) self.root.destroy() main.main_func()
def open_file(): browse_text.set("loading...") # input = filedialog.askopenfile(initialdir="/") input = filedialog.askopenfile(parent=root, title="Choose a file", filetype=[("ogg file", "*.ogg")]) file = input.name main_func(file) browse_text.set("Browse")
def select_image(): global panelA, panelB path = filedialog.askopenfilename() if len(path) > 0: # main_func(path) image1 = loadImage(path) image2 = main_func(path) # image2 = cv2.cvtColor(image2, cv2.COLOR_BGR2RGB) image1 = Image.fromarray(image1) image2 = Image.fromarray(image2) image1 = ImageTk.PhotoImage(image1) image2 = ImageTk.PhotoImage(image2) if panelA is None or panelB is None: panelA = Label(image=image1) panelA.image = image1 panelA.pack(side="left", padx=10, pady=10) panelB = Label(image=image2) panelB.image = image2 panelB.pack(side="right", padx=10, pady=10) else: panelA.configure(image=image1) panelB.configure(image=image2) panelA.image = image1 panelB.image = image2
def manual_start(): print " Enter the first date " first = keyboard.Date() print " Enter the Second " second = keyboard.Date() for i in first: if second not in second: print("process {0} number {1} was created\n ".format( i.name, i.pid)) main.main_func()
def onok(): # Takes directory details from settings and creates them if they do not exist directory_1=settings.main_dir directory_2=settings.main_dir_hidden if not os.path.exists(directory_1): os.makedirs(directory_1) if not os.path.exists(directory_2): os.makedirs(directory_2) # username = username_input.get() password = password_input.get() secrets_file = settings.secrets_file f = open(secrets_file, "w") f.write(username+'\n') # python will convert \n to os.linesep f.write(password+'\n') # python will convert \n to os.linesep f.write(directory_1+'\n') f.close() # you can omit in most cases as the destructor will call if root.destroy() main.main_func()
def run_main(args): vis_env = get_info() args.environment = os.path.join(args.host, "{}_{}".format(vis_env[1], vis_env[0])) ex.info["vis_env"] = args.environment average, final, mean = main_func(args) ex.info["ADE"] = mean ex.info["FDE"] = final ex.info["AVERAGE"] = average return average
def get_output(n_clicks, url, keywords): if n_clicks: search_words = [x.strip() for x in keywords.split(",")] similar_words, fig = main_func(url, search_words) return [ html.Div([ html.H3(children=f"Similar words to {keywords} are :"), html.Div([html.Li(x) for x in similar_words]), dcc.Graph(figure=fig) ]) ] else: return [None]
def index(): top_3_world, world_sentiments, top_3_india, india_sentiments = main_func() return render_template("Page.html", w_1=top_3_world[0], w_s_1=round(world_sentiments[0], 3), w_2=top_3_world[1], w_s_2=round(world_sentiments[1], 3), w_3=top_3_world[2], w_s_3=round(world_sentiments[2], 3), i_1=top_3_india[0], i_s_1=round(india_sentiments[0], 3), i_2=top_3_india[1], i_s_2=round(india_sentiments[1], 3), i_3=top_3_india[2], i_s_3=round(india_sentiments[2], 3))
def main(): main_func( DBShelver, process_name="db_shelver", description="Shelve data from Kafka to DB", )
if args.restart: restart_file = int(args.restart) path_dir = parent_dir + 'output/' out_data = np.load(path_dir + 'particle_' + str(restart_file) + '.npy') out_info = np.load(path_dir + 'info_' + str(restart_file) + '.npy', allow_pickle=True).item() restart_t = out_info['t'] print('Restart from : particle_' + str(restart_file) + '.npy\n') start_t = time.time() main.main_func(out_data, restart_t, restart_file) end_t = time.time() else: restart_t = 0. start_t = time.time() main.main_func() end_t = time.time() t_taken = (end_t - start_t) / 60. timesteps = (stop_time - restart_t) / step_time grids = int((x_end - x_start) / step_length) print("Total time taken : " + str(t_taken) + ' min') print("Number of grids : " + str(grids**3)) print("Avg. time taken per timestep: " + str(t_taken / timesteps) + ' min')
def main(): main_func( MQTTReceiver, process_name="mqtt_receiver", description="Receive MQTT data, and send them to Kafka", )
def ok_button_click(): root.destroy() main.main_func()
#Not found else: self.pc -= 2 #Not currently made print else: print(hex(self.opcode)) #saves for debuging purposes self.pc -= 2 self.pc += 2 pytime = time() if pytime - self.t_last >= 1.0/60: if self.delay_timer > 0: self.delay_timer -= 1 if self.sound_timer > 0: sys.stdout.write("\a") self.sound_timer -= 1 self.t_last = pytime if __name__ == "__main__": from main import main_func main_func()
#!/usr/bin/env python from Tkinter import * import main import os import settings import getuserinput if (os.path.exists(settings.main_dir) and os.path.exists(settings.main_dir_hidden) and os.path.isfile(settings.secrets_file)): print 'Your credentials exist' main.main_func() else: getuserinput.enter()
def main(): main_func(CountUpdater, process_name="count_updater", description="Update count of device sensor from iot.epa.gov.tw", )
def return_btn_click(): self.root.destroy() main.main_func()
def main(): main_func( DeviceInformer, process_name="device_informer", description="Get device information from iot.epa.gov.tw", )
def main(): main_func()
def main(): main_func( EventTransmitter, process_name="mqtt_transmitter", description="Transmit MQTT data", )
#Not found else: self.pc -= 2 #Not currently made print else: print(hex(self.op)) #saves for debuging purposes self.pc -= 2 self.pc += 2 pytime = time() if pytime - self.timer_last >= 1.0/60: if self.delayTimer > 0: self.delayTimer -= 1 if self.soundTimer > 0: sys.stdout.write("\a") self.soundTimer -= 1 self.timer_last = pytime if __name__ == "__main__": from main import main_func main_func()
def main(): main_func( RawdataUpdater, process_name="rawdata_updater", description="Update rawdata from iot.epa.gov.tw", )
def chirakari_hantei(): output_name = utils.get_unused_out_dir_num() os.makedirs(f'./data/out/{output_name}', exist_ok=True) output_video_file_name = f'./data/out/{output_name}/{output_name}.mp4' # ビデオを撮影し、保存する capture_depth_image.capture_depth_image(output_video_file_name, 4) sec_array = [1, 2, 3] detect_count_array = [] src_array = [] for sec in sec_array: output_image_file_name = f'./data/out/{output_name}/{output_name}_{sec}sec.jpg' # 指定された秒数の画像を保存 save_frame_sec.save_frame_sec(output_video_file_name, sec, output_image_file_name) # 画像から物体を検出し、物体の数と物体を矩形で囲んだ画像を取得 detect_count, src = detect_counter.detect_counter(output_image_file_name) detect_count_array.append(detect_count) src_array.append(src) # 3回分のdetect_countのうち2番目の大きさのものをdetect_countとsrcに代入 sorted_detect_count_array = sorted(detect_count_array) medium_count = sorted_detect_count_array[1] detect_count_index = detect_count_array.index(medium_count) detect_count = detect_count_array[detect_count_index] src = src_array[detect_count_index] # 外接矩形された画像を表示 cv2.imshow('output', src) cv2.waitKey(3000) # 終了処理 cv2.destroyAllWindows() root = tk.Tk() root.title(u"散らかり判定") root.geometry("600x400") if detect_count > 10: label = tk.Label(text=u'部屋が汚れています!大至急片付けましょう!\n') label.pack() elif detect_count > 0: label = tk.Label(text=u'部屋が少し汚いので片付けてください!\n') label.pack() else: label = tk.Label(text=u'部屋が汚れています!大至急片付けましょう!\n') label.pack() def ok_button_click(): root.destroy() okButton = tk.Button(root, text='OK', command=ok_button_click) okButton.pack() root.mainloop() os.remove(output_video_file_name) main.main_func()
def main(): main_func(ESShelver, process_name="es_shelver", description="Shelve data from Kafka to Elasticsearch", )
import os import glob from main import main_func import numpy as np open('fail.txt', 'w').close() a = glob.glob('test/*.jpg') for path in a: print(path) main_func(path, test=True) # a = np.array([1,2,3])
def main(): main_func(MQTTETLer, process_name="mqtt_etl", description="MQTT ETL")
def main(): main_func(RESTETLer, process_name="rest_etl", description="REST ETL")
def main(): main_func(DataObject, process_name="data_object", description="Move data object to Kafka queue")