Best Python code snippet using autotest_python
__init__.py
Source:__init__.py
...31 new_lines.append(line)32 else:33 new_lines.append( line.rstrip('\n') )34 return new_lines35 def _process_lines(self, lines):36 new_lines = []37 for line in lines:38 39 if line.startswith('#include'):40 filename = line.split()[1]41 for line in self._incl(filename):42 new_lines.append(line)43 else:44 new_lines.append(line)45 46 return new_lines47 def run(self, lines):48 return self._process_lines(lines)49class IncludeMD(Extension):50 def __init__(self, **kwargs):51 self.config = {52 'path': [kwargs['path'], ],53 }54 super(self.__class__, self).__init__(**kwargs)55 def extendMarkdown(self, md):...
dns.py
Source:dns.py
...22 file_path = os.path.join(xbmc.translatePath(directory), 'dns_rewrites.txt')23 if not os.path.exists(file_path):24 return rewrites25 try:26 def _process_lines(lines):27 for line in lines:28 entry = line.strip()29 if not entry:30 continue31 try:32 ip, pattern = entry.split(None, 1)33 except:34 if entry.lower().startswith('http'):35 text = _get_url(entry)36 _process_lines(text.split('\n'))37 continue38 pattern = pattern.strip()39 ip = ip.strip()40 if not pattern or not ip:41 continue42 rewrites.append((pattern, ip))43 with open(file_path, 'r') as f:44 text = f.read()45 _process_lines(text.split('\n'))46 except Exception as e:47 log.debug('DNS Rewrites Failed: {}'.format(file_path))48 log.exception(e)...
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!!