当前位置: 首页>>代码示例>>Python>>正文


Python tabulate.tabulate_formats方法代码示例

本文整理汇总了Python中tabulate.tabulate_formats方法的典型用法代码示例。如果您正苦于以下问题:Python tabulate.tabulate_formats方法的具体用法?Python tabulate.tabulate_formats怎么用?Python tabulate.tabulate_formats使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tabulate的用法示例。


在下文中一共展示了tabulate.tabulate_formats方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

# 需要导入模块: import tabulate [as 别名]
# 或者: from tabulate import tabulate_formats [as 别名]
def main():
	output_formats = copy.copy(tabulate.tabulate_formats)
	output_formats.append('json')
	parser = argparse.ArgumentParser(description='syscall_extractor: Extract syscalls from a Windows PE file', conflict_handler='resolve')
	parser.add_argument('-f', '--format', dest='output_format', default='simple', choices=output_formats, help='output format')
	parser.add_argument('pe_files', nargs='+', help='pe files to extract syscall numbers from')
	args = parser.parse_args()

	parsed_files = []
	for pe_file in args.pe_files:
		parsed_files.append(extract_syscalls(os.path.abspath(pe_file)))
	parsed_files = list(pe_file for pe_file in parsed_files if pe_file)
	print("[+] Found {0:,} syscalls".format(sum(len(pe_file['syscalls']) for pe_file in parsed_files)))

	if args.output_format == 'json':
		print(json.dumps(parsed_files, sort_keys=True, indent=2, separators=(',', ': ')))
	else:
		syscalls = []
		for pe_file in parsed_files:
			syscalls.extend(pe_file['syscalls'])
		syscalls = ((syscall[0], hex(syscall[1]), syscall[2], syscall[3]) for syscall in syscalls)
		print(tabulate.tabulate(syscalls, headers=('Number', 'RVA', 'Name', 'Ordinal'), tablefmt=args.output_format))
	return 0 
开发者ID:zeroSteiner,项目名称:mayhem,代码行数:25,代码来源:syscall_extractor.py

示例2: _addCustomTabulateTables

# 需要导入模块: import tabulate [as 别名]
# 或者: from tabulate import tabulate_formats [as 别名]
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"


# runLog makes tables, so make sure this is setup before we initialize the runLog 
开发者ID:terrapower,项目名称:armi,代码行数:19,代码来源:_bootstrap.py

示例3: tables

# 需要导入模块: import tabulate [as 别名]
# 或者: from tabulate import tabulate_formats [as 别名]
def tables():
    """
    Render an ascii table using all possible styles provided by tabulate.
    """
    data = [
        ('text', 'int', 'float'),
        ('Cell 1', 100, 1/3),
        ('Cell 2', -25, 0.001),
        ('Cell 3', 0, 0)
    ]
    lines = []
    for table_fmt in tabulate_formats:
        lines.append(table_fmt)
        lines.append('')
        lines.append(gopher.formatter.tabulate(data, 'firstrow', table_fmt))
        lines.append('\n')
    return gopher.render_menu(*lines) 
开发者ID:michael-lazar,项目名称:flask-gopher,代码行数:19,代码来源:run_server.py

示例4: metric_parser

# 需要导入模块: import tabulate [as 别名]
# 或者: from tabulate import tabulate_formats [as 别名]
def metric_parser():

    """
    Command line parser for the utility.
    """

    parser = argparse.ArgumentParser("Script to generate the available metrics")
    parser.add_argument("-f", "--format",
                        help="Format of the table to be printed out.",
                        choices=tabulate.tabulate_formats, default="rst")
    parser.add_argument("-o", "--out",
                        help="Optional output file",
                        type=argparse.FileType("w"), default=sys.stdout)
    parser.add_argument("-c", "--category",
                        help="Available categories to select from.",
                        default=[], nargs="+",
                        choices=sorted(set(
                            [_ for _ in [getattr(getattr(Transcript, metric), "category", "Descriptive") for metric in
                             Transcript.get_available_metrics()] if _ is not None] + ["Descriptive"])))
    parser.add_argument("metric", nargs="*")
    parser.set_defaults(func=launch)
    return parser 
开发者ID:EI-CoreBioinformatics,项目名称:mikado,代码行数:24,代码来源:metrics.py

示例5: code_parser

# 需要导入模块: import tabulate [as 别名]
# 或者: from tabulate import tabulate_formats [as 别名]
def code_parser():

    """
    Command line parser for the utility.
    """

    parser = argparse.ArgumentParser("Script to generate the available class codes.")
    parser.add_argument("-f", "--format", choices=tabulate.tabulate_formats, default="rst")
    parser.add_argument("-c", "--category", nargs="+", default=[],
                        choices=list(set(_.category for _ in class_codes.codes.values())))
    parser.add_argument("-o", "--out", type=argparse.FileType("w"), default=sys.stdout)
    parser.add_argument("code", nargs="*", help="Codes to query.",
                        default=[],
                        choices=[[]] + list(class_codes.codes.keys()))
    parser.set_defaults(func=launch)
    return parser 
开发者ID:EI-CoreBioinformatics,项目名称:mikado,代码行数:18,代码来源:class_codes.py

示例6: test_tabulate_formats

# 需要导入模块: import tabulate [as 别名]
# 或者: from tabulate import tabulate_formats [as 别名]
def test_tabulate_formats():
    "API: tabulate_formats is a list of strings" ""
    supported = tabulate_formats
    print("tabulate_formats = %r" % supported)
    assert type(supported) is list
    for fmt in supported:
        assert type(fmt) is type("")  # noqa 
开发者ID:astanin,项目名称:python-tabulate,代码行数:9,代码来源:test_api.py

示例7: test_tabulate_formats

# 需要导入模块: import tabulate [as 别名]
# 或者: from tabulate import tabulate_formats [as 别名]
def test_tabulate_formats():
    "API: tabulate_formats is a list of strings"""
    supported = tabulate_formats
    print("tabulate_formats = %r" % supported)
    assert type(supported) is list
    for fmt in supported:
        assert type(fmt) is type("") 
开发者ID:gregbanks,项目名称:python-tabulate,代码行数:9,代码来源:test_api.py

示例8: output_options

# 需要导入模块: import tabulate [as 别名]
# 或者: from tabulate import tabulate_formats [as 别名]
def output_options(fn):
    for decorator in reversed(
        (
            click.option(
                "--nl",
                help="Output newline-delimited JSON",
                is_flag=True,
                default=False,
            ),
            click.option(
                "--arrays",
                help="Output rows as arrays instead of objects",
                is_flag=True,
                default=False,
            ),
            click.option("-c", "--csv", is_flag=True, help="Output CSV"),
            click.option("--no-headers", is_flag=True, help="Omit CSV headers"),
            click.option("-t", "--table", is_flag=True, help="Output as a table"),
            click.option(
                "-f",
                "--fmt",
                help="Table format - one of {}".format(
                    ", ".join(tabulate.tabulate_formats)
                ),
                default="simple",
            ),
            click.option(
                "--json-cols",
                help="Detect JSON cols and output them as JSON, not escaped strings",
                is_flag=True,
                default=False,
            ),
        )
    ):
        fn = decorator(fn)
    return fn 
开发者ID:simonw,项目名称:sqlite-utils,代码行数:38,代码来源:cli.py

示例9: add_arguments

# 需要导入模块: import tabulate [as 别名]
# 或者: from tabulate import tabulate_formats [as 别名]
def add_arguments(self, parser):
        """Add custom arguments.

        See command.CommandBase.
        """
        command.add_sharding_arguments(parser)
        parser.add_argument(
            "-c", "--conf", help="Configuration file for namespaces", dest="conf"
        )

        formats = tabulate.tabulate_formats
        formats.append("graphite")
        parser.add_argument(
            "-f", "--format", help="Format: %s" % ", ".join(formats), dest="fmt"
        )
        parser.add_argument(
            "--carbon",
            help="Carbon host:port to send points to when using graphite output."
        )
        parser.add_argument(
            "--prefix",
            help="Prefix to add to every section name.",
            default='',
        )
        self._n_metrics = collections.defaultdict(int)
        self._n_points = collections.defaultdict(int) 
开发者ID:criteo,项目名称:biggraphite,代码行数:28,代码来源:command_stats.py


注:本文中的tabulate.tabulate_formats方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。