Best Python code snippet using localstack_python
clean.py
Source:clean.py
...36 """clean the dis and uninstall cloudmesh"""37 dir()38 cmd3()39 banner("CLEAN PREVIOUS CLOUDMESH INSTALLS")40 delete_package("cloudmesh")41 delete_package("cloudmesh_cmd3")42 delete_package("cloudmesh_common")43 delete_package("cloudmesh_install")44def delete_package(name):45 banner("CLEAN PREVIOUS {0} INSTALLS".format(name))46 r = int(local("pip freeze |fgrep {0} | wc -l".format(name), capture=True))47 while r > 0:48 local('echo "y" | pip uninstall {0}'.format(name))49 r = int(...
remove_package.py
Source:remove_package.py
1import fnmatch2import os3import re4re_reference = re.compile(r'\<Reference Include=\"([\w\.]+)\,.*?\<\/Reference\>', re.DOTALL | re.MULTILINE)5def process_csproj(file, delete_package):6 proj = open(file).read()7 def repl(mo):8 if mo.group(1) == delete_package:9 return ""10 else:11 return mo.group(0)12 proj_new = re_reference.sub(repl, proj)13 if proj != proj_new:14 print "!", file15 open(file, "wb").write(proj_new)16re_package = re.compile(r'\<package id\="([\w\.]*)".*?\/\>')17def process_package(file, delete_package):18 pack = open(file).read()19 def repl(mo):20 if mo.group(1) == delete_package:21 return ""22 else:23 return mo.group(0)24 pack_new = re_package.sub(repl, pack)25 if pack != pack_new:26 print "!", file27 open(file, "wb").write(pack_new)28def do_recursive(start_path, delete_package):29 projs = []30 packages = []31 for root, dirnames, filenames in os.walk('../../'):32 for filename in fnmatch.filter(filenames, '*.csproj'):33 process_csproj(os.path.join(root, filename), delete_package)34 for filename in fnmatch.filter(filenames, 'packages.config'):35 process_package(os.path.join(root, filename), delete_package)36#do_recursive('../../', 'NetLegacySupport.Action')37#do_recursive('../../', 'NetLegacySupport.ConcurrentDictionary')38#do_recursive('../../', 'NetLegacySupport.Tuple')...
urls.py
Source:urls.py
1from django.conf.urls import url,include2from . import views34urlpatterns = [5 url(r'^delete_hotel/(?P<pk>[0-9]+)/$',views.delete_hotel, name='delete_hotel'),6 url(r'^delete_package/(?P<pk>[0-9]+)/$',views.delete_package, name='delete_package'),7 url(r'^dashboard/generate_report/',views.generate_report, name='generate_report'),8 url(r'^dashboard/add/', views.add, name='add'),9 url(r'^dashboard/add_packages/', views.packages, name='packages'),10 url(r'^dashboard/listings/', views.listings, name='listings'),11 url(r'^dashboard/bookings/', views.bookings, name='bookings'),12 url(r'^dashboard/hotel_edit/(?P<pk>[0-9]+)/$',views.hotel_expand, name='hotel_expand'),13 url(r'^dashboard/package_edit/(?P<pk>[0-9]+)/$',views.package_expand, name='package_expand'),14 url(r'^dashboard/', views.dashboard, name='dashboard'),
...
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!!