Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return tabulate.tabulate(table)
"""
methods = [
("join with tabs and newlines", "join_table(table)"),
("csv to StringIO", "csv_table(table)"),
("asciitable (%s)" % asciitable.__version__, "run_asciitable(table)"),
("tabulate (%s)" % tabulate.__version__, "run_tabulate(table)"),
(
"tabulate (%s, WIDE_CHARS_MODE)" % tabulate.__version__,
"run_tabulate(table, widechars=True)",
),
("PrettyTable (%s)" % prettytable.__version__, "run_prettytable(table)"),
("texttable (%s)" % texttable.__version__, "run_texttable(table)"),
]
if tabulate.wcwidth is None:
del methods[4]
def benchmark(n):
global methods
if "--onlyself" in sys.argv[1:]:
methods = [m for m in methods if m[0].startswith("tabulate")]
else:
methods = methods
results = [
(desc, timeit(code, setup_code, number=n) / n * 1e6) for desc, code in methods