Best Python code snippet using autotest_python
create.py
Source: create.py
1import os2import sys3import re4import pkg_resources5import optparse6import shutil7from paste.script import templates, create_distro8######################################################9# Create Command10beginning_letter = re.compile(r"^[^a-z]*")11valid_only = re.compile(r"[^a-z0-9_]")12class create(object):13 desc = "Create a template for a bisquik subproject"14 templates = "service"15 package = None16 name = None17 mount = None18 cmd_args = []19 def __init__(self, version):20 parser = optparse.OptionParser(21 usage="%prog create [options] [project name]",22 version="%prog " + version)23 parser.add_option("-t", "--templates",24 help="user specific templates",25 dest="templates", default = self.templates)26 parser.add_option("-p", "--package",27 help="Set service package name",28 dest="package")29 parser.add_option('-m', '--mount',30 help="create a core system package",31 dest="mount")32 options, args = parser.parse_args()33# if len(args) != 1:34# parser.error("incorrect number of arguments")35 self.__dict__.update (options.__dict__)36 if args:37 self.name = args[0]38 def run(self):39 """Create a Bisque Service/Module template"""40 # Get to toplevel directory name i.e. the project41 while not self.name:42 self.name = raw_input("Enter bisque project [egg] name: ")43 # The package name to be used internally44 while not self.package:45 package = self.name.lower()46 package = beginning_letter.sub("", package)47 package = valid_only.sub("", package)48 self.package = raw_input("Enter [python] package name [%s]: " % package)49 if not self.package:50 self.package = package51 while not self.mount:52 mount = self.package.lower()53 mount = beginning_letter.sub("", mount)54 mount = valid_only.sub("", mount)55 self.mount = raw_input("Enter mount point (url point) [%s]: " % mount)56 if not self.mount:57 self.mount = mount58 command = create_distro.CreateDistroCommand("create")59 for template in self.templates.split(" "):60 self.cmd_args.append("--template=%s" % template)61 self.cmd_args.append(self.name)62 # Variables63 self.cmd_args.append("package=%s" % self.package)64 self.cmd_args.append("mount=%s" % self.mount)65 command.run(self.cmd_args)66class createService(create):67 desc = "Create a bisque service"68 templates = "bisque_service"69 package = None70 name = None71class createCoreService(create):72 desc = "Create a bisque core service.. it will be under <name>/<package>/bq.<package>"73 templates = "bisque_core"74 name = None75 def run(self):76 if not os.path.exists('bqcore'):77 print "Must be run in the top level Bisque directory"78 sys.exit(1)79 super(createCoreService, self).run()80class createModule(create):81 desc = "Create a blank bisque analysis module"82 templates = "bisque_module"83 package = None...
cloudfront.py
Source: cloudfront.py
...3def get_distro_summary():4 for d in boto.connect_cloudfront().get_all_distributions():5 if d.origin.dns_name == app_util.app_bucket: 6 return d7def create_distro():8 origin = boto.cloudfront.origin.S3Origin(app_util.app_bucket)9 distro = boto.connect_cloudfront().create_distribution(cnames=[app_util.app_name], origin=origin, enabled=False, comment='Snapyelp Distribution')10 return distro11if __name__ == '__main__': 12 if get_distro_summary():13 ds = get_distro_summary()14 print 'origin:', ds.origin.dns_name, 'enabled:', ds.enabled, 'domain name:', ds.domain_name15 if not ds.enabled:16 print 'enable distro'17 ds.get_distribution().enable()18 dc = boto.connect_cloudfront().get_distribution_config(ds.id) 19 if dc.default_root_object != 'index.html':20 print 'need to set Default Root Object'21 else:22 d = create_distro()23 print 'create distro:', d24 ...
Check out the latest blogs from LambdaTest on this topic:
Before we discuss Scala testing, let us understand the fundamentals of Scala and how this programming language is a preferred choice for your development requirements.The popularity and usage of Scala are rapidly rising, evident by the ever-increasing open positions for Scala developers.
So, now that the first installment of this two fold article has been published (hence you might have an idea of what Agile Testing is not in my opinion), I’ve started feeling the pressure to explain what Agile Testing actually means to me.
Did you know that according to Statista, the number of smartphone users will reach 18.22 billion by 2025? Let’s face it, digital transformation is skyrocketing and will continue to do so. This swamps the mobile app development market with various options and gives rise to the need for the best mobile app testing tools
As a developer, checking the cross browser compatibility of your CSS properties is of utmost importance when building your website. I have often found myself excited to use a CSS feature only to discover that it’s still not supported on all browsers. Even if it is supported, the feature might be experimental and not work consistently across all browsers. Ask any front-end developer about using a CSS feature whose support is still in the experimental phase in most prominent web browsers. ????
The count of mobile users is on a steep rise. According to the research, by 2025, it is expected to reach 7.49 billion users worldwide. 70% of all US digital media time comes from mobile apps, and to your surprise, the average smartphone owner uses ten apps per day and 30 apps each month.
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!!