Best Python code snippet using SeleniumBase
final_project.py
Source:final_project.py
...76def run_5(b5):77 global run_578 run_5 = not run_579b5 = button(text = "water",pos = scene1.title_anchor,bind=run_5)80def run_6(b6):81 global run_682 run_6 = not run_683b6 = button(text = "glass",pos = scene1.title_anchor,bind=run_6)84#scene1.bind('keydown', keyinput) # setting for the binding function85#scene2.bind('keydown', keyinput) # setting for the binding function86def get_E_field(shape1 , medium):87 if shape1 == 0:88 E_field , maxI = circle_E_field(medium)89 return E_field , maxI90 elif shape1 == 1 :91 E_field , maxI = rectangle_E_field(medium)92 return E_field , maxI93 elif shape1 == 2 :94 E_field , maxI = W_sided_poly_E_field(medium)...
models.py
Source:models.py
1from . import db2from . import ma3from sqlalchemy.sql import func4# # For development purposes5# from flask import Flask6# from flask_sqlalchemy import SQLAlchemy7# from flask_marshmallow import Marshmallow8# app = Flask(__name__)9# DB_NAME = 'database.db'10# app.config['SECRET_KEY'] = 'this_is_my_secret'11# app.config['SQLALCHEMY_DATABASE_URI'] = f'sqlite:///{DB_NAME}'12# db = SQLAlchemy(app)13# ma = Marshmallow()14# db.init_app(app)15# # For development purposes \16class Month(db.Model):17 id = db.Column(db.Integer, primary_key=True)18 month = db.Column(db.String(64), unique=True)19 build_backref = db.relationship('Build', backref='month')20 execution_run_backref = db.relationship('ExecutionRun', backref='month')21class Build(db.Model):22 id = db.Column(db.Integer, primary_key=True)23 build_name = db.Column(db.String(128), unique=True)24 execution_run_backref = db.relationship('ExecutionRun', backref='build')25 month_id = db.Column(db.Integer, db.ForeignKey('month.id'))26class ExecutionRun(db.Model):27 id = db.Column(db.Integer, primary_key=True)28 execution_run_name = db.Column(db.String(128))29 build_id = db.Column(db.Integer, db.ForeignKey('build.id'))30 month_id = db.Column(db.Integer, db.ForeignKey('month.id'))31class ExecutionRunSchema(ma.Schema):32 class Meta:33 model = ExecutionRun34 fields = ('id', 'execution_run_name', 'build_id', 'month_id')35 ordered = True36class BuildSchema(ma.Schema):37 class Meta:38 model = Build39 fields = ('id', 'build_name', 'month_id')40 ordered = True41class MonthSchema(ma.Schema):42 executions = ma.Nested(BuildSchema, many=True)43 class Meta:44 model = Month45 fields = ('id', 'month')46 ordered = True47execution_run_schema = ExecutionRunSchema()48all_execution_run_schema = ExecutionRunSchema(many=True)49build_schema = BuildSchema()50all_build_schema = BuildSchema(many=True)51month_schema = MonthSchema()52all_month_schema = MonthSchema(many=True)53if __name__ == '__main__':54 db.create_all()55 july = Month(month='July')56 august = Month(month='August')57 september = Month(month='September')58 commit_1 = Build(build_name='commit_1', month=july)59 commit_2 = Build(build_name='commit_2', month=july)60 commit_3 = Build(build_name='commit_3', month=august)61 commit_4 = Build(build_name='commit_4', month=august)62 commit_5 = Build(build_name='commit_5', month=august)63 commit_6 = Build(build_name='commit_6', month=august)64 commit_7 = Build(build_name='commit_7', month=september)65 commit_8 = Build(build_name='commit_8', month=september)66 commit_9 = Build(build_name='commit_9', month=september)67 commit_10 = Build(build_name='commit_10', month=september)68 run_1 = ExecutionRun(execution_run_name='run_1', build=commit_1, month=july)69 run_2 = ExecutionRun(execution_run_name='run_2', build=commit_1, month=july)70 run_3 = ExecutionRun(execution_run_name='run_3', build=commit_2, month=july)71 run_4 = ExecutionRun(execution_run_name='run_4', build=commit_2, month=july)72 run_5 = ExecutionRun(execution_run_name='run_5', build=commit_3, month=august)73 run_6 = ExecutionRun(execution_run_name='run_6', build=commit_3, month=august)74 run_7 = ExecutionRun(execution_run_name='run_7', build=commit_4, month=august)75 run_8 = ExecutionRun(execution_run_name='run_8', build=commit_4, month=august)76 run_9 = ExecutionRun(execution_run_name='run_9', build=commit_5, month=august)77 run_10 = ExecutionRun(execution_run_name='run_10', build=commit_5, month=august)78 run_11 = ExecutionRun(execution_run_name='run_11', build=commit_6, month=august)79 run_12 = ExecutionRun(execution_run_name='run_12', build=commit_6, month=august)80 run_13 = ExecutionRun(execution_run_name='run_13', build=commit_7, month=september)81 run_14 = ExecutionRun(execution_run_name='run_14', build=commit_7, month=september)82 run_15 = ExecutionRun(execution_run_name='run_15', build=commit_8, month=september)83 run_16 = ExecutionRun(execution_run_name='run_16', build=commit_8, month=september)84 run_17 = ExecutionRun(execution_run_name='run_17', build=commit_9, month=september)85 run_18 = ExecutionRun(execution_run_name='run_18', build=commit_9, month=september)86 run_19 = ExecutionRun(execution_run_name='run_19', build=commit_10, month=september)87 run_20 = ExecutionRun(execution_run_name='run_20', build=commit_10, month=september)88 run_21 = ExecutionRun(execution_run_name='run_21', build=commit_10, month=september)89 db.session.add_all([july, august, commit_1, commit_2, commit_3, commit_4, commit_5, commit_6, commit_7, commit_8, commit_9, commit_10, run_1, run_2, run_3, run_4, run_5, run_6, run_7, run_8, run_9, run_10, run_11, run_12, run_13, run_14, run_15, run_16, run_17, run_18, run_19, run_20, run_21,])90 db.session.commit()91 # july = Month.query.filter_by(month='July').first()92 # august = Month.query.filter_by(month='August').first()93 # commit_1 = Build.query.filter_by(build_name='commit_1').first()94 # commit_2 = Build.query.filter_by(build_name='commit_2').first()95 # commit_3 = Build.query.filter_by(build_name='commit_3').first()96 # commit_4 = Build.query.filter_by(build_name='commit_4').first()97 # commit_5 = Build.query.filter_by(build_name='commit_5').first()98 # run_1 = ExecutionRun.query.filter_by(execution_run_name='run_1').first()99 # run_2 = ExecutionRun.query.filter_by(execution_run_name='run_2').first()100 # run_3 = ExecutionRun.query.filter_by(execution_run_name='run_3').first()101 # run_4 = ExecutionRun.query.filter_by(execution_run_name='run_4').first()102 # run_5 = ExecutionRun.query.filter_by(execution_run_name='run_5').first()103 # run_6 = ExecutionRun.query.filter_by(execution_run_name='run_6').first()104 # run_7 = ExecutionRun.query.filter_by(execution_run_name='run_7').first()105 # run_8 = ExecutionRun.query.filter_by(execution_run_name='run_8').first()106 # run_9 = ExecutionRun.query.filter_by(execution_run_name='run_9').first()...
plot_v8.py
Source:plot_v8.py
1import matplotlib.pyplot as plt2from matplotlib import gridspec3import numpy as np4in_data = "run_6/run_6_e2_phot_prf_limit.dat"5in_model = "run_6/run_6_e2_phot.res"6out_file = "run_6/plot_eb234840_v8.png"7kwargs = {'color': 'red', 'marker': '.', 'ls': 'none'}8x_lim = [7500., 7528.]9y_lim = [-4000., 500.]10kwargs_1 = {'color': 'blue', 'ls': ':', 'lw': 2, 'zorder': 10}11xlabel = 'BJD - 2450000'12ylabel = 'delta flux'13band = np.arange(7500, 7508.0001)14kwargs_band = {'color': 'blue', 'lw': 2, 'zorder': 10}15################16# End of settings17(times, values, errors) = np.loadtxt(in_data, unpack=True)18(times_model, _, _, values_model) = np.loadtxt(in_model, unpack=True)19plt.errorbar(times, values, yerr=errors, **kwargs)20mask = (times_model > band[-1])21plt.plot(times_model[mask], values_model[mask], **kwargs_1)22plt.xlabel(xlabel)23plt.ylabel(ylabel)24plt.xlim(x_lim)25plt.ylim(y_lim)26plt.plot(band, band*0., **kwargs_band)...
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!!