Best Python code snippet using lemoncheesecake
gccdeps.py
Source:gccdeps.py  
...26	names = []27	return (nodes, names)28re_o = re.compile("\.o$")29re_src = re.compile("^(\.\.)[\\/](.*)$")30def post_run(self):31	# The following code is executed by threads, it is not safe, so a lock is needed...32	if getattr(self, 'cached', None):33		return Task.Task.post_run(self)34	name = self.outputs[0].abspath(self.env)35	name = re_o.sub('.d', name)36	txt = Utils.readf(name)37	#os.unlink(name)38	txt = txt.replace('\\\n', '')39	lst = txt.strip().split(':')40	val = ":".join(lst[1:])41	val = val.split()42	nodes = []43	bld = self.generator.bld44	f = re.compile("^("+self.env.variant()+"|\.\.)[\\/](.*)$")45	for x in val:46		if os.path.isabs(x):47			if not preproc.go_absolute:48				continue49			lock.acquire()50			try:51				node = bld.root.find_resource(x)52			finally:53				lock.release()54		else:55			g = re.search(re_src, x)56			if g:57				x = g.group(2)58				lock.acquire()59				try:60					node = bld.bldnode.parent.find_resource(x)61				finally:62					lock.release()63			else:64				g = re.search(f, x)65				if g:66					x = g.group(2)67					lock.acquire()68					try:69						node = bld.srcnode.find_resource(x)70					finally:71						lock.release()72		if id(node) == id(self.inputs[0]):73			# ignore the source file, it is already in the dependencies74			# this way, successful config tests may be retrieved from the cache75			continue76		if not node:77			raise ValueError('could not find %r for %r' % (x, self))78		else:79			nodes.append(node)80	Logs.debug('deps: real scanner for %s returned %s' % (str(self), str(nodes)))81	bld.node_deps[self.unique_id()] = nodes82	bld.raw_deps[self.unique_id()] = []83	try:84		del self.cache_sig85	except:86		pass87	Task.Task.post_run(self)88import Constants, Utils89def sig_implicit_deps(self):90	try:91		return Task.Task.sig_implicit_deps(self)92	except Utils.WafError:93		return Constants.SIG_NIL94for name in 'cc cxx'.split():95	try:96		cls = Task.TaskBase.classes[name]97	except KeyError:98		pass99	else:100		cls.post_run = post_run101		cls.scan = scan...task.py
Source:task.py  
...17        try:18            self.base.lock()19            self.pre_run()20            self.run()21            self.post_run()22        finally:23            self.base.unlock()24            time.sleep(1)25    def pre_run(self):26        pass27    def run(self):28        pass29    def post_run(self):30        pass31    def __lt__(self, other):32        return self.priority > other.priority33class LimitedTask(Task):34    def __init__(self, base, number, priority=-1):35        self.number = number36        super().__init__(base, priority)37    def is_over(self):38        return self.number <= 039    def execute(self):40        try:41            self.pre_run()42            self.base.lock()43            self.run()44            self.post_run()45        finally:46            self.number -= 147            self.base.unlock()48            time.sleep(1)49class ContinualTask(Task):50    def __init__(self, base, priority=-1):51        super().__init__(base, priority)52    def execute(self):53        try:54            self.base.lock()55            self.pre_run()56            while True:57                self.run()58            self.post_run()59        finally:60            self.base.unlock()61            time.sleep(10)62class TimerTask(Task):63    def __init__(self, base, interval, priority=-1):64        super().__init__(base, priority)...main.py
Source:main.py  
1import csv2#Start CSV File reading3with open('product.csv', 'r', encoding='utf-8') as csv_file:4    csv_reader = csv.reader(csv_file)5    dicts = {}6    i = 07    for list in csv_reader:8        dicts[i] = {9            'keyword':list[0],10            'p1-lnk':list[1],11            'p1-fe':list[2],12            'info-1': list[21],13            'info-2': list[22],14            'buy-1': list[26],15            'buy-2': list[27]16        }17        i = i + 118csv_file.close()19#End CSV File reading20post_run = 121while post_run < len(dicts):22  #Link, Image, Title, Info, buying23  p1lnk = dicts[post_run]['p1-lnk']24  p1fe = dicts[post_run]['p1-fe']25  info1 = dicts[post_run]['info-1']26  info2 = dicts[post_run]['info-2']27  buy1 = dicts[post_run]['buy-1']28  buy2 = dicts[post_run]['buy-2']29  30  print(p1lnk)31  print(p1fe)32  print(info1)33  print(info2)34  print(buy1)35  print(buy2)...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!!
