Best Python code snippet using autotest_python
usmlist.py
Source:usmlist.py
...6 f.close()7def getcrc32(url):8 r = requests.get(url)9 return binascii.crc32(r.content)10def add_url(url,filepath):11 global count,f12 print("\n(%d)" % count)13 print("url: %s\npath: %s" % (url,filepath))14 crc32=getcrc32(url)15 print("crc32: %08X" % crc32)16 if(len(url) > 0xC0 or len(filepath) > 0x40):17 print("string length error in %d" % count)18 f.close()19 os.system("rm usmlist.bin")20 exit()21 f.seek(count*0x100)22 f.write(url.encode('ascii'))23 f.seek(count*0x100 + 0xC0)24 f.write(filepath.encode('ascii'))25 f.seek(0x4000 + (count*4))26 f.write(struct.pack("<I",crc32))27 count+=128f=open("usmlist.bin","rb+")29add_url("https://github.com/zoogie/unSAFE_MODE/releases/download/v1.2/usm.bin", "/usm.bin")30add_url("https://github.com/hax0kartik/luma-hourlies/releases/download/222-luma3ds-bb07a73/boot.firm", "/boot.firm") 31add_url("https://github.com/zoogie/DSP1/releases/download/v1.0/DSP1.cia", "/cias/DSP1.cia")32add_url("https://github.com/astronautlevel2/Anemone3DS/releases/download/v2.1.0/Anemone3DS.cia", "/cias/Anemone3DS.cia")33add_url("https://github.com/Steveice10/FBI/releases/download/2.6.0/FBI.3dsx", "/3ds/FBI.3dsx")34add_url("https://github.com/Steveice10/FBI/releases/download/2.6.0/FBI.cia", "/cias/FBI.cia")35add_url("https://github.com/mariohackandglitch/homebrew_launcher_dummy/releases/download/v1.0/Homebrew_Launcher.cia", "/cias/Homebrew_Launcher.cia")36add_url("https://github.com/KunoichiZ/lumaupdate/releases/download/v2.5/lumaupdater.cia", "/cias/lumaupdater.cia")37add_url("https://github.com/ihaveamac/ctr-no-timeoffset/releases/download/v1.1/ctr-no-timeoffset.3dsx", "/3ds/ctr-no-timeoffset.3dsx")38add_url("https://github.com/FlagBrew/Checkpoint/releases/download/v3.7.4/Checkpoint.cia", "/cias/Checkpoint.cia")39add_url("https://github.com/zoogie/GodMode9/releases/download/v1.9.2pre1/GodMode9.firm", "/luma/payloads/GodMode9.firm")40add_url("https://github.com/zoogie/GodMode9/releases/download/v1.9.2pre1/GM9Megascript.gm9", "/gm9/scripts/GM9Megascript.gm9")41f.close()42if count > 64:43 print("error too many entries")...
main.py
Source:main.py
...27 app.add_template_global('logout', users.create_logout_url("/"))28 app.add_template_global('user', local('gae_user'))29 app.add_template_global('account', local('account'))30 app.add_template_filter('preview', utils.preview)31 app.add_url('/', 'main/index', view=views.index)32 app.add_url('/home/', 'home', view=views.home)33 app.add_url('/home/dashboard/', 'home/dashboard', view=views.dashboard)34 app.add_url('/home/submit/', 'home/submit', view=views.submit)35 app.add_url('/home/first/', 'home/first', view=views.first)36 app.add_url('/home/profile/', 'home/profile', view=views.profile)37 app.add_url('/home/preview/<int:submission_id>/', 'home/preview', view=views.preview)38 app.add_url('/home/resubmit/<int:submission_id>/', 'home/resubmit', view=views.resubmit)39 app.add_url('/submissions/', 'submissions/index', view=views.submissions_index)40 app.add_url('/faq/', 'main/faq', view=views.faq)41 app.add_url('/admin/faq/group/', 'admin/faq/group', view=views.faq_admin_group)42 app.add_url('/admin/faq/question/', 'admin/faq/question', view=views.faq_admin_question)43def main():44 gae.make_and_run_gae_app(setup)45if __name__ == '__main__':...
urls.py
Source:urls.py
...7from . import table8from . import greetings9urlpatterns = []10base_footer_info = []11def add_url(url, handler, name, footer_title=None):12 urlpatterns.append(path(url, handler, name=name))13 if footer_title:14 base_footer_info.append({ "url": "/" + url, "title": footer_title })15def footer_info(request):16 active_i = 017 for i in range(len(base_footer_info)):18 if base_footer_info[i]["url"] == request.path:19 active_i = i20 break21 22 next_page = None23 if i+1 < len(base_footer_info):24 next_page = base_footer_info[i+1]["url"]25 dots = []26 for i in range(len(base_footer_info)):27 info = base_footer_info[i].copy()28 info["cls_str"] = "is-active" if i == active_i else ("is-complete" if i < active_i else "")29 dots.append(info)30 31 return { "dots": dots, "next_page": next_page }32add_url('', views.index, 'index', 'Home')33add_url('invitation/', views.invitation, 'invitation', 'Invitation')34add_url('reception/', reception.reception, 'reception', 'Reception')35add_url('table/', table.table, 'table', 'Table')36add_url('greetings/', greetings.greetings, 'greetings', 'Greetings')37add_url('hoopa/', views.hoopa, 'hoopa', 'Hoopa')38add_url('dancefloor/', views.dancefloor, 'dancefloor', 'Dancefloor')39add_url('react-example/', views.react_example, 'react-example')40add_url('api/dancefloor/add-dancer', views.add_dancer, 'add-dancer')41add_url('api/dancefloor/position-dancer', views.position_dancer, 'position-dancer')42urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)43add_url('magnets/', magnets.magnets, 'magnets', 'Magnets')...
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!!