mirror of
https://github.com/opencv/opencv.git
synced 2025-08-06 06:26:29 +08:00
Merge pull request #19268 from fpetrogalli:tabs-summary-output
* [ts][summary.py] Extend `-o` to support tabs separated output. * [ts][summary.py] Improve TABS sepatated output. There is no need to print TAB at the beginning and at the end of each row in the table. Cosmetic change: using python list comprehension instead of for loop to process a single row.
This commit is contained in:
parent
fbcc532de5
commit
235e648bf5
@ -30,7 +30,7 @@ if __name__ == "__main__":
|
||||
exit(0)
|
||||
|
||||
parser = OptionParser()
|
||||
parser.add_option("-o", "--output", dest="format", help="output results in text format (can be 'txt', 'html', 'markdown' or 'auto' - default)", metavar="FMT", default="auto")
|
||||
parser.add_option("-o", "--output", dest="format", help="output results in text format (can be 'txt', 'html', 'markdown', 'tabs' or 'auto' - default)", metavar="FMT", default="auto")
|
||||
parser.add_option("-m", "--metric", dest="metric", help="output metric", metavar="NAME", default="gmean")
|
||||
parser.add_option("-u", "--units", dest="units", help="units for output values (s, ms (default), us, ns or ticks)", metavar="UNITS", default="ms")
|
||||
parser.add_option("-f", "--filter", dest="filter", help="regex to filter tests", metavar="REGEX", default=None)
|
||||
|
@ -38,6 +38,7 @@ class table(object):
|
||||
def __init__(self, caption = None, format=None):
|
||||
self.format = format
|
||||
self.is_markdown = self.format == 'markdown'
|
||||
self.is_tabs = self.format == 'tabs'
|
||||
self.columns = {}
|
||||
self.rows = []
|
||||
self.ridx = -1;
|
||||
@ -253,7 +254,7 @@ class table(object):
|
||||
|
||||
def consolePrintTable(self, out):
|
||||
columns = self.layoutTable()
|
||||
colrizer = getColorizer(out) if not self.is_markdown else dummyColorizer(out)
|
||||
colrizer = getColorizer(out) if not (self.is_markdown or self.is_tabs) else dummyColorizer(out)
|
||||
|
||||
if self.caption:
|
||||
out.write("%s%s%s" % ( os.linesep, os.linesep.join(self.reformatTextValue(self.caption)), os.linesep * 2))
|
||||
@ -299,6 +300,10 @@ class table(object):
|
||||
text = ' '.join(self.getValue('text', c) or [])
|
||||
out.write(text + "|")
|
||||
out.write(os.linesep)
|
||||
elif self.is_tabs:
|
||||
cols_to_join=[' '.join(self.getValue('text', c) or []) for c in row.cells]
|
||||
out.write('\t'.join(cols_to_join))
|
||||
out.write(os.linesep)
|
||||
else:
|
||||
for ln in range(row.minheight):
|
||||
i = 0
|
||||
|
Loading…
Reference in New Issue
Block a user