Best Python code snippet using SeleniumBase
plot_model_windows.py
Source: plot_model_windows.py
1import matplotlib.pyplot as plt2import numpy as np3aop = 2.1514bopout = 0.1725shapeop = 0.4186#P01arr7a01arr = -13.888b01inarr = 0.3129b01outarr = 0.043310b01absprevarr = 1.86211b01rnarr = -0.4512#P01int13a01int = -12.2314b01inint = 0.28115b01outint = 0.027116b01presint = -0.00087817b01rnint = -0.33618#P01dep19a01dep = -8.7520b01outdep = 0.137121b01absdep = 0.8422b01gddep = 0.8323#P10dep24a10dep = -8.5425b10indep = 0.21326b10outdep = -0.091127b10absdep = 1.61428b10gddep = -0.92329def P_ouvrir_arr(indoorTemperature, outdoorTemperature, previousDuration, rain): 30 m=np.exp(a01arr + b01inarr * indoorTemperature +b01outarr * outdoorTemperature +b01rnarr * rain +b01absprevarr *previousDuration)31 return m/(1+m)32def P_ouvrir_inter(indoorTemperature, outdoorTemperature, currentDuration, rain): 33 m=np.exp(a01int + b01inint * indoorTemperature + b01outint * outdoorTemperature +b01presint * currentDuration +b01rnint * rain)34 return m/(1+m)35def P_fermer_depart(indoorTemperature, dailyMeanTemperature, durationLongerThanEightHours, groundFloor): 36 m=np.exp(a10dep + b10indep * indoorTemperature +b10outdep * dailyMeanTemperature +b10absdep * durationLongerThanEightHours +b10gddep * groundFloor)37 return m/(1+m)38def P_ouvrir_depart(dailyMeanTemperature, durationLongerThanEightHours, groundFloor): 39 m=np.exp(a01dep + b01outdep * dailyMeanTemperature +b01absdep * durationLongerThanEightHours +b01gddep * groundFloor)40 return m/(1+m)41def duree(u,Text):42 a=np.exp(2.151+0.172*Text)43 k=0.41844 return a*(-np.log10(u))**(1/k)45Tin = np.arange(10,40,1) # start,stop,step46Text_moy = np.arange(0,40,1)47#P_ouvrir_arrivee48'''y1 = [P_ouvrir_arr(i, 0, 1,0) for i in Tin]49y2 = [P_ouvrir_arr(i, 0, 0,0) for i in Tin]50y7 = [P_ouvrir_arr(i, 0, 0,1) for i in Tin]51y8 = [P_ouvrir_arr(i, 20, 0,1) for i in Tin]52y3 = [P_ouvrir_arr(i, 20, 1,0) for i in Tin]53y4 = [P_ouvrir_arr(i, 20, 0,0) for i in Tin]54y5 = [P_ouvrir_arr(i, 40, 1,0) for i in Tin]55y6 = [P_ouvrir_arr(i, 40, 0,0) for i in Tin]56plt.figure()57plt.plot(Tin, y1, label="Text=0°C, ap_abs=1 et pluie=0", linestyle="-", c="k")58plt.plot(Tin, y2, label="Text=0°C, ap_abs=0 et pluie=0", linestyle="--", c="k")59plt.plot(Tin, y7, label="Text=0°C, ap_abs=0 et pluie=1", linestyle=":", c="k")60plt.plot(Tin, y3, label="Text=20°C, ap_abs=1 et pluie=0", linestyle="-", c="r")61plt.plot(Tin, y4, label="Text=20°C, ap_abs=0 et pluie=0", linestyle="--", c="r")62plt.plot(Tin, y8, label="Text=20°C, ap_abs=0 et pluie=1", linestyle=":", c="r")63plt.plot(Tin, y5, label="Text=40°C, ap_abs=1 et pluie=0", linestyle="-", c="b")64plt.plot(Tin, y6, label="Text=40°C, ap_abs=0 et pluie=0", linestyle="--", c="b")65#plt.ylim([0,0.04])66plt.xlabel("Température intérieure [°C]")67plt.ylabel("Probabilité d'ouvrir la fenêtre en arrivée")68plt.legend()69plt.savefig("./graphes/P_ouvrir_arrive.png")70plt.show()'''71#P_ouvrir_inter72'''y1 = [P_ouvrir_inter(i, 0, 1800,0) for i in Tin]73y2 = [P_ouvrir_inter(i, 20, 1800,0) for i in Tin]74y3 = [P_ouvrir_inter(i, 40, 1800,0) for i in Tin]75y4 = [P_ouvrir_inter(i, 0, 3600,0) for i in Tin]76y5 = [P_ouvrir_inter(i, 20, 3600,0) for i in Tin]77y6 = [P_ouvrir_inter(i, 40, 3600,0) for i in Tin]78plt.figure()79plt.plot(Tin, y1, label="Text=0°C et Dpres=0,5h", linestyle="-", c="k")80plt.plot(Tin, y2, label="Text=20°C et Dpres=0,5h", linestyle="--", c="k")81plt.plot(Tin, y3, label="Text=40°C et Dpres=0,5h", linestyle="-.", c="k")82plt.plot(Tin, y4, label="Text=0°C et Dpres=1h", linestyle="-", c="r")83plt.plot(Tin, y5, label="Text=20°C et Dpres=1h", linestyle="--", c="r")84plt.plot(Tin, y6, label="Text=40°C et Dpres=1h", linestyle="-.", c="r")85#plt.ylim([0,0.04])86plt.xlabel("Température intérieure [°C]")87plt.ylabel("Probabilité d'ouvrir la fenêtre en période intermédiaire")88plt.legend()89plt.savefig("./graphes/P_ouvrir_inter.png")90#plt.show()91#P_ouvrir_depart92y1 = [P_ouvrir_depart(i, 1,0) for i in Text_moy]93y2 = [P_ouvrir_depart(i, 1,1) for i in Text_moy]94y3 = [P_ouvrir_depart(i, 0,0) for i in Text_moy]95y4 = [P_ouvrir_depart(i, 0,1) for i in Text_moy]96plt.figure()97plt.plot(Text_moy, y1, label="av_abs=1 et RDC=0", linestyle="-", c="k")98plt.plot(Text_moy, y2, label="av_abs=1 et RDC=1", linestyle="--", c="k")99plt.plot(Text_moy, y3, label="av_abs=0 et RDC=0", linestyle="-", c="r")100plt.plot(Text_moy, y4, label="av_abs=0 et RDC=1", linestyle="--", c="r")101#plt.ylim([0,0.04])102plt.xlabel("Température extérieure glissante sur une journée [°C]")103plt.ylabel("Probabilité d'ouvrir la fenêtre en départ")104plt.legend()105plt.savefig("./graphes/P_ouvrir_depart.png")106plt.show()'''107#P_fermer_depart108'''y1 = [P_fermer_depart(10,i, 0,1) for i in Text_moy]109y6 = [P_fermer_depart(10,i, 0,0) for i in Text_moy]110y8 = [P_fermer_depart(10,i, 1,1) for i in Text_moy]111y2 = [P_fermer_depart(20,i, 0,1) for i in Text_moy]112y3 = [P_fermer_depart(30,i, 0,1) for i in Text_moy]113y7 = [P_fermer_depart(30,i, 0,0) for i in Text_moy]114y9 = [P_fermer_depart(30,i, 1,1) for i in Text_moy]115y4 = [P_fermer_depart(20,i, 0,0) for i in Text_moy]116y5 = [P_fermer_depart(20,i, 1,1) for i in Text_moy]117plt.figure()118plt.plot(Text_moy, y1, label="Tint=10°C, av_abs=0 et RDC=1", linestyle="-", c="k")119plt.plot(Text_moy, y6, label="Tint=10°C, av_abs=0 et RDC=0", linestyle="-", c="r")120plt.plot(Text_moy, y8, label="Tint=10°C, av_abs=1 et RDC=1", linestyle="-", c="b")121plt.plot(Text_moy, y2, label="Tint=20°C, av_abs=0 et RDC=1", linestyle="--", c="k")122plt.plot(Text_moy, y4, label="Tint=20°C, av_abs=0 et RDC=0", linestyle="--", c="r")123plt.plot(Text_moy, y5, label="Tint=20°C, av_abs=1 et RDC=1", linestyle="--", c="b")124plt.plot(Text_moy, y3, label="Tint=30°C, av_abs=0 et RDC=1", linestyle="-.", c="k")125plt.plot(Text_moy, y7, label="Tint=30°C, av_abs=0 et RDC=0", linestyle="-.", c="r")126plt.plot(Text_moy, y9, label="Tint=30°C, av_abs=1 et RDC=1", linestyle="-.", c="b")127#plt.ylim([0,0.04])128plt.xlabel("Température extérieure glissante sur une journée [°C]")129plt.ylabel("Probabilité de fermer la fenêtre en départ")130plt.legend()131plt.savefig("./graphes/P_fermer_depart.png")132plt.show()'''133#duree d'ouverture134U=np.arange(0.01,1,0.0001)135y5 = [duree(i,5) for i in U]136y30 = [duree(i,30) for i in U]137plt.figure()138plt.plot(U, y5, label="Text=5°C", linestyle="-", c="k")139plt.plot(U, y30, label="Text=30°C", linestyle="--", c="k")140plt.xlabel("nombre aléatoire")141plt.ylabel("durée d'ouverture en minutes")142plt.ylim([0,1000])143plt.legend()144plt.savefig("./graphes/duree_ouverture.png")...
main.pyw
Source: main.pyw
1from tkinter import *2import tkinter.filedialog3from tkinter.messagebox import *4from crypt_decrypt_fichier import *5def Ouverture_fichier_cle():6 try:7 filename = tkinter.filedialog.askopenfilename(title="Ouvrir fichier clé",filetypes=[('text files','.txt'),('all files','.*')])8 path_key.set(filename)9 with open(filename,'r',encoding = 'utf-8') as f:10 val_key.set(f.read())11 except FileNotFoundError:12 pass13def Ouverture_fichier_plaintext():14 filename = tkinter.filedialog.askopenfilename(title="Ouvrir fichier plaintext",filetypes=[('all files','.*')])15 path_plaintext.set(filename)16 17def Chiffrement_plaintext():18 filetosave=tkinter.filedialog.asksaveasfile(title="Enregistrer fichier",filetypes=[('All Files', '*.*')])19 try:20 chiffrement = ecriture_ciphertext(path_plaintext.get(),path_key.get(),filetosave.name)21 if chiffrement == -1:22 showwarning("Erreur","La taille de la clé n'est pas bonne")23 except FileNotFoundError:24 showwarning("Erreur","Il semble qu'il manque un fichier")25def Ouvrir_fichier_cipher():26 filename = tkinter.filedialog.askopenfilename(title="Ouvrir fichier cipher",filetypes=[('all files','.*')])27 path_ciphertext.set(filename)28 29def dechiffrement_plaintext():30 filetosave=tkinter.filedialog.asksaveasfile(title="Enregistrer fichier",filetypes=[('All Files', '*.*')])31 try:32 dechiffrement = lecture_plaintext(path_ciphertext.get(),filetosave.name,path_key.get())33 if dechiffrement == -1:34 showwarning("Erreur","La taille de la clé n'est pas bonne")35 except FileNotFoundError:36 showwarning("Erreur","Il semble qu'il manque un fichier")37 38 39# Création de la fenêtre principale40fenetre = Tk()41fenetre.title("Chiffrement et déchiffrement")42#Init variables43fichier_binaire = IntVar()44fichier_binaire2 = IntVar()45path_plaintext= StringVar()46path_ciphertext= StringVar()47# création d'un widget Frame pour cle dans la fenêtre principale 48Frame1 = Frame(fenetre,width=500, height=500, borderwidth=2,relief=GROOVE)49Frame1.pack(side=TOP,padx=20,pady=20)50# Création d'un widget Label (texte 'clé de chiffrement')51Label_cle = Label(Frame1, text = 'Clé de chiffrement')52Label_cle.grid(columnspan = 4)53# Création d'un widget Entry (chemin de la clé)54path_key= StringVar()55Champ = Entry(Frame1,textvariable= path_key,width = 50)56Champ.focus_set()57Champ.grid(row=1,column=0,padx =0, pady =10)58# Création d'un widget Button (bouton Ouvrir fichier cle.txt)59Ouvrir_cle = Button(Frame1, text ='Ouvrir', command = Ouverture_fichier_cle)60Ouvrir_cle.grid(row=1,column=1,padx =0, pady =10)61# Création d'un widget Label (texte 'clé de chiffrement')62Label_cle = Label(Frame1, text = 'Valeur de la clé (hexadécimal)')63Label_cle.grid(columnspan = 4)64# Création d'un widget Entry (valeure de la clé)65val_key= StringVar()66Champ2 = Entry(Frame1, textvariable= val_key,width = 50)67Champ2.focus_set()68Champ2.grid(row=3,column=0,padx =0, pady =10)69# création d'un widget Frame pour chiffrement dans la fenêtre principale 70Frame2 = Frame(fenetre,width=500, height=500, borderwidth=2,relief=GROOVE)71Frame2.pack(side=TOP,padx=20,pady=20)72# Création d'un widget Label (texte 'plaintext')73Label_plaintext = Label(Frame2, text = 'Chiffrement')74Label_plaintext.grid(columnspan = 4)75# Création d'un widget Entry (chemin du plaintext)76Champ_plaintext = Entry(Frame2, textvariable= path_plaintext,width = 50)77Champ_plaintext.focus_set()78Champ_plaintext.grid(row=2,column=0,padx =0, pady =10)79# Création d'un widget Button (bouton Ouvrir fichier plaintext)80Ouvrir_plaintext = Button(Frame2, text ='Ouvrir', command = Ouverture_fichier_plaintext)81Ouvrir_plaintext.grid(row=2,column=1,padx =0, pady =10)82# Création d'un widget Button (bouton Chiffrer fichier plaintext)83Ouvrir_plaintext = Button(Frame2, text ='Chiffrer', command = Chiffrement_plaintext)84Ouvrir_plaintext.grid(row=3,columnspan = 4,padx =0, pady =5)85# création d'un widget Frame pour déchiffrement dans la fenêtre principale 86Frame3 = Frame(fenetre,width=500, height=500, borderwidth=2,relief=GROOVE)87Frame3.pack(side=TOP,padx=20,pady=20)88# Création d'un widget Label (texte 'plaintext')89Label_ciphertext = Label(Frame3, text = 'Déchiffrement')90Label_ciphertext.grid(columnspan = 4)91# Création d'un widget Entry (chemin du ciphertext)92Champ_ciphertext = Entry(Frame3, textvariable= path_ciphertext,width = 50)93Champ_ciphertext.focus_set()94Champ_ciphertext.grid(row=2,column=0,padx =0, pady =10)95# Création d'un widget Button (bouton Ouvrir fichier ciphertext)96Ouvrir_ciphertext = Button(Frame3, text ='Ouvrir', command = Ouvrir_fichier_cipher)97Ouvrir_ciphertext.grid(row=2,column=1,padx =0, pady =10)98# Création d'un widget Button (bouton Chiffrer fichier plaintext)99Ouvrir_plaintext = Button(Frame3, text ='Déchiffrer', command = dechiffrement_plaintext)100Ouvrir_plaintext.grid(row=3,columnspan = 4,padx =0, pady =5)101#Montage fenêtre...
mainUI.py
Source: mainUI.py
1from tkinter import*2import tkinter as Tk34from utilitaire import *5from CollegeDivision import CollegeDivisionStart6from LyceePolynomes import LyceePolynomesStart7from LyceeComplexes import LyceeComplexeStart8from CollegeFonction import CollegeFonctionStart9from PrimaireAddition import PrimaireAdditionStart10from PrimaireAireRectangle import AireRectangleStart11from PrimaireAireTQ import AireTQStart12from PrimaireAireTR import AireTRStart13from PrimaireDivision import PrimaireDivisionStart14from PrimaireMultiplication import PrimaireMultiplicationStart15from PrimaireSoustraction import PrimaireSoustractionStart16from CollegeDivisionP import CollegeDivisionPStart17from CollegeMP import CollegeMPStart18from CollegePyth import CollegePythStart19from LyceeDer import LyceeDerStart20from LyceeFonction import LyceeFonctionStart2122def ouvrirExercise(main, exercise):23 fenetre = Tk.Toplevel(main) #Créer une nouvelle fenetre24 fenetre.wm_geometry("500x500")25 exercise(fenetre)2627def createPrimaire(main):28 clean(main)29 Button(main, text="Retour", command=lambda: createStartWindow(main)).pack()30 Button(main, text="Addition", command=lambda: ouvrirExercise(main, PrimaireAdditionStart)).pack()31 Button(main, text="Aire d'un rectangle", command=lambda: ouvrirExercise(main, AireRectangleStart)).pack()32 Button(main, text="Aire d'un triangle quelconque", command=lambda: ouvrirExercise(main, AireTQStart)).pack()33 Button(main, text="Aire d'un triangle rectangle", command=lambda: ouvrirExercise(main, AireTRStart)).pack()34 Button(main, text="Division", command=lambda: ouvrirExercise(main, PrimaireDivisionStart)).pack()35 Button(main, text="Multiplication", command=lambda: ouvrirExercise(main, PrimaireMultiplicationStart)).pack()36 Button(main, text="Soustraction", command=lambda: ouvrirExercise(main, PrimaireSoustractionStart)).pack()3738def createCollege(main):39 clean(main)40 Button(main, text="Retour", command=lambda: createStartWindow(main)).pack()41 Button(main, text="Division", command=lambda: ouvrirExercise(main, CollegeDivisionStart)).pack()42 Button(main, text="Fonction", command=lambda: ouvrirExercise(main, CollegeFonctionStart)).pack()43 Button(main, text="Division de puissances", command=lambda: ouvrirExercise(main,CollegeDivisionPStart)).pack()44 Button(main, text="Multiplication de puissances", command=lambda: ouvrirExercise(main,CollegeMPStart)).pack()45 Button(main, text="Multiplication", command=lambda: ouvrirExercise(main,PrimaireMultiplicationStart)).pack()46 Button(main, text="Théorème de Pythagore",command=lambda: ouvrirExercise(main,CollegePythStart)).pack()4748def createLycee(main):49 clean(main)50 Button(main, text="Retour", command=lambda: createStartWindow(main)).pack()51 Button(main, text="Polynomes", command=lambda: ouvrirExercise(main, LyceePolynomesStart)).pack()52 Button(main, text="Complexes", command=lambda: ouvrirExercise(main, LyceeComplexeStart)).pack()53 Button(main, text="Dérivées", command=lambda: ouvrirExercise(main, LyceeDerStart)).pack()54 Button(main, text="Fonctions", command=lambda: ouvrirExercise(main, LyceeFonctionStart)).pack()555657def createStartWindow(main):58 clean(main)59 Button(main, text="Primaire", command=lambda: createPrimaire(main)).pack()60 Button(main, text="College", command=lambda: createCollege(main)).pack()61 Button(main, text="Lycee", command=lambda: createLycee(main)).pack()6263main = Tk.Tk()64main.wm_geometry("500x500")65createStartWindow(main)
...
Check out the latest blogs from LambdaTest on this topic:
The QA testing profession requires both educational and long-term or experience-based learning. One can learn the basics from certification courses and exams, boot camp courses, and college-level courses where available. However, developing instinctive and practical skills works best when built with work experience.
Ever since the Internet was invented, web developers have searched for the most efficient ways to display content on web browsers.
In general, software testers have a challenging job. Software testing is frequently the final significant activity undertaken prior to actually delivering a product. Since the terms “software” and “late” are nearly synonymous, it is the testers that frequently catch the ire of the whole business as they try to test the software at the end. It is the testers who are under pressure to finish faster and deem the product “release candidate” before they have had enough opportunity to be comfortable. To make matters worse, if bugs are discovered in the product after it has been released, everyone looks to the testers and says, “Why didn’t you spot those bugs?” The testers did not cause the bugs, but they must bear some of the guilt for the bugs that were disclosed.
Xamarin is an open-source framework that offers cross-platform application development using the C# programming language. It helps to simplify your overall development and management of cross-platform software applications.
When software developers took years to create and introduce new products to the market is long gone. Users (or consumers) today are more eager to use their favorite applications with the latest bells and whistles. However, users today don’t have the patience to work around bugs, errors, and design flaws. People have less self-control, and if your product or application doesn’t make life easier for users, they’ll leave for a better solution.
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!!