How to use the tabulate.__version__ function in tabulate

To help you get started, we’ve selected a few tabulate examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pyexcel-renderers / pyexcel-text / tests / fixtures.py View on Github external
' {"Column 1": 4, "Column 2": 5, "Column 3": 6},'
            ' {"Column 1": 7, "Column 2": 8, "Column 3": 9}]}',
        'column_series_irregular_columns':
            '{"pyexcel_sheet1": [{"Column 1": 1, "Column 2": 2, "Column 3": 3},'
            ' {"Column 1": 4, "Column 2": 5, "Column 3": 6},'
            ' {"Column 1": 7, "Column 2": 8, "Column 3": ""}]}',
        'csvbook_irregular_columns':
            '{"testfile.csv": [[1, 2, 3], [4, 588, 6], [7, 8, ""]]}',
        'data_frame':
            '{"pyexcel_sheet1": {"Row 1": {"Column 1": 1, "Column 2": 2, "Column 3": 3}, "Row 2": {"Column 1": 4, "Column 2": 5, "Column 3": 6}, "Row 3": {"Column 1": 7, "Column 2": 8, "Column 3": 9}}}',
        'row_series':
            '{"pyexcel_sheet1": [{"Row 1": 1, "Row 2": 4, "Row 3": 7}, {"Row 1": 2, "Row 2": 5, "Row 3": 8}, {"Row 1": 3, "Row 2": 6, "Row 3": 9}]}'
    }
}

if (LooseVersion(tabulate.__version__) <= LooseVersion('0.7.5') or
    platform.python_implementation() == 'PyPy'):
    EXPECTED_RESULTS['rst']['data_frame'] = dedent("""
            pyexcel_sheet1:
            =====  ==========  ==========  ==========
                     Column 1    Column 2    Column 3
            =====  ==========  ==========  ==========
            Row 1           1           2           3
            Row 2           4           5           6
            Row 3           7           8           9
            =====  ==========  ==========  ==========""").strip('\n')
else:
    EXPECTED_RESULTS['rst']['data_frame'] = dedent("""
            pyexcel_sheet1:
            =====  ==========  ==========  ==========
            ..       Column 1    Column 2    Column 3
            =====  ==========  ==========  ==========
github pyexcel-renderers / pyexcel-text / tests / fixtures.py View on Github external
Row 3           7           8           9
            =====  ==========  ==========  ==========""").strip('\n')
else:
    EXPECTED_RESULTS['rst']['data_frame'] = dedent("""
            pyexcel_sheet1:
            =====  ==========  ==========  ==========
            ..       Column 1    Column 2    Column 3
            =====  ==========  ==========  ==========
            Row 1           1           2           3
            Row 2           4           5           6
            Row 3           7           8           9
            =====  ==========  ==========  ==========""").strip('\n')


# tabulate 0.7.6-dev adds  and  elements
if LooseVersion(tabulate.__version__) > LooseVersion('0.7.5'):
    EXPECTED_RESULTS['html'] = dict(
            (key, value.replace('\n', '\n').replace('', '\n\n').replace('\n', '<table><tbody><tr></tr></tbody></table><table><tbody><tr></tr></tbody></table>\n\n').replace('', '\n'))
            for key, value in EXPECTED_RESULTS['html'].items())
github ahkab / ahkab / ahkab / ahkab.py View on Github external
- TRANsient (TRAN): ``.tran``
    - Symbolic: ``.symbolic``

    **Returns:**

    res : dict
        A dictionary containing the computed results.
    """
    printing.print_info_line(
        ("This is ahkab %s running with:" % (__version__), 6), verbose)
    printing.print_info_line(
        ("  Python %s" % (sys.version.split('\n')[0],), 6), verbose)
    printing.print_info_line(("  Numpy %s" % (np.__version__), 6), verbose)
    printing.print_info_line(("  Scipy %s" % (sp.__version__), 6), verbose)
    printing.print_info_line(("  Sympy %s" % (sympy.__version__), 6), verbose)
    printing.print_info_line(("  Tabulate %s" % (tabulate.__version__), 6), verbose)
    if plotting_available:
        printing.print_info_line(("  Matplotlib %s" % (matplotlib.__version__),
                                  6), verbose)
        printing.print_info_line(("  -> backend: %s" %
                                 (matplotlib.get_backend()), 6), verbose)
        printing.print_info_line(("  -> matplotlibrc: %s" %
                                 (matplotlib.matplotlib_fname()), 6), verbose)
    else:
        printing.print_info_line(
            ("  Matplotlib not found.", 6), verbose)


    read_netlist_from_stdin = (filename is None or filename == "-")
    (circ, directives, postproc_direct) = netlist_parser.parse_circuit(
        filename, read_netlist_from_stdin)
github techouse / mysql-to-sqlite3 / mysql_to_sqlite3 / debug_info.py View on Github external
return [
        ["mysql-to-sqlite3", package_version.__version__],
        ["", ""],
        ["Operating System", platform_info],
        ["Python", _implementation()],
        ["MySQL", _mysql_version()],
        ["SQLite", sqlite3.sqlite_version],
        ["", ""],
        ["click", click.__version__],
        ["mysql-connector-python", mysql.connector.__version__],
        ["python-slugify", slugify.__version__],
        ["pytimeparse", pytimeparse.__version__],
        ["simplejson", simplejson.__version__],
        ["six", six.__version__],
        ["tabulate", tabulate.__version__],
        ["tqdm", tqdm.__version__],
    ]
github techouse / sqlite3-to-mysql / sqlite3_to_mysql / debug_info.py View on Github external
platform_info = "Unknown"

    return [
        ["sqlite3-to-mysql", package_version.__version__],
        ["", ""],
        ["Operating System", platform_info],
        ["Python", _implementation()],
        ["MySQL", _mysql_version()],
        ["SQLite", sqlite3.sqlite_version],
        ["", ""],
        ["click", click.__version__],
        ["mysql-connector-python", mysql.connector.__version__],
        ["pytimeparse", pytimeparse.__version__],
        ["simplejson", simplejson.__version__],
        ["six", six.__version__],
        ["tabulate", tabulate.__version__],
        ["tqdm", tqdm.__version__],
    ]
github astanin / python-tabulate / benchmark.py View on Github external
def run_tabletext(table):
    return tabletext.to_text(table)


def run_tabulate(table, widechars=False):
    tabulate.WIDE_CHARS_MODE = tabulate.wcwidth is not None and widechars
    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:]: