def _boilerplate_test(self, item_list, to_be_deleted_item, desired_input_bfs_list, desired_input_dfs_list, desired_output_bfs_list, desired_output_dfs_list): ''' Common code required to write test function. Does the test running mechanism. ''' with captured_output() as (raw_output, error): tree, item_dict = make_nary_tree_with_dict(item_list) bfs(tree) dfs(tree) if to_be_deleted_item is not None: tree = delete(item_dict[to_be_deleted_item]) else: tree = delete(None) bfs(tree) dfs(tree) received_output = raw_output.getvalue().strip() test_case_output = cook_string_for_list(desired_input_bfs_list) \ + ' ' + linesep + \ cook_string_for_list(desired_input_dfs_list) \ + ' ' + linesep + \ cook_string_for_list(desired_output_bfs_list) \ + ' ' + linesep + \ cook_string_for_list(desired_output_dfs_list) self.assertEqual(test_case_output.strip(), received_output)
def menu(self): while self.dato: selection = input('\nSelect 1 to insert, 2 to update, 3 to read, 4 to delete\n') if selection == '1': insert.insert() elif selection == '2': update.update() elif selection == '3': read.read() elif selection == '4': delete.delete() else: print('\n Invalid selection')
def main(): parser = build_arg_parser() args = parser.parse_args() if (args.sub_command == 'push'): if (len(args.files) == 0): logger.die('Must include at least one file') else: for f in args.files: upload.upload(f, args.MediaFire_Path) elif (args.sub_command == 'pull'): if (len(args.files) == 0): logger.die('Must include at least one file') else: for f in args.files: download.download(f) elif (args.sub_command == 'del'): if (len(args.files) == 0): logger.die('Must include at least one file') else: for f in args.files: delete.delete(f) elif (args.sub_command == 'init'): if (user.is_user_signed_in()): logger.end('User is already initialized') else: user.get_auth() elif (args.sub_command == 'list'): if (len(args.files) == 0): lister.list_files('') else: for f in args.files: lister.list_files(f) elif (args.sub_command == 'diff'): if (len(args.files) == 0): logger.die('Must include at least one file') else: for f in args.files: diff.diff(f, args.MediaFire_Path) elif (args.sub_command == 'out'): user.log_out() elif (args.sub_command == 'change'): user.change_user() elif (args.sub_command == 'share'): if (len(args.files) == 0): logger.die('Must include at least on file') else: for f in args.files: share.share(f)
def mainloop(): update.initupdate() draw.draw() delete.delete() while True: update.update() draw.draw() delete.delete() if config.quit: draw.draw("end") getpass.getpass("") break elif config.pause: draw.draw("pause") keyboard.wait("space+p") config.pause = False
def transaction(): jsonData = request.get_json(cache=False) user=jsonData["userName"] type = "Transaction" if request.method =='GET': getData = access(graph, type, user, user) elif request.method=='POST': postData = [jsonData["userName"], jsonData["transName"], jsonData["transDate"], jsonData["transLocation"],jsonData["transAmount"]] insert(graph,type,postData) elif request.method=='PUT': current=["currentItem"] mod = jsonData["modItem"] modify(graph,type,user,current,mod) elif request.method=='DELETE': delItem=jsonData["delItem"] delete(graph,type,user,delItem)
def evaluate(): data = request.get_json() logging.info("data sent for evaluation {}".format(data)) test_id = data.get('set_id') patterns = data.get('patterns') word = data.get('composition') length = data.get("compositionLength") new_patterns = [] flag = False for i in patterns: new_patterns.append(i) new_patterns.append(i[::-1]) for i in new_patterns: if i in word and flag == False: flag = True if flag == True: if (length) >= 10000: result = 5000 return jsonify(testId=test_id, result=result) else: while len(new_patterns) > 0: word, new_patterns = delete.delete(word, new_patterns) result = length - len(word) logging.info("My result :{}".format(result)) return jsonify(testId=test_id, result=result)
def saving(): jsonData = request.get_json(cache=False) user=jsonData["userName"] type = "Goal" if request.method =='GET': getData = access(graph, type, user, user) elif request.method=='POST': postData = [jsonData["userName"], jsonData["savingsName"], jsonData["amount"], jsonData["downpay"],jsonData["term"],jsonData["description"]] insert(graph,type,postData) elif request.method=='PUT': current=["currentItem"] mod = jsonData["modItem"] modify(graph,type,user,current,mod) elif request.method=='DELETE': delItem=jsonData["delItem"] delete(graph,type,user,delItem)
def menu(self): while self.dato: selection = input( '\nSelecciona 1 para insertar, 2 para actualizar, 3 para leer, 4 para borrar.\n' ) if selection == '1': insert.insert() elif selection == '2': update.update() elif selection == '3': read.read() elif selection == '4': delete.delete() else: print('\nSelección inválida.')
def menu(self): while self.dato: # chossing option to do CRUD operations selection = input( '\nSelect 1 to insert, 2 to update, 3 to read, 4 to delete\n') if selection == '1': insert.insert() elif selection == '2': update.update() elif selection == '3': read.read() elif selection == '4': delete.delete() else: print('\n INVALID SELECTION \n')
def menu(self): while self.dato: print('\nSelect: ') print('\n 1 to Insert ') print('\n 2 to Update ') print('\n 3 to Read ') print('\n 4 to Delete ') selection = input('\nChoose your option: ') if selection == '1': insert.insert() elif selection == '2': update.update() elif selection == '3': read.read() elif selection == '4': delete.delete() else: print('\n INVALID SELECTION \n')
def switch(cursor, mysqldb, option, table_name): switchDic = { "1": sel.mysqlsel(cursor, mysqldb, table_name), "2": ins.insert(cursor, mysqldb, table_name), "3": up.update(cursor, mysqldb, table_name), "4": de.delete(cursor, mysqldb, table_name) } return switchDic.get(option, switchDefault())
def main(): quit = "y" while (quit == 'y' or quit == 'Y'): x = PrettyTable(["A R A B I D O P S I S T H A L I A N A D A T A B A S E"]) x.align["A R A B I D O P S I S T H A L I A N A D A T A B A S E"] = "l" x.padding_width = 1 x.add_row(["1. Create the Genes table"]) x.add_row(["2. Display the Genes"]) x.add_row(["3. Insert a new Gene"]) x.add_row(["4. Delete a Gene"]) x.add_row(["5. Blast a Gene"]) print x ## Get input ### choice = raw_input('Enter your choice [1-5] : ') ### Convert string to int type ## choice = int(choice) ### Take action as per selected menu-option ### if choice == 1: create.create() #this will create the tables and popululate the data elif choice == 2: display.display() # display both the tables from the database elif choice == 3: insert.insert() # insert a new gene record in the database elif choice == 4: delete.delete() # delete a gene record from the database elif choice == 5: name = raw_input("Please enter the name of the gene to perform blast: ") Blast.fn(name) # Calls the BLAST module Blast.show() # Calls the module that prints image downloaded from Google Search else: ## default ## print ("Invalid input. Please enter the correct input...") quit = raw_input('Do you wanna Continue : ')
def __init__(self): #super().__init__(main_window) self.color = "#%02x%02x%02x" % (64, 83, 104) self.Fnotifi = tk.Frame() self.Fnotifi.config(width=900, height=900, bg=self.color) self.pint() self.Fnotifi.pack() self.c = ConsultasBd.ConsultarBd() self.d = delete.delete() self.u = update.update()
def delStaffRole(oracle, **args): '''删除工号角色 dic: role_id, staff_id, oper_staff_id''' insert_value = args.copy() del insert_value['oper_staff_id'] where_dic = insert_value select_colums = ['role_id','staff_id'] sql = 'from staff_role' role_info = select(oracle, select_colums, sql, where_dic) print role_info if(role_info == None): raise Warning_, '角色%s工号%s己经不存在,无需删除'%(role_info[0]['role_id'], role_info[0]['staff_id'] ) add_infos = {'oper':'del'} add_infos['oper_staff_id'] = args['oper_staff_id'] add_infos['oper_date'] = '/sysdate' insertLog(oracle, 'staff_role', where_dic, add_infos) delete(oracle = oracle, table_name = 'staff_role', where_dic = where_dic)
def __init__(self, remoteShell, domainAdmin="admin", domain=None): self.remoteShell = remoteShell self.vastoolPath = "/opt/quest/bin/vastool" self.domainAdmin = domainAdmin self.defaultDomain = domain self.info = info.info(self.run) self.flush = flush.flush(self.run) self.create = create.create(self.run, self.defaultDomain) self.delete = delete.delete(self.run) self.timesync = timesync.timesync(self.run) self.nss = nss.nss(self.run) self.group = group.group(self.run) self.isvas = isvas.isvas(self.run) self.list = list.list(self.run) self.auth = auth.auth(self.run, self.defaultDomain) self.cache = cache.cache(self.run) self.configure = configure.configure(self.run) self.configureVas = configureVas.configureVas(self.run) self.schema = schema.schema(self.run) self.merge = merge.merge(self.run) self.unmerge = unmerge.unmerge(self.run) self.user = User.user(self.run) self.ktutil = ktutil.ktutil(self.run) self.load = load.load(self.run) self._license = License.License(self.run) self.License = self._license.License self.parseLicense = self._license.parseLicense self.compareLicenses = self._license.compareLicenses #self.vasUtilities = vasUtilities.vasUtilities(self.remoteShell) self.unconfigure = unconfigure.unconfigure(self.run) self.nssdiag = nssdiag(self.run) isinstance(self.info, info.info) isinstance(self.flush, flush.flush) isinstance(self.create, create.create) isinstance(self.delete, delete.delete) isinstance(self.timesync, timesync.timesync) isinstance(self.nss, nss.nss) isinstance(self.group, group.group) isinstance(self.isvas, isvas.isvas) isinstance(self.list, list.list) isinstance(self.auth, auth.auth) isinstance(self.cache, cache.cache) isinstance(self.configure, configure.configure) isinstance(self.configureVas, configureVas.configureVas) isinstance(self.schema, schema.schema) isinstance(self.merge, merge.merge) isinstance(self.unmerge, unmerge.unmerge) isinstance(self.user, User.user) isinstance(self.ktutil, ktutil.ktutil) isinstance(self.load, load.load) #isinstance(self.vasUtilities, vasUtilities.vasUtilities) isinstance(self.unconfigure, unconfigure.unconfigure) isinstance(self.nssdiag, nssdiag)
def _test_operation_delete(self, item, item_dict, desired_output_bfs_list, desired_output_dfs_list): ''' Performs delete operation and also checks for its correctness. ''' tree = None with captured_output() as (raw_output, error): if item is not None: tree = delete(item_dict[item]) del item_dict[item] else: tree = delete(None) bfs(tree) dfs(tree) received_output = raw_output.getvalue().strip() test_case_output = cook_string_for_list(desired_output_bfs_list) \ + ' ' + linesep + \ cook_string_for_list(desired_output_dfs_list) self.assertEqual(test_case_output.strip(), received_output) return tree
def delStops(route,convertId): i = 0 size = len(route.stop) #print "delDone" + bytes(size) i = -1 for stop1 in route.stop: i += 1 j = -1 for stop2 in route.stop: j += 1 if (stop1.isGetOn != True or stop2.isGetOn != False): continue object_id = long(convertId) * MAXBUSINDEX + i * size + j #print "Deldone",object_id,stop1.lng,stop1.lat,stop2.lng,stop2.lat logger.debug("UpdateDone=%ld,%lf,%lf,%lf,%lf",object_id,stop1.lng,stop1.lat,stop2.lng,stop2.lat) try: delete(ip,port,stop1.lng,stop1.lat,stop2.lng,stop2.lat,long(object_id)) except Exception,e: # print Exception,":",e,":",object_id logger.error("Exception=%s:e=%s:%ld,%lf,%lf,%lf,%lf",Exception,e,object_id,stop1.lng,stop1.lat,stop2.lng,stop2.lat)
def delete_old_data(older_than_days, dataset_name, dry_run, path): if not os.path.isdir(os.path.join(path, dataset_name)): print "{0} is not a valid dataset".format(dataset_name) return 1 ds_string = " for dataset {0}".format(dataset_name) if dataset_name else "" message = "deleting records older than {0} days{1}".format( older_than_days, ds_string) print message if dry_run: print "Dry run - will not delete any files" today = datetime.datetime.today() # Remove trailing slashes path = path.rstrip('/') delete(path, today, older_than_days, dataset_name, dry_run)
def norm_cmd(cmd): if cmd == "a": add_contact() command() elif cmd == "s": search() command() elif cmd == "u": update() command() elif cmd == "d": delete() command() elif cmd == "ls": ls() command() else: print( "\nHmmm... that doesn't seem like a command, enter 'help' to see all commands" ) command()
def poolToAbstract(oracle, **args): for k, v in args.items(): exec "%s = '%s'" % (k, v) update_dic = {'state': 'abstract', 'state_date': '/sysdate'} must_reverse_count = int(tax_end_nbr) - int(tax_begin_nbr) + 1 where_dic = { 'distri_id': distri_id, 'state': 'instance', 'tax_code': tax_code, 'staff_id': oper_staff_id } and_the = "and to_number(tax_nbr)> = to_number('%s') and \ to_number(tax_nbr)< = to_number('%s')" % (tax_begin_nbr, tax_end_nbr) update(oracle=oracle, table_name='pool', update_dic=update_dic, where_dic=where_dic, and_the=and_the, count=must_reverse_count) where_dic = { 'tax_code': tax_code, 'distri_id': distri_id, 'state': 'abstract', 'staff_id': oper_staff_id } add_infos = {'oper': 'abstract'} add_infos['oper_staff_id'] = oper_staff_id add_infos['oper_date'] = '/sysdate' insertLog(oracle, 'pool', where_dic, add_infos, and_the, must_reverse_count) #删掉 delete(oracle=oracle, table_name='pool', where_dic=where_dic, count=must_reverse_count)
def main(): movie_list = [["Monty Python and the Holy Grail", 1975, 12.95], ["On the Waterfront", 1954, 9.95], ["Cat on a Hot Tin Roof", 1958, 7.95], ["Long Hot Summer", 1958, 9.95]] display_menu() while True: command = input("Command: ") if command == "list": list.list(movie_list) elif command == "add": add.add(movie_list) elif command == "del": delete.delete(movie_list) elif command == "find": find.find_by_year(movie_list) elif command == "exit": break else: print("Not a valid command. Please try again.\n") print("Bye!")
def menu(self): while self.dato: menu = ''' 1._Insertar 2._Actualizar 3._Eliminar 4._Consultar 5._ Salir''' print(menu) selection = input("Ingrese Opcion : ") if selection == '1': insert.insert() elif selection == '2': update.update() elif selection == '3': delete.delete() elif selection == '4': read.read() elif selection == '5': exit() else: print("Opcion Invalida")
def run(self): created = create(self.image, self.flavor, self.network, self.count) disp_list = created.run() print disp_list if len(disp_list[0]['server']) > 0: deleted = delete(disp_list[0]['server'], self.count) disp_list.append(deleted.run()[0]) #x = PrettyTable(["Task Name", "Minimum Time", "Average Time", "Maximum Time"]) #x.add_row(["nova.create",dict_values['min'], dict_values['avg'], dict_values['max']]) #x.add_row(["nova.delete",dict_delete['min'], dict_delete['avg'], dict_delete['max']]) #x.add_row(["TOTAL", TOTAL_MIN, TOTAL_AVG, TOTAL_MAX]) #print x print disp_list return disp_list
def run(self): created = create(self.image, self.flavor, self.network, self.count) server_name = created.run() time.sleep(10) volume = create_volume(self.size) volume_name = volume.run() time.sleep(10) comm = "openstack server add volume " + server_name + " " + volume_name os.system(comm) time.sleep(10) print "Volume: " + volume_name + " attached to server " + server_name deleted = delete(server_name) deleted.run() del_volume = delete_volume(volume_name) del_volume.run()
def delete(self, request, pk): return delete(request, pk)
def testRmDir(self): walk.walk(self.base_dir) delete.delete(self.base_dir, "総務省")
def delete_maps(self): delete(self.songs_dir, {"std": self.std.get(), "mania": self.mania.get(), "ctb": self.ctb.get(), "taiko": self.taiko.get()}, self.download_video) showinfo(parent=self.root, title="Done!", message="Finished removing all videos and other game modes!") showinfo(parent=self.root, title="Done!", message="RECOMMENDED: refresh your osu! by clicking F5 while in song selection") self.root.destroy()
#tablename = 'little' #进行连接数据库 conn = MySQLdb.connect(host = host,user = user,passwd = passwd,db = db,port = port,charset = charset) cursor = conn.cursor() a = 0 while a!=5: print "1-查询数据" print "2-修改数据" print "3-删除数据" print "4-增添数据" print "5-退出" a = input("请输入你的选择:") if a==5: exit #应填入依次为id,name,age,class if a==4: add.add('53','py','20','c++学习班',cursor,conn) #应填入依次为id,name(依照选择删除的方式id/name) if a==3: delete.delete('53','py',cursor,conn) #应填入依次为id,修改的信息,修改信息的类别 if a==2: update.update('52','python学习班','class',cursor,conn) #应填入依次为id,name,age,class(依照选择查询的方式id/name/age/class) if a==1: select1.select('1','py','20','c++学习班',cursor,conn) cursor.close() conn.close()
def do_delete(self, line): title = line.split()[0] print delete.delete(title, self.username, self.password)
from delete_according_to_value import delete_according_to_value from insert import insert from sort import sort list = [4, 1, 5, 8, 3, 7, 4, 6, 2] head = create(list) print(head) output(head) reverse_output(head) reverse_output_recursively(head) head = reverse(head) print() output(head) delete(head, 2) output(head) append(head, 40) output(head) delete_according_to_value(head, 40) output(head) delete_according_to_value(head, 8) output(head) head = insert(head, 0, 33) output(head) sort(head)
def delPool(self): delete(oracle=oracle, table_name='pool', where_dic=self.where_dic, count=self.reverse_count)
import json import psycopg2 from insert import insert from update import update from delete import delete database = 'vectordb' user = '******' try: conn = psycopg2.connect(database='vectordb', user='******') consumer = KafkaConsumer( 'myjson1', bootstrap_servers='localhost:9092', value_deserializer=lambda m: json.loads(m.decode('utf-8'))) for message in consumer: if message.value["action"] == "insert": insert(message.value, conn) elif message.value["action"] == "update": update(message.value, conn) elif message.value["action"] == "delete": delete(message.value, conn) except Exception as e: print(e) conn.close()
def student_detect_interface(self): self.root.destroy() gui = delete.delete("学生数据", self.user) gui.gui_arrang()
def delete_wrap(): if len(sys.argv) < 3: print "Not enough arguments for join" #TODO add help return serv = sys.argv[2] D.delete(serv)
def lookingAt(self): global previousnum global bools global reftex global headers entries=getInfo.getinfo(fileName()) dictionary=getInfo.getDictionary(fileName()) #Stiffle error message when no signal is selected try:text= str(self.left.scrollAreaWidgetContents.selectedItems()[0].text()) except:return #get current selection's position in vdb i=0 while i<len(entries): if entries[i][1]==text: num=i i+=1 #Checks for changes to text boxes with bool #num =-1 is a flag that a variable is being deleted, and not to save changes made if bools==True and num!=-1: bools=False saveChanges(self,headers,num) return #If num is set as flag -1, reset it to 0 #This indicates not to save changes, so bool is set to False if num==-1: bools=False num=0 #Get attributes #headers=entries[num][0] headers=getInfo.getDictionary(fileName()) #CLEAR RIGHT SIDE INFORMATION HUB clearRightInfoHub() #Create framework for upright side information hub makeRightInfoHub(self,headers) #Get signal's attribute info i=1 signals=[] while i<len(entries[num][0])+1: signals.append(entries[num][i]) i+=1 i=0 #write attribute info to screen while i<len(entries[num][0]): if entries[num][0][i] in headers: labler(entries[num][0][i],signals[i],self,i) headers.remove(entries[num][0][i]) else: labler(dictionary[0],'',self,i) i+=1 #Disconnect buttons try: self.deleteButton.clicked.disconnect() except Exception: pass try: self.saveButton.clicked.disconnect() except Exception: pass #Connect buttons self.deleteButton.clicked.connect(lambda: delete(str(rightInfoHub['textBoxes']['name'].text()),self,num)) self.saveButton.clicked.connect(lambda: saveChanges(self,headers,num)) clearRightInfoHub() previousnum=num bools=False
def test_create_success(self): response = delete.delete(delete_success_body, '') self.assertEqual(response['statusCode'], 200)
import buy as b import add as a import inf as i import delete as d while 1: print(' 1:продажа товара\n 2:поставка товара\n 3:данные по продажам\n 4:удалить\n 0:выход \n') c=input("введите номер пункта меню") if c=='1': b.buy() if c=='2': a.add() if c=='3': i.inf() if c=='4': d.delete() if c=='0': break
from delete import delete import xbmcgui import xbmc if __name__ == '__main__': type = xbmc.getInfoLabel("ListItem.Property(type)") id = xbmc.getInfoLabel("ListItem.Property(streamID)") if type == "stream": delete(type,id) else: dialog = xbmcgui.Dialog() ok = dialog.ok('Add', 'There has been an error.\nPlease inform the developer about this.')
import MySQLdb import delete as d d.delete("alunos", "id_aluno = 21")
def reset(): server = find_server('^{}-.*'.format(name_prefix)) if server: delete.delete(server.id) wait.until_gone(server)
def test_create_failure(self): response = delete.delete(delete_failure_body, '') self.assertEqual(response['statusCode'], 400)
def delete_ca(): data = json.loads(request.form.get('data')) delete_data = delete(text_id=data['text_id']) return delete_data
import delete import withtags import tags import os reason = os.environ.get("reason") tags = tags.parse(input("Tags: ")) print("reason",reason) print("tags",tags) input("^C to not delete") for rec in withtags.searchForTags(tags): delete.delete(rec[0],reason)
def onLogi6(self, event): delete() print("done") self.Close()
def deleteRecord(self,oid): return delete.delete(oid,self.storage,self.indexer,self.log)
from delete import delete import xbmcgui import xbmc if __name__ == '__main__': type = xbmc.getInfoLabel("ListItem.Property(type)") playlist = xbmc.getInfoLabel("ListItem.Property(playlistName)") if type == "playlist": delete(type, playlist) else: dialog = xbmcgui.Dialog() ok = dialog.ok('Add', 'There has been an error.\nPlease inform the developer about this.')
def runModel(climate,param_values,num_model,round_num,output): #copy source folder and rename the new name st.copytree('./sourceFolder','./'+str(num_model)) #change the weather_file and seed_file in compact.osw weather_file = climate + '.epw' seed_file = 'CZ' + climate + '.osm' with open('./'+str(num_model)+'/compact.osw', "r") as f: page = f.read() old_weather = inf.getValue1('weather_file',page) rp.replace1('./'+str(num_model)+'/compact.osw',old_weather,weather_file) old_seed = inf.getValue1('seed_file',page) rp.replace1('./'+str(num_model)+'/compact.osw',old_seed,seed_file) #delete the measures' information that is not used in the work name_meas = [] for row in param_values: if row[0] not in name_meas: name_meas.append(row[0]) dt.delete('./'+str(num_model)+'/compact.osw',name_meas) #change the values in the existing sebi.osw based on measure for row in param_values: value = inf.getValue2(row[0],row[1],page) rp.replace2('./'+str(num_model)+'/compact.osw',str(value),str(row[2]),row[0],row[1]) #run the models #'/usr/bin/openstudio': path of the software os.system("'/usr/bin/openstudio' run -w './"+str(num_model)+"/compact.osw'") #get the results #output data output_data = [num_model,climate] for row in param_values: output_data.append(row[2]) #source eui and site eui total_site, total_source, total_area = rene.readEnergyUse(num_model) output_data.append(total_source/total_area*1000.0/11.35653) output_data.append(total_site/total_area*1000.0/11.35653) #Unit: MJ/m2 #[record_model,source_EUI,site_EUI] #record the data in the './results/energy_data.csv' with open('./results/energy_data_'+str(round_num)+'.csv', 'a') as csvfile: energy_data = csv.writer(csvfile, delimiter=',') energy_data.writerow(output_data) #record the error in the './results/error.csv' if total_area < 0: with open('./results/error.csv', 'a') as csvfile: error = csv.writer(csvfile, delimiter=',') error.writerow(output_data) output.put(output_data) #delete the folder st.rmtree('./'+str(num_model))
__author__ = 'user' import allview import sinchung import delete import listveiw while 2: print "1. all view 2. sinchung 3. delete 4. your list view 5. close" n=input() if n==1: moklok={} allview.all_view(moklok) elif n==2: sinchung.sinchung() elif n==3: delete.delete() elif n==4: listveiw.listveiw() else: break