def validarIpPaises(): arq = open('./flags/paises.flag', 'w') mycursor.execute("SELECT * FROM validarippaises") for row in mycursor: print(row[2], file=arq) arq.close() execute_rb('./lib/paises.rb')
def create_graphviz_files(pattern): check_dir_exist('output/graphviz_files/') for file_name in glob.glob(config.settings.template_dir + '*' + pattern + '*.twbx'): xml = xfile.get_xml_from_archive(file_name) twb_file_name = file_name[:-1] xml.write(twb_file_name, encoding="utf-8", xml_declaration=True) execute_rb('upload_script/gen_graphviz.rb', arguments=twb_file_name) os.rename( twb_file_name.split('/')[2] + '.dot', 'output/graphviz_files/' + twb_file_name.split('/')[2] + '.dot') os.remove(twb_file_name) return 'output/graphviz_files/' + twb_file_name.split('/')[2] + '.dot'
def validarIPPaises(): """arq = open('./DIY-Firewall/flags/paises.flag', 'w') c.execute("SELECT * FROM validarIPPaises") c.copy_to(arq, "validarippaises", sep=' ', columns=("flag",)) arq.close() print("Arquivo TXT gerado")""" execute_rb('./DIY-Firewall/lib/paises.rb') print("Rodou o RB") print("Felippe fez uma alteração") print("Zabiroba fez uma alteração") print("Bengalinho fez uma alteração")
async def ly(self, ctx, *, a: str, art=""): """가사를 출력합니다. ?ly '[제목]' '[아티스트]' 띄어쓰기가 포함되어있으면 꼭 '' 를 넣어야 합니다. 아티스트를 모를경우 ? 를 넣어주세요 (않넣으면 가사를 찾을수 없습니다.) """ f = open("simple.rb", 'w', encoding="utf-8") data = '''require './modules/alsong.rb' puts Alsong.get_lyrics("''' + a + '''","''' + art + '''") ''' f.write(data) f.close() success = execute_rb('simple.rb', '') print(success) f = open("lyric.json", 'r', encoding="utf-8") data = f.read() lyric = json.loads(data) title = lyric[0]['title'] artist = lyric[0]['artist'] lines = [line['text'] for line in lyric[1:]] await self.bot.say(lang[1]['ly']['get_ly']) f1 = open(a.replace(" ", "+") + "가사.txt", 'w', encoding="utf-8") f1.write(lang[1]['ly']['ly_form']['title']+" : " + title + "\n"+lang[1]['ly']['ly_form']['artist']+" : " + artist + "\n\n\n"+lang[1]['ly']['ly_form']['ly']+"\n") for i in range(len(lines)): f1.write(lines[i] + '\n') f1.close() await self.bot.send_file(ctx.message.channel, a.replace(" ", "+") + "가사.txt") f.close() os.remove(a.replace(" ", "+") + "가사.txt")
r_ast.write("path = cur_folder + f\n") r_ast.write("code = File.read(path)\n") r_ast.write("ast = Parser::CurrentRuby.parse(code)\n") r_ast.write("res = browse(ast)\n") r_ast.write("res = flatten_hash(res).to_s.gsub! '=>',':'\n") r_ast.write("map_ast_" + n + " = File.new(cur_folder+\"/map_source_" + n + "\",\"w\")\n") r_ast.write("map_ast_" + n + ".write(res)\n") r_ast.write("map_ast_" + n + ".close\n") r_ast.write("ast_" + n + "= File.new(cur_folder+\"/ast_" + n + "\",\"w\")\n") r_ast.write("ast_" + n + ".write(ast)\n") r_ast.write("ast_" + n + ".close") r_ast.close() print(os.getcwd() + "/" + n + "/parser_" + n + ".rb") success = execute_rb(os.getcwd() + "/" + n + "/parser_" + n + ".rb") if (success): print("Parser created successfully for " + n + " and file parsed !") s = s + 1 else: print("Problem with creation of parser") r = ruby_ast_translator.RubyASTTranslator() if s == len(name): for n in name: print("Beginning translation of " + n) try: r.Test(n) except: print("Problem with translation !") for n in name:
def evolution_loop(args): '''Input starting plan, schedule with tj, perturb, and loop.''' best = args.initial_fitness f0 = args.initial_fitness t0 = time.time() # Let's keep track of the best Tji file so we can leave it in the upper # directory as an artifact bestTjiFile = '' [handle, ext] = args.task_file.split('.') if ext in ['xls', 'xlsx', 'xlsm']: tasks2 = extract_excel(args.task_file, 'Summary') #TODO elif ext == 'csv': tasks2 = extract_csv(args.task_file) else: print('Error: unsupported file type: ', ext) logging.error('Error: unsupported file type: {}'.format(ext)) sys.exit(1) # pdb.set_trace() if not fully_allocated(tasks2): tasks1 = allocate_resources(tasks2) else: tasks1 = tasks2 tasks0 = tasks1 #TODO: why is this necessary and why discovered now? for i in range(0, args.iterations): #Randomize the allocations save_tasks(tasks1, args.name_root, args.new_dir, i) generate_tji(tasks1, args.name_root) #Run taskjuggler success = execute_rb( 'C:\\Ruby22-x64\\lib\\ruby\\gems\\2.2.0\\gems\\taskjuggler-3.6.0\\lib\\tj3.rb --silent {}_min.tjp' .format(args.name_root)) #success = execute_rb('C:\\Ruby24-x64\\lib\\ruby\\gems\\2.4.0\\gems\\taskjuggler-3.6.0\\lib\\tj3.rb --silent {}_min.tjp'.format(args.name_root)) #Determine result # We'll want to keep track of the Tji filename for later movedFileName = '{}\\{}_{}.tji'.format(args.new_dir, args.name_root, str(i).zfill(4)) # shutil.move('{}.tji'.format(args.name_root), # '{}\\{}_{}.tji'.format(args.new_dir, # args.name_root, str(i).zfill(4))) shutil.move('{}.tji'.format(args.name_root), movedFileName) if success: f1 = fitness_result() shutil.move( 'HLGantt.csv', '{}\\HLGantt{}.csv'.format(args.new_dir, str(i).zfill(4))) else: f1 = f0 logging.error('taskjuggler failed: iteration {}'.format(i)) t1 = time.time() res = result_txt(f0, f1, success) outstr = '{} {:7.2f}s {} {} {}'.format(i, t1 - t0, f0, f1, res) print(outstr) logging.info(outstr) if res == 'Better': best = f1 bestTjiFile = movedFileName tasks0 = tasks1 f0 = f1 tasks1 = perturb_allocations(tasks1, args.perturbation_rate) else: tasks1 = perturb_allocations(tasks0, args.perturbation_rate) t0 = t1 print(best) shutil.copy(bestTjiFile, '{}.tji'.format(args.name_root)) logging.info(best)
def test_execute_rb_fail(self): self.assertFalse(execute_rb(self.ruby_fail_path))
def test_execute_rb_success(self): self.assertTrue(execute_rb(self.ruby_success_path))
file.write(str_dictionary["vpc_id"]) file.write("\n") file.write(str_dictionary["pubsubnet1_a"]) file.write("\n") file.write(str_dictionary["pubsubnet1_b"]) file.write("\n") file.write(str_dictionary["prisubnet1_a"]) file.write("\n") file.write(str_dictionary["prisubnet1_b"]) file.write("\n") file.close() ############ Create EKS cluster ################################################## clustercount = 1 try: if clustercount == 0: success = execute_rb('read_config.rb') time.sleep(5) if success: print("managedcluster.yaml is generated") subprocess.call( shlex.split( '/Users/venkataponnapalli/PycharmProjects/pythonProject/docker-images-for-k8s-eks-deployments/managedcluster.sh' )) time.sleep(1800) print(" Cluster is created") else: sys.exit() clustercount += 1 except ClientError as e: logging.error(e) print("EKS Cluster created")
self.logger.info("number of user stories : %s", userstorysize) if userstorysize == 0 : self.logger.info("no User story provided by user in this event ") else: for word in userstory: self.logger.info("Running for :%s" , word[1:]) argument = word[1:] + ' ' + filename success = execute_rb('01-connect-to-rally.rb', argument) self.logger.info("Framework ran for user stories %s" , success) if defectsize == 0 : self.logger.info("no defects provided by user in this event ") else: for word in defects: self.logger.info("Running for :%s" , word[1:]) argument = word[1:] + ' ' + filename success = execute_rb('01-connect-to-rally.rb', argument) self.logger.info("Framework ran for defects %s" , success)
def generate_cmap_file(folder_name=""): for font_name in glob.glob(folder_name + "/*.ttf"): execute_rb('cmap.rb', arguments=font_name) for font_name in glob.glob(folder_name + "/*.TTF"): execute_rb('cmap.rb', arguments=font_name)
destinationDir='C:\Users\Prasanth\Desktop\comb\Captcha-Cracker-master\\thecracked\\' if not os.path.exists(destinationDir): os.makedirs(destinationDir) #shutil.move("crop"+str(count)+".gif", destinationDir) count=count+1 return driver = webdriver.Firefox() driver.get("https://www.onlinesbi.com/prelogin/suvidharemittanceform.htm") for tab in range(1,2): elems=driver.find_elements_by_tag_name("img"); values=['captchaimage','captcha','cap'] ids=['id','alt','src','class'] find() driver.refresh() time.sleep(2) execfile("exp2.py") execfile("floodfill.py") os.chdir('C:\\Users\\Prasanth\\Desktop\\comb\\Captcha-Cracker-master\\thecracked\\SBIcracked') success = execute_rb('neural.rb') box=driver.find_element_by_id('captchaValueref') f = open('captext.txt', 'r') textstring=f.read() box.send_keys(textstring) #driver.close()