How to use tee_line method in autotest

Best Python code snippet using autotest_python

regression.py

Source:regression.py Github

copy

Full Screen

...285 str[i] = " "286 if split:287 return "|".join(str[ignore_col:])288 return "|".join(str)289 def tee_line(content, file, n=None):290 fd = open(file, "a")291 print content292 str = ""293 str += "<TR ALIGN=CENTER>"294 content = content.split("|")295 for i in range(len(content)):296 if n and i >= 2 and i < ignore_col + 2:297 str += "<TD ROWSPAN=%d WIDTH=1%% >%s</TD>" % (n, content[i])298 else:299 str += "<TD WIDTH=1%% >%s</TD>" % content[i]300 str += "</TR>"301 fd.write(str + "\n")302 fd.close()303 for l in range(len(lists[0])):304 if not re.findall("[a-zA-Z]", lists[0][l]):305 break306 tee("<TABLE BORDER=1 CELLSPACING=1 CELLPADDING=1 width=10%><TBODY>",307 f)308 tee("<h3>== %s " % sum + "==</h3>", f)309 category = 0310 for i in range(len(lists[0])):311 for n in range(len(lists)):312 is_diff = False313 for j in range(len(lists)):314 if lists[0][i] != lists[j][i]:315 is_diff = True316 if len(lists) == 1 and not re.findall("[a-zA-Z]", lists[j][i]):317 is_diff = True318 pfix = prefix1[0]319 if len(prefix1) != 1:320 pfix = prefix1[n]321 if is_diff:322 if n == 0:323 tee_line(pfix + lists[n][i], f, n=len(lists) + len(rates))324 else:325 tee_line(pfix + str_ignore(lists[n][i], True), f)326 if not is_diff and n == 0:327 if '|' in lists[n][i]:328 tee_line(prefix0 + lists[n][i], f)329 elif "Category:" in lists[n][i]:330 if category != 0 and prefix3:331 if len(allpvalues[category - 1]) > 0:332 tee_line(prefix3 + str_ignore(333 allpvalues[category - 1][0]), f)334 tee("</TBODY></TABLE>", f)335 tee("<br>", f)336 tee("<TABLE BORDER=1 CELLSPACING=1 CELLPADDING=1 "337 "width=10%><TBODY>", f)338 category += 1339 tee("<TH colspan=3 >%s</TH>" % lists[n][i], f)340 else:341 tee("<TH colspan=3 >%s</TH>" % lists[n][i], f)342 for n in range(len(rates)):343 if lists[0][i] != rates[n][i] and not re.findall("[a-zA-Z]",344 rates[n][i]):345 tee_line(prefix2[n] + str_ignore(rates[n][i], True), f)346 if prefix3 and len(allpvalues[-1]) > 0:347 tee_line(prefix3 + str_ignore(allpvalues[category - 1][0]), f)348 tee("</TBODY></TABLE>", f)349def analyze(test, type, arg1, arg2, configfile):350 """ Compute averages/p-vales of two samples, print results nicely """351 config = ConfigParser.ConfigParser()352 config.read(configfile)353 ignore_col = int(config.get(test, "ignore_col"))354 avg_update = config.get(test, "avg_update")355 desc = config.get(test, "desc")356 def get_list(dir):357 result_file_pattern = config.get(test, "result_file_pattern")358 cmd = 'find %s|grep "%s.*/%s"' % (dir, test, result_file_pattern)359 print cmd360 return commands.getoutput(cmd)361 if type == 'file':...

Full Screen

Full Screen

sphinx_local_hooks.py

Source:sphinx_local_hooks.py Github

copy

Full Screen

1#-*- coding: utf-8 -*-2from __future__ import print_function3import itertools as it, operator as op, functools as ft4from collections import Iterable5import os, sys, types, re6from sphinx.ext.autodoc import Documenter7_autodoc_add_line = Documenter.add_line8@ft.wraps(_autodoc_add_line)9def autodoc_add_line(self, line, *argz, **kwz):10 tee = self.env.app.config.autodoc_dump_rst11 if tee:12 tee_line = self.indent + line13 if isinstance(tee, file): tee.write(tee_line + '\n')14 elif tee is True: print(tee_line)15 else:16 raise ValueError('Unrecognized value for "autodoc_dump_rst" option: {!r}'.format(tee))17 return _autodoc_add_line(self, line, *argz, **kwz)18Documenter.add_line = autodoc_add_line19def process_docstring(app, what, name, obj, options, lines):20 if not lines: return21 i, ld = 0, dict(enumerate(lines)) # to allow arbitrary peeks22 i_max = max(ld)23 def process_line(i):24 line, i_next = ld[i], i + 125 while i_next not in ld and i_next <= i_max: i_next += 126 line_next = ld.get(i_next)27 if line_next and line_next[0] in u' \t': # tabbed continuation of the sentence28 ld[i] = u'{} {}'.format(line, line_next.strip())29 del ld[i_next]30 process_line(i)31 elif line.endswith(u'.') or (line_next and line_next[0].isupper()): ld[i + 0.5] = u''32 for i in xrange(i_max + 1):33 if i not in ld: continue # was removed34 process_line(i)35 # Overwrite the list items inplace, extending the list if necessary36 for i, (k, line) in enumerate(sorted(ld.viewitems())):37 try: lines[i] = line38 except IndexError: lines.append(line)39 for i in xrange(max(0, i_max- i)): lines.pop() # trim the leftovers, if any40def skip_override(app, what, name, obj, skip, options):41 if options.get('exclude-members'):42 include_only = set(re.compile(k[3:])43 for k in options['exclude-members'] if k.startswith('rx:'))44 if include_only:45 for pat in include_only:46 if pat.search(name): break47 else: return True48 if what == 'exception':49 return False if name == '__init__' \50 and isinstance(obj, types.UnboundMethodType) else True51 elif what == 'class':52 if ( name in ['__init__', '__call__'] \53 and isinstance(obj, types.UnboundMethodType) )\54 or getattr(obj, 'im_class', None) is type: return False55 return skip56def setup(app):57 app.connect('autodoc-process-docstring', process_docstring)58 app.connect('autodoc-skip-member', skip_override)...

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run autotest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful