def _addCustomTabulateTables(): """Create a custom ARMI tables within tabulate.""" tabulate._table_formats["armi"] = tabulate.TableFormat( lineabove=tabulate.Line("", "-", " ", ""), linebelowheader=tabulate.Line("", "-", " ", ""), linebetweenrows=None, linebelow=tabulate.Line("", "-", " ", ""), headerrow=tabulate.DataRow("", " ", ""), datarow=tabulate.DataRow("", " ", ""), padding=0, with_header_hide=None, ) tabulate.tabulate_formats = list(sorted(tabulate._table_formats.keys())) tabulate.multiline_formats["armi"] = "armi"
def _setup_tabulate(): """Customise tabulate.""" tabulate.PRESERVE_WHITESPACE = True tabulate.MIN_PADDING = 0 # Overwrite the 'presto' format to use the block-drawing vertical line. # pytype: disable=module-attr tabulate._table_formats["presto"] = tabulate.TableFormat( # pylint: disable=protected-access lineabove=None, linebelowheader=tabulate.Line("", "-", "+", ""), linebetweenrows=None, linebelow=None, headerrow=tabulate.DataRow("", "│", ""), datarow=tabulate.DataRow("", "│", ""), padding=1, with_header_hide=None)
def addColorInElt(elt): if not elt: return elt if elt.__class__ == tabulate.Line: return tabulate.Line(*(style_field(table_separator_token, val) for val in elt)) if elt.__class__ == tabulate.DataRow: return tabulate.DataRow(*(style_field(table_separator_token, val) for val in elt)) return elt
from cli_helpers.utils import filter_dict_by_key from cli_helpers.compat import (Terminal256Formatter, StringIO) from .preprocessors import (convert_to_string, truncate_string, override_missing_value, style_output, HAS_PYGMENTS, escape_newlines) import tabulate tabulate.MIN_PADDING = 0 tabulate._table_formats['psql_unicode'] = tabulate.TableFormat( lineabove=tabulate.Line("┌", "─", "┬", "┐"), linebelowheader=tabulate.Line("├", "─", "┼", "┤"), linebetweenrows=None, linebelow=tabulate.Line("└", "─", "┴", "┘"), headerrow=tabulate.DataRow("│", "│", "│"), datarow=tabulate.DataRow("│", "│", "│"), padding=1, with_header_hide=None, ) tabulate._table_formats['double'] = tabulate.TableFormat( lineabove=tabulate.Line("╔", "═", "╦", "╗"), linebelowheader=tabulate.Line("╠", "═", "╬", "╣"), linebetweenrows=None, linebelow=tabulate.Line("╚", "═", "╩", "╝"), headerrow=tabulate.DataRow("║", "║", "║"), datarow=tabulate.DataRow("║", "║", "║"), padding=1, with_header_hide=None, )
e['head'].lower(), e['span'].lower(), ','.join([x['span'].lower() for x in e['modifiers']]) ] for e in graph['entities']] _print( tabulate.tabulate(entities_data, headers=['Head', 'Span', 'Modifiers'], tablefmt=_tabulate_format)) if show_relations: _print('Relations:') entities = graph['entities'] relations_data = [[ entities[rel['subject']]['head'].lower(), rel['relation'].lower(), entities[rel['object']]['head'].lower() ] for rel in graph['relations']] _print( tabulate.tabulate(relations_data, headers=['Subject', 'Relation', 'Object'], tablefmt=_tabulate_format)) _tabulate_format = tabulate.TableFormat( lineabove=tabulate.Line("+", "-", "+", "+"), linebelowheader=tabulate.Line("|", "-", "+", "|"), linebetweenrows=None, linebelow=tabulate.Line("+", "-", "+", "+"), headerrow=tabulate.DataRow("|", "|", "|"), datarow=tabulate.DataRow("|", "|", "|"), padding=1, with_header_hide=None)
import time import tabulate from six.moves.configparser import ConfigParser from biggraphite.cli import command # Hack to add some more formats. # TODO: Add Graphite support. # TODO: Remove padding. tabulate._table_formats["csv"] = tabulate.TableFormat( lineabove=None, linebelowheader=None, linebetweenrows=None, linebelow=None, headerrow=tabulate.DataRow("", ";", ""), datarow=tabulate.DataRow("", ";", ""), padding=0, with_header_hide=None, ) tabulate.tabulate_formats = list(sorted(tabulate._table_formats.keys())) class Namespaces(object): r"""Helper for namespaces. The config file would look like: ``` [carbon-relay] pattern = carbon\.relay\.*
import click import tabulate import voting import simulate as sim import util import web ### Monkey patching CSV output mode into tabulate: tabulate.tabulate_formats.append("csv") tabulate._table_formats["csv"] = tabulate.TableFormat( lineabove=None, linebelowheader=None, linebetweenrows=None, linebelow=None, headerrow=tabulate.DataRow(begin=u'', sep=u',', end=u''), datarow=tabulate.DataRow(begin=u'', sep=u',', end=u''), padding=0, with_header_hide=None) @click.group() @click.option('--debug/--no-debug', default=False) def cli(debug): """Basic CLI.""" if debug: click.echo('Debug mode is on') @cli.command() @click.option('--votes',
#coding:utf-8 """ Command line interface for Voting. """ import click import tabulate import voting import util import web ### Monkey patching CSV output mode into tabulate: tabulate.tabulate_formats.append("csv") tabulate._table_formats["csv"] = tabulate.TableFormat( lineabove=None, linebelowheader=None, linebetweenrows=None, linebelow=None, headerrow=tabulate.DataRow(begin=u'', sep=u',', end=u''), datarow=tabulate.DataRow(begin=u'', sep=u',', end=u''), padding=0, with_header_hide=None) @click.group() @click.option('--debug/--no-debug', default=False) def cli(debug): """Basic CLI.""" if debug: click.echo('Debug mode is on') @cli.command() @click.option('--divider', required=True, type=click.Choice(voting.DIVIDER_RULES.keys()),
import json from typing import Any, Dict, Union import click import kfp_server_api import tabulate KFP_TABLE_FORMAT = 'custom-simple' tabulate._table_formats.update({ # type: ignore KFP_TABLE_FORMAT: tabulate.TableFormat(lineabove=None, linebelowheader=None, linebetweenrows=None, linebelow=None, headerrow=tabulate.DataRow('', ' ', ''), datarow=tabulate.DataRow('', ' ', ''), padding=0, with_header_hide=['lineabove', 'linebelow']) }) @enum.unique class OutputFormat(enum.Enum): """Enumerated class with the allowed output format constants.""" table = 'table' json = 'json' RUN_STORAGE_STATE_MAP = { kfp_server_api.ApiRunStorageState.AVAILABLE: 'Available',