Best Python code snippet using fMBT_python
imgen.py
Source:imgen.py
...44 for filename in os.listdir(Path(fruit + "\\" + fruit.split('\\')[1] + "_" + prop)):45 temp = filename.split("#")[1].split(".")[0]46 tempRarityArray.append(temp)47 return tempRarityArray48def startCreating():49 counter = 050 fruitCounter = []51 fruitStopper = []52 for i in range(numFruits):53 fruitCounter.append(0)54 fruitStopper.append(numEachFruit)55 while numpy.array_equal(fruitCounter, fruitStopper) == False:56 randNum = randrange(numFruits)57 if(fruitCounter[randNum] != numEachFruit):58 fruitCounter[randNum] += 159 counter += 160 createDna('assets\\' + os.listdir(Path('./assets'))[randNum], randNum) 61startCreating()62def cleanImageFolder():63 for f in os.listdir(Path('./images')):64 if not f.endswith(".png"):65 continue66 os.remove(os.path.join(Path('./images'), f))67def cleanMetadataFolder():68 for f in os.listdir(Path('./metadata')):69 if not f.endswith(".json"):70 continue71 os.remove(os.path.join(Path('./metadata'), f))72def createMetadata(dna, edition):73 tempDic = []74 dic = {75 "name": ("Fruity Booty #" + str(edition)),...
bundletool.py
Source:bundletool.py
...7ALIGNMENT = 'W'8PADDING = 109handler = FileHandler()10bundletool = BundletoolApi()11def startCreating(isUniversal=False):12 if (len(handler.CHOOSEN_FILE)):13 thread = threading.Thread(target=lambda: bundletool.createAPKs(14 handler.CHOOSEN_FILE, buttonAPKs, buttonUnviersalAPK, isUniversal))15 thread.start()16 buttonAPKs.configure(state='disabled')17 buttonUnviersalAPK.configure(state='disabled')18 else:19 print('[bundletool-ui] No App Bundle Selected')20def startInstalling():21 if (len(handler.CHOOSEN_FILE)):22 print('[bundletool-ui] Installing APKs...')23 deviceId = ADBdeviceId.get() or ''24 bundletool.installAPKs(handler.CHOOSEN_FILE, deviceId)25 else:26 print('[bundletool-ui] No App Bundle Selected')27win = Tk()28win.title('bundletool-ui')29win.resizable(True, False)30Button(win, font=FONT, text='Choose an App Bundle (.aab)',31 relief='groove', command=lambda: handler.chooseFile(fileLabel=fileLabel)).grid(row=0, column=0, sticky=ALIGNMENT)32fileLabel = Label(33 win, font=FONT, text=f'{handler.CHOOSEN_FILE if len(handler.CHOOSEN_FILE) > 0 else handler.NO_FILE}')34fileLabel.grid(row=1, column=0, sticky=ALIGNMENT, pady=PADDING)35buttonAPKs = Button(win, font=FONT, text='Create APKs', width=35,36 relief='groove', command=lambda: startCreating(False))37buttonAPKs.grid(row=2, column=0, sticky=ALIGNMENT)38buttonUnviersalAPK = Button(win, font=FONT, text='Create Universal APK',39 width=35, relief='groove', command=lambda: startCreating(True))40buttonUnviersalAPK.grid(row=3, column=0, sticky=ALIGNMENT)41ADBdeviceId = Entry(win, font=FONT, relief="groove", borderwidth=2, width=37)42ADBdeviceId.grid(row=4, column=0, sticky=ALIGNMENT, pady=PADDING)43ADBdeviceId.insert(0, 'adb device id')44installAPKs = Button(win, font=FONT, text='Install APKs', width=35,45 relief='groove', command=startInstalling)46installAPKs.grid(row=5, column=0, sticky=ALIGNMENT)...
tempCodeRunnerFile.py
Source:tempCodeRunnerFile.py
1buttonAPKs = Button(win, font=FONT, text='Create APKs', width=35,2 relief='groove', command=lambda: startCreating(False))3buttonAPKs.grid(row=2, column=0, sticky=ALIGNMENT)4buttonUnviersalAPK = Button(win, font=FONT, text='Create Universal APK',5 width=35, relief='groove', command=lambda: startCreating(True))6buttonUnviersalAPK.grid(row=3, column=0, sticky=ALIGNMENT)7ADBdeviceId = Entry(win, font=FONT, relief="groove", borderwidth=2, width=37)8ADBdeviceId.grid(row=4, column=0, sticky=ALIGNMENT, pady=PADDING)9ADBdeviceId.insert(0, 'adb device id')10installAPKs = Button(win, font=FONT, text='Install APKs', width=35,11 relief='groove', command=startInstalling)12installAPKs.grid(row=5, column=0, sticky=ALIGNMENT)...
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!!