Best Python code snippet using Airtest
Body.js
Source:Body.js
1import React from 'react'2import {Switch, Route} from 'react-router-dom'3import Login from './authentification/login'4import Home from './home/home';5import Register from './authentification/register';6import ActivationEmail from './authentification/ActivationEmail';7import {useSelector} from 'react-redux'8import NotFound from '../util/NotFound/NotFound'9import ForgotPass from './authentification/ForgetPassword';10import ResetPass from '../body/authentification/ResetPassword'11import Profile from './profile/Profile'12import Courses from './courses/GererCours/courses';13import Admin from '../dashboard/index'14import DetailAddCourse from './courses/GererCours/DetailAddCourse'15import Gerercoursemodifsupp from './courses/GererCours/gerecoursemodifsupp'16import MyCourses from './courses/GererCours/MyCourses'17import GererCourses from './courses/GererCourses'18import GraduationEtudiant from './courses/GraduationEtudiant'19import QuizResults from './courses/QuizResults'20import AddCourse from './courses/GererCours/addcourse'21import Modifiersupcourse from './courses/GererCours/modifier_sup_course'22import Modifiersupcoursform from './courses/GererCours/modifierFormCoursDetails'23import Modifiersupintro from './courses/GererCours/modifierIntro'24import Modifiersupchapitres from './courses/GererCours/modifierChapitres'25import Modifiersupconclusion from './courses/GererCours/modifierConclusion'26import CourseByCategory from './courses/GererCours/CourseByCategory'27import qst from './courses/components/UserForm'28import DetailCourse from './courses/GererCours/DetailCourse';29import PhaseADetail from './courses/GererCours/PhaseADetail';30import PhaseBDetail from './courses/GererCours/PhaseBDetail';31import PhaseCDetail from './courses/GererCours/PhaseCDetail';32import PhaseDDetail from './courses/GererCours/PhaseDDetail';33import PhaseEDetail from './courses/GererCours/PhaseEDetail';34import PhaseFDetail from './courses/GererCours/PhaseFDetail';35import PhaseGDetail from './courses/GererCours/PhaseGDetail';36import PhaseHDetail from './courses/GererCours/PhaseHDetail';37import QuizDetail from './courses/GererCours/QuizDetail';38import Chapitre0Detail from './courses/GererCours/Chapitre0Detail';39import Chapitre1Detail from './courses/GererCours/Chapitre1Detail';40import Chapitre2Detail from './courses/GererCours/Chapitre2Detail';41import Chapitre3Detail from './courses/GererCours/Chapitre3Detail';42import Chapitre4Detail from './courses/GererCours/Chapitre4Detail';43import AllCourses from './courses/GererCours/AllCourses';44import Contact from './contact/contact'45import AboutUS from './AboutUS/AboutUs'46import Index from '../dashboard/index'47import Header from './header footer/header'48import Blog from './blog/home'49import FreeCourses from './courses/GererCours/FreeCourses'50import PayedCourses from './courses/GererCours/PayedCourses'51import Certification from './Certification/Certification'52import Panier from './panier/panier'53import Categorie from './categorie/categorie'54import Progress from './Progress/Progress';55function Body() {56 const auth = useSelector(state => state.auth)57 const {isLogged,isAdmin} = auth58 return (59 <>60 <Header/>61 <section>62 <Switch>63 <Route path="/" component={Home} exact />64 <Route path="/contact" component={Contact} exact />65 <Route path="/AboutUS" component={AboutUS} exact />66 67 <Route path="/login" component={isLogged ? NotFound : Login} exact />68 <Route path="/register" component={isLogged ? NotFound : Register} exact />69 <Route path="/user/activate/:activation_token" component={ActivationEmail} exact />70 <Route path="/forgot_password" component={isLogged ? NotFound : ForgotPass} exact />71 <Route path="/user/reset/:token" component={isLogged ? NotFound : ResetPass} exact />72 <Route path="/profile" component={isLogged ? Profile : NotFound} exact />73 74 <Route path="/MyCourses" component={isLogged ? MyCourses : NotFound} exact />75 <Route path="/DetailAddCourse" component={isLogged ? DetailAddCourse : NotFound} exact />76 77 <Route path="/QuizResults" component={isLogged ? QuizResults : NotFound} exact />78 <Route path="/GraduationEtudiant" component={isLogged ? GraduationEtudiant : NotFound} exact />79 <Route path="/GererCourses" component={isLogged ? GererCourses : NotFound} exact />80 <Route path="/Gerercoursemodifsupp" component={isLogged ? Gerercoursemodifsupp : NotFound} exact />81 <Route path="/addcourse/:token" component={isLogged ? AddCourse : NotFound} exact />82 83 <Route path="/modifiersupcourse/:id" component={isLogged ? Modifiersupcourse : NotFound} exact />84 <Route path="/modifiersupcoursform/:id" component={isLogged ? Modifiersupcoursform : NotFound} exact />85 <Route path="/modifiersupintro/:id" component={isLogged ? Modifiersupintro : NotFound} exact />86 <Route path="/modifiersupchapitres/:id" component={isLogged ? Modifiersupchapitres : NotFound} exact />87 <Route path="/modifiersupconclusion/:id" component={isLogged ? Modifiersupconclusion : NotFound} exact />88 <Route path="/DetailCourse/:id" component={isLogged ? DetailCourse : NotFound} exact />89 <Route path="/PhaseADetail/:id" component={isLogged ? PhaseADetail : NotFound} exact />90 <Route path="/PhaseBDetail/:id" component={isLogged ? PhaseBDetail : NotFound} exact />91 <Route path="/PhaseCDetail/:id" component={isLogged ? PhaseCDetail : NotFound} exact />92 <Route path="/PhaseDDetail/:id" component={isLogged ? PhaseDDetail : NotFound} exact />93 <Route path="/PhaseEDetail/:id" component={isLogged ? PhaseEDetail : NotFound} exact />94 <Route path="/PhaseFDetail/:id" component={isLogged ? PhaseFDetail : NotFound} exact />95 <Route path="/PhaseGDetail/:id" component={isLogged ? PhaseGDetail : NotFound} exact />96 <Route path="/PhaseHDetail/:id" component={isLogged ? PhaseHDetail : NotFound} exact />97 <Route path="/QuizDetail/:id" component={isLogged ? QuizDetail : NotFound} exact />98 <Route path="/Chapitre0Detail/:id" component={isLogged ? Chapitre0Detail : NotFound} exact />99 <Route path="/Chapitre1Detail/:id" component={isLogged ? Chapitre1Detail : NotFound} exact />100 <Route path="/Chapitre2Detail/:id" component={isLogged ? Chapitre2Detail : NotFound} exact />101 <Route path="/Chapitre3Detail/:id" component={isLogged ? Chapitre3Detail : NotFound} exact />102 <Route path="/Chapitre4Detail/:id" component={isLogged ? Chapitre4Detail : NotFound} exact />103 <Route path="/CourseByCategory/:categorie" component={isLogged ? CourseByCategory : NotFound} exact />104 <Route path="/courses" component={isLogged ? GererCourses : NotFound} component={Courses} exact />105 <Route path="/allcourses" component={AllCourses} exact /> 106 <Route path="/FreeCourses"component={isLogged ? GererCourses : NotFound} component={FreeCourses} exact /> 107 <Route path="/PayedCourses"component={isLogged ? GererCourses : NotFound} component={PayedCourses} exact /> 108 <Route path="/qst" component={isLogged ? qst : NotFound} exact />109 <Route path="/admin" component={Admin} exact />110 <Route path="/blog" component={isLogged? Blog: NotFound} exact/>111 112 <Route path="/index" component={isAdmin? Index: NotFound} exact/>113 <Route path="/admin" component={Admin} exact />114 <Route path="/certification" component={Certification} exact />115 <Route path="/panier" component={isLogged ? Panier : NotFound} exact />116 <Route path="/categorie" component={isLogged ? Categorie : NotFound} exact />117 <Route path="/progress" component={isLogged ? Progress : NotFound} exact />118 119 </Switch>120 </section>121 </>122 )123}124export default Body...
ulang.py
Source:ulang.py
1import time2import sys3import random4import os5os.system('clear')6def main(s):7 for c in s + '\n':8 sys.stdout.write(c)9 sys.stdout.flush()10 time.sleep(random.random() * 0.1)11nam = raw_input('Input Wordlist [root.txt] : ')12ul = raw_input('Input Wifi Name : ')13main('Scaning Wifi...')14time.sleep(1)15main('Information Wifirels')16print "=> Wifi Name : ", ul17time.sleep(1)18main('=> Status : Not Vulnrability')19time.sleep(1)20main('=> Ip : 182.97.42.74')21time.sleep(1)22main('=> Type : WPA2 PSK')23time.sleep(1)24main('Crack Password Wifi => [NotFound]')25main('Crack Password Wifi => [NotFound]')26main('Crack Password Wifi => [NotFound]')27main('Crack Password Wifi => [NotFound]')28main('Crack Password Wifi => [NotFound]')29main('Crack Password Wifi => [NotFound]')30main('Crack Password Wifi => [NotFound]')31main('Crack Password Wifi => [NotFound]')32main('Crack Password Wifi => [NotFound]')33main('Crack Password Wifi => [NotFound]')34main('Crack Password Wifi => [NotFound]')35main('Crack Password Wifi => [NotFound]')36main('Crack Password Wifi => [NotFound]')37main('Crack Password Wifi => [NotFound]')38main('Crack Password Wifi => [NotFound]')39main('Crack Password Wifi => [NotFound]')40main('Crack Password Wifi => [NotFound]')41main('Crack Password Wifi => [NotFound]')42main('Crack Password Wifi => [NotFound]')43main('Crack Password Wifi => [NotFound]')44main('Crack Password Wifi => [NotFound]')45main('Crack Password Wifi => [NotFound]')46main('Crack Password Wifi => [NotFound]')47main('Crack Password Wifi => [NotFound]')48main('Crack Password Wifi => [NotFound]')49main('Crack Password Wifi => [NotFound]')50main('Crack Password Wifi => [NotFound]')51main('Crack Password Wifi => [NotFound]')52main('Crack Password Wifi => [NotFound]')53main('Crack Password Wifi => [NotFound]')54main('Failed To Crack System Wifi NotVulnrabylity')55"""56 }57 echo "\e[96m[*] \e[0mLooping : ";58 $loop = trim(fgets(STDIN));59 if (is_numeric($loop) !==true) {60 throw new Exception("\e[91m[!]\e[0m Looping woy/limit, begokk!!\n");61 exit(0);62 }63 $spam->MyPoin(64 $nomor, $loop65 );66 } else if ($choice == 2) {67 echo "\e[96m[*] \e[0mNomor (62) : ";68 $nomor = trim(fgets(STDIN));69 if (substr($nomor, 0, 2) !== "62") {70 throw new Exception("\e[91m[!]\e[0m Nomor awalan harus 62 gan!!\n");71 exit(0);72 }73 echo "\e[96m[*] \e[0mLooping : ";74 $loop = trim(fgets(STDIN));75 if (is_numeric($loop) !==true) {76 throw new Exception("\e[91m[!]\e[0m Looping woy/limit, begokk!!\n");77 exit(0);78 }79 $spam->AltBaljai(80 $nomor, $loop81 );82 } else if ($choice == 3) {83 echo "\e[96m[*] \e[0mNomor (62) : ";84 $nomor = trim(fgets(STDIN));85 if (substr($nomor, 0, 2) !== "62") {86 throw new Exception("\e[91m[!]\e[0m Nomor awalan harus 62 gan!!\n");87 exit(0);88 }89 echo "\e[96m[*] \e[0mPesan (min 10 karakter) : ";90 $pesan = trim(fgets(STDIN));91 if (strlen($pesan) < 10) {92 throw new Exception("\e[91m[!]\e[0m Gue bilang minimal 10 karakter, babi bandel amat lu jadi org!!\n");93 exit(0);94 }95 $response = $spam->SmsPayuTerusBis(96 $nomor, $pesan97 );98 if (strpos($response, "SMS Gratis Telah Dikirim")) {99 echo "\e[92m[*] \e[0mTerkirim broo [ $pesan ]\n";100 } else if (strpos($response, "MAAF....!")) {101 echo "\e[91m[*] \e[0mTunggu 15 menit sebelum mengirim Pesan yang sama!!\n";102 } else {103 echo "\e[91m[*] \e[0mGagal silahkan coba lagi!!\n";104 }105 } else if ($choice == 4) {106 echo "\e[96m[*] \e[0mNomor (62) : ";107 $nomor = trim(fgets(STDIN));108 if (substr($nomor, 0, 2) !== "62") {109 throw new Exception("\e[91m[!]\e[0m Nomor awalan harus 62 gan!!\n");110 exit(0);111 }112 echo "\e[96m[*] \e[0mLooping : ";113 $loop = trim(fgets(STDIN));114 if (is_numeric($loop) !==true) {115 throw new Exception("\e[91m[!]\e[0m Looping woy/limit, begokk!!\n");116 exit(0);117 }...
translate.py
Source:translate.py
1#!/usr/bin/env python32"""3Translation tool for the LilyPond LibreOffice extension4Usage: translation/translate.py <language>5Example: translation/translate.py de6"""7import glob8import re9import shutil10import sys11import yaml12def translate(language):13 """translate the current extension code to the given language"""14 # create a copy of the extension folder for the given language15 langdir = 'translation/extension-%s' % language16 shutil.rmtree(langdir, ignore_errors=True)17 shutil.copytree('extension', langdir)18 # replace english strings with translated strings in this copy19 translatedescription('%s/pkg-desc/pkg-description.txt' % langdir, language)20 notfound = None21 for filename in glob.glob('%s/OOoLilyPond/*.x??' % langdir):22 notfound = translatefile(filename, language, notfound)23 # show replacement strings which were not found24 notfound.remove('description')25 if notfound:26 print("Warning: These strings were not found:")27 for line in notfound:28 print(" %r" % line)29def translatefile(filename, language, notfound):30 """translate a file using the dictionary in <language>.yaml"""31 patterns = ['dlg:value="%s"', 'dlg:value="%s:"', 'dlg:help-text="%s"',32 '"%s"', '"%s "', '" %s"', '" %s "',33 '"%s:"','"%s: "']34 with open('translation/%s.yaml' % language) as f:35 dictionary = yaml.load(f)36 if notfound is None:37 notfound = list(dictionary.keys())38 with open(filename) as f:39 text = f.read()40 for original in reversed(sorted(dictionary)):41 translation = dictionary[original]42 if not isinstance(original, str):43 print("Warning: bad type %r for entry: %s" % (type(original), original))44 for pattern in patterns:45 if (pattern % original) in text and original in notfound:46 notfound.remove(original)47 text = text.replace(pattern % original, pattern % translation)48 with open(filename, 'w') as f:49 f.write(text)50 return notfound51def translatedescription(filename, language):52 """Translate description file"""53 with open('translation/%s.yaml' % language) as f:54 dictionary = yaml.load(f)55 with open(filename, 'w') as f:56 f.write(dictionary['description'])...
notfound.py
Source:notfound.py
1from error import processException2from log import Logger3from openpyxl import Workbook,load_workbook4class NotFound:5 def __init__(self, path = ""):6 Logger.addLog("CREAT NotFound: " + path)7 if path == "":8 self.notfoundBook = Workbook()9 self.path = "notfound.xlsx"10 else:11 try:12 self.notfoundBook = load_workbook(path)13 self.path = path14 except:15 processException()16 def getNotfoundTable(self):17 Logger.addLog("GET notfoundTable!!")18 try:19 if len(self.notfoundBook.sheetnames) == 0:20 notfoundTable = self.notfoundBook.active21 self.__initNotFoundTable(notfoundTable)22 else:23 notfoundTable = self.notfoundBook[self.notfoundBook.sheetnames[0]]24 25 return notfoundTable26 except:27 processException()28 def save(self, notfoundOutPath = ""):29 Logger.addPrefabLog(Logger.LOG_TYPE_SAVE, notfoundOutPath)30 if notfoundOutPath == "":31 self.notfoundBook.save(self.path)32 else:33 self.notfoundBook.save(notfoundOutPath)34 def __initNotFoundTable(self, notfoundTable):35 notfoundTable["A1"] = "ç±»å"36 notfoundTable["B1"] = "æ¸ é"37 notfoundTable["C1"] = "è´¦å·"38 notfoundTable["D1"] = "å§å"39 notfoundTable["E1"] = "å§å/ä»"40 notfoundTable["F1"] = "éå®é¢"41 notfoundTable["G1"] = "å©æ¶¦ç"42 notfoundTable["H1"] = "é款éé¢"...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!