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


Python terminaltables.AsciiTable方法代码示例

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


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

示例1: print_summary

# 需要导入模块: import terminaltables [as 别名]
# 或者: from terminaltables import AsciiTable [as 别名]
def print_summary(summary):

    print('The output is valid.')
    print('It contained {} messages for {} streams.'.format(
        summary.num_messages(), len(summary.streams)))
    print('')
    print('{:7} schema messages'.format(summary.num_schemas()))
    print('{:7} record messages'.format(summary.num_records()))
    print('{:7} state messages'.format(summary.num_states))
    print('')
    print('Details by stream:')
    headers = [['stream', 'records', 'schemas']]
    rows = [[s.name, s.num_records, s.num_schemas]
            for s in summary.streams.values()]
    data = headers + rows

    table = AsciiTable(data)
    print(table.table) 
开发者ID:singer-io,项目名称:singer-tools,代码行数:20,代码来源:check_tap.py

示例2: print_submission_status

# 需要导入模块: import terminaltables [as 别名]
# 或者: from terminaltables import AsciiTable [as 别名]
def print_submission_status():
    """
    Prints a formatted table of submitted PCAPs
    """
    table = [['Capture MD5',
              'Capture Name',
              'Capture Start',
              'Capture End',
              'Upload Start',
              'Upload End',
              'Size',
              'Queued',
              'Analysis Started',
              'Analysis Completed',
              'Malicious',
              'Link']]
    table.extend(get_submissions_status())
    print(terminaltables.AsciiTable(table).table) 
开发者ID:PacketTotal,项目名称:HoneyBot,代码行数:20,代码来源:interfaces.py

示例3: make_details_table

# 需要导入模块: import terminaltables [as 别名]
# 或者: from terminaltables import AsciiTable [as 别名]
def make_details_table(obj):
        data = (
            ("ID", obj["data"].get("handle")),
            ("Name", obj["data"]["templateHistory"]["params"].get("name")),
            ("Ports", obj["data"]["templateHistory"]["params"].get("ports")),
            ("Project ID", obj["data"]["templateHistory"]["params"].get("project_handle")),
            ("Tuning command", obj["data"]["templateHistory"]["params"].get("tuning_command")),
            ("Worker command", obj["data"]["templateHistory"]["params"].get("worker_command")),
            ("Worker container", obj["data"]["templateHistory"]["params"].get("worker_container")),
            ("Worker count", obj["data"]["templateHistory"]["params"].get("worker_count")),
            ("Worker machine type", obj["data"]["templateHistory"]["params"].get("worker_machine_type")),
            ("Worker use dockerfile", obj["data"]["templateHistory"]["params"].get("worker_use_dockerfile")),
            ("Workspace URL", obj["data"]["templateHistory"]["params"].get("workspaceUrl")),
        )
        ascii_table = terminaltables.AsciiTable(data)
        table_string = ascii_table.table
        return table_string 
开发者ID:Paperspace,项目名称:paperspace-python,代码行数:19,代码来源:hyperparameters.py

示例4: on_time

# 需要导入模块: import terminaltables [as 别名]
# 或者: from terminaltables import AsciiTable [as 别名]
def on_time(self):
        super(ComportVerifyConnTimed, self).on_time()
        desconnect_agents = list()
        table = list([['agent', 'delta']])
        for agent_name, date in self.agent.agents_conn_time.items():
            now = datetime.now()
            delta = now - date
            table.append([agent_name, str(delta.total_seconds())])
            if delta.total_seconds() > 20.0:
                desconnect_agents.append(agent_name)
                self.agent.agentInstance.table.pop(agent_name)
                display_message(self.agent.aid.name, 'Agent {} disconnected.'.format(agent_name))    

        for agent_name in desconnect_agents:
            self.agent.agents_conn_time.pop(agent_name)

        if self.agent.debug:
            display_message(self.agent.aid.name, 'Calculating response time of the agents...')
            table = AsciiTable(table)
            print(table.table) 
开发者ID:grei-ufc,项目名称:pade,代码行数:22,代码来源:new_ams.py

示例5: main

# 需要导入模块: import terminaltables [as 别名]
# 或者: from terminaltables import AsciiTable [as 别名]
def main():
    """Main function."""
    title = 'Jetta SportWagen'

    # AsciiTable.
    table_instance = AsciiTable(TABLE_DATA, title)
    table_instance.justify_columns[2] = 'right'
    print(table_instance.table)
    print()

    # SingleTable.
    table_instance = SingleTable(TABLE_DATA, title)
    table_instance.justify_columns[2] = 'right'
    print(table_instance.table)
    print()

    # DoubleTable.
    table_instance = DoubleTable(TABLE_DATA, title)
    table_instance.justify_columns[2] = 'right'
    print(table_instance.table)
    print() 
开发者ID:Robpol86,项目名称:terminaltables,代码行数:23,代码来源:example1.py

示例6: rooms

# 需要导入模块: import terminaltables [as 别名]
# 或者: from terminaltables import AsciiTable [as 别名]
def rooms(status=None):
    """Lists all Vidyo rooms"""

    room_query = VCRoom.find(type='vidyo')
    table_data = [['ID', 'Name', 'Status', 'Vidyo ID', 'Extension']]

    if status:
        room_query = room_query.filter(VCRoom.status == VCRoomStatus.get(status))

    for room in room_query:
        table_data.append([unicode(room.id), room.name, room.status.name,
                           unicode(room.data['vidyo_id']), unicode(room.vidyo_extension.extension)])

    table = AsciiTable(table_data)
    for col in (0, 3, 4):
        table.justify_columns[col] = 'right'
    print table.table 
开发者ID:indico,项目名称:indico-plugins,代码行数:19,代码来源:cli.py

示例7: agents

# 需要导入模块: import terminaltables [as 别名]
# 或者: from terminaltables import AsciiTable [as 别名]
def agents():
    """Lists the currently active agents"""
    print 'The following LiveSync agents are active:'
    agent_list = LiveSyncAgent.find().order_by(LiveSyncAgent.backend_name, db.func.lower(LiveSyncAgent.name)).all()
    table_data = [['ID', 'Name', 'Backend', 'Initial Export', 'Queue']]
    for agent in agent_list:
        initial = (cformat('%{green!}done%{reset}') if agent.initial_data_exported else
                   cformat('%{yellow!}pending%{reset}'))
        if agent.backend is None:
            backend_title = cformat('%{red!}invalid backend ({})%{reset}').format(agent.backend_name)
        else:
            backend_title = agent.backend.title
        table_data.append([unicode(agent.id), agent.name, backend_title, initial,
                           unicode(agent.queue.filter_by(processed=False).count())])
    table = AsciiTable(table_data)
    table.justify_columns[4] = 'right'
    print table.table
    if not all(a.initial_data_exported for a in agent_list):
        print
        print "You need to perform the initial data export for some agents."
        print cformat("To do so, run "
                      "%{yellow!}indico livesync initial_export %{reset}%{yellow}<agent_id>%{reset} for those agents.") 
开发者ID:indico,项目名称:indico-plugins,代码行数:24,代码来源:cli.py

示例8: do_info

# 需要导入模块: import terminaltables [as 别名]
# 或者: from terminaltables import AsciiTable [as 别名]
def do_info(self, line):
        print("\n \033[1m\033[94m[*]\033[0m Module Info\033[0m\n")
        print(''' This module can be used to generate .EXE loaders and it is
 coded with C#. It support Meterpreter Reverse HTTP,
 Reverse HTTPS staged payloads. The payloads generated by
 this module has two parts. The first part is the real loader
 code generated with character substitution. The second part
 is to compile and run the first part at runtime.''')
        print("\n \033[1m\033[94m[*]\033[0m Module Options\033[0m")
        optionsValues = [
            ["Parameter", "Required", "Value", "Description"],
            ["PROTO", "Yes", mpbProto, "Listener protocol. Accepted: http or https"],
            ["LHOST", "Yes", mpbLhost, "The local listener hostname or IP address"],
            ["LPORT", "Yes", mpbLport, "The local listener port."],
            ["ARCH", "Yes", mpbArch, "Architecture of target system. Accepted: x86 or x64"],
            ["SSIZE", "No", mpbSsize, "If you patched Metasploit insert your patch size"]
        ]
        optTable = AsciiTable(optionsValues)
        optTable.outer_border = False
        optTable.inner_column_border = False
        optTable.justify_columns[1] = "center"
        print("\n" + optTable.table + "\n") 
开发者ID:hlldz,项目名称:SpookFlare,代码行数:24,代码来源:spookflare.py

示例9: listguilds

# 需要导入模块: import terminaltables [as 别名]
# 或者: from terminaltables import AsciiTable [as 别名]
def listguilds(self, ctx):
        if not self.bot.isadmin(ctx.author):
            return await ctx.error('no')
        data = [
            ['Name', 'ID', 'Members', 'Channels', 'Boosts', 'Shard', 'Public']
        ]
        for guild in sorted(self.bot.guilds, key=lambda g: g.member_count, reverse=True):
            data.append([
                shorten(guild.name),
                guild.id,
                format(guild.member_count, ',d'),
                len(guild.channels),
                guild.premium_subscription_count,
                guild.shard_id,
                'PUBLIC' in guild.features
            ])
        table = AsciiTable(data)
        header = table.table.split('\n')[:3]
        paginator = WrappedPaginator(prefix='```\n' + '\n'.join(header), suffix='```', max_size=1950)
        for ln in table.table.split('\n'):
            if ln not in header:
                paginator.add_line(ln)
        interface = PaginatorInterface(ctx.bot, paginator, owner=ctx.author)
        return await interface.send_to(ctx) 
开发者ID:FireDiscordBot,项目名称:bot,代码行数:26,代码来源:guilds.py

示例10: csv2table

# 需要导入模块: import terminaltables [as 别名]
# 或者: from terminaltables import AsciiTable [as 别名]
def csv2table(filename, save_dir=None, output_filename='scores-table.txt'):
    with open(filename, newline='') as f:
        data = list(csv.reader(f))
        table = terminaltables.AsciiTable(data)
        table.inner_row_border = False
        table.CHAR_H_INNER_HORIZONTAL = '-'
        table.CHAR_OUTER_TOP_LEFT = ''
        table.CHAR_OUTER_TOP_RIGHT = ''
        table.CHAR_OUTER_TOP_HORIZONTAL = ''
        table.CHAR_OUTER_TOP_INTERSECT = ''
        table.CHAR_OUTER_BOTTOM_LEFT = '|'
        table.CHAR_OUTER_BOTTOM_RIGHT = '|'
        table.CHAR_OUTER_BOTTOM_HORIZONTAL = ' '
        table.CHAR_OUTER_BOTTOM_INTERSECT = '|'
        table.CHAR_H_OUTER_LEFT_INTERSECT = '|'
        table.CHAR_H_OUTER_RIGHT_INTERSECT = '|'
        output = table.table.lstrip().rstrip()

    if save_dir is None:
        save_dir = os.path.dirname(filename)
    with open(os.path.join(save_dir, output_filename), 'w') as f:
        f.write(output) 
开发者ID:DeepX-inc,项目名称:machina,代码行数:24,代码来源:logger.py

示例11: list_commands

# 需要导入模块: import terminaltables [as 别名]
# 或者: from terminaltables import AsciiTable [as 别名]
def list_commands(ctx):
    table_data = [['Command', 'Description', 'Alias']]
    no_of_columns = len(table_data[0])

    commands = read_commands()
    for cmd, fields in commands.items():
        table_data.append(['$ ' + cmd, fields['desc'], fields['alias']])

    table = AsciiTable(table_data)
    max_width = table.table_width//3

    for i in range(len(table_data) - 1):
        for j in range(no_of_columns):
            data = table.table_data[i + 1][j]
            if len(data) > max_width:
                table.table_data[i + 1][j] = '\n'.join(wrap(data, max_width))

    table.inner_row_border = True
    print(table.table) 
开发者ID:OrkoHunter,项目名称:keep,代码行数:21,代码来源:utils.py

示例12: print_recall_summary

# 需要导入模块: import terminaltables [as 别名]
# 或者: from terminaltables import AsciiTable [as 别名]
def print_recall_summary(recalls,
                         proposal_nums,
                         iou_thrs,
                         row_idxs=None,
                         col_idxs=None,
                         logger=None):
    """Print recalls in a table.

    Args:
        recalls (ndarray): calculated from `bbox_recalls`
        proposal_nums (ndarray or list): top N proposals
        iou_thrs (ndarray or list): iou thresholds
        row_idxs (ndarray): which rows(proposal nums) to print
        col_idxs (ndarray): which cols(iou thresholds) to print
        logger (logging.Logger | str | None): The way to print the recall
            summary. See `mmdet.utils.print_log()` for details. Default: None.
    """
    proposal_nums = np.array(proposal_nums, dtype=np.int32)
    iou_thrs = np.array(iou_thrs)
    if row_idxs is None:
        row_idxs = np.arange(proposal_nums.size)
    if col_idxs is None:
        col_idxs = np.arange(iou_thrs.size)
    row_header = [''] + iou_thrs[col_idxs].tolist()
    table_data = [row_header]
    for i, num in enumerate(proposal_nums[row_idxs]):
        row = [f'{val:.3f}' for val in recalls[row_idxs[i], col_idxs].tolist()]
        row.insert(0, num)
        table_data.append(row)
    table = AsciiTable(table_data)
    print_log('\n' + table.table, logger=logger) 
开发者ID:open-mmlab,项目名称:mmdetection,代码行数:33,代码来源:recall.py

示例13: obtain_quantiles

# 需要导入模块: import terminaltables [as 别名]
# 或者: from terminaltables import AsciiTable [as 别名]
def obtain_quantiles(bn_weights, num_quantile=5):

    sorted_bn_weights, i = torch.sort(bn_weights)
    total = sorted_bn_weights.shape[0]
    quantiles = sorted_bn_weights.tolist()[-1::-total//num_quantile][::-1]
    print("\nBN weights quantile:")
    quantile_table = [
        [f'{i}/{num_quantile}' for i in range(1, num_quantile+1)],
        ["%.3f" % quantile for quantile in quantiles]
    ]
    print(AsciiTable(quantile_table).table)

    return quantiles 
开发者ID:zbyuan,项目名称:pruning_yolov3,代码行数:15,代码来源:prune_utils.py

示例14: print_recall_summary

# 需要导入模块: import terminaltables [as 别名]
# 或者: from terminaltables import AsciiTable [as 别名]
def print_recall_summary(recalls,
                         proposal_nums,
                         iou_thrs,
                         row_idxs=None,
                         col_idxs=None):
    """Print recalls in a table.

    Args:
        recalls(ndarray): calculated from `bbox_recalls`
        proposal_nums(ndarray or list): top N proposals
        iou_thrs(ndarray or list): iou thresholds
        row_idxs(ndarray): which rows(proposal nums) to print
        col_idxs(ndarray): which cols(iou thresholds) to print
    """
    proposal_nums = np.array(proposal_nums, dtype=np.int32)
    iou_thrs = np.array(iou_thrs)
    if row_idxs is None:
        row_idxs = np.arange(proposal_nums.size)
    if col_idxs is None:
        col_idxs = np.arange(iou_thrs.size)
    row_header = [''] + iou_thrs[col_idxs].tolist()
    table_data = [row_header]
    for i, num in enumerate(proposal_nums[row_idxs]):
        row = [
            '{:.3f}'.format(val)
            for val in recalls[row_idxs[i], col_idxs].tolist()
        ]
        row.insert(0, num)
        table_data.append(row)
    table = AsciiTable(table_data)
    print(table.table) 
开发者ID:dingjiansw101,项目名称:AerialDetection,代码行数:33,代码来源:recall.py

示例15: list_resources

# 需要导入模块: import terminaltables [as 别名]
# 或者: from terminaltables import AsciiTable [as 别名]
def list_resources():
    click.echo("# Framework resources")

    click.echo("## SSM Parameters used")
    click.echo(f"- {constants.CONFIG_PARAM_NAME}")
    click.echo(f"- {constants.CONFIG_PARAM_NAME_ORG_IAM_ROLE_ARN}")

    for file in Path(__file__).parent.resolve().glob("*.template.yaml"):
        if 'empty.template.yaml' == file.name:
            continue
        template_contents = Template(open(file, 'r').read()).render()
        template = cfn_tools.load_yaml(template_contents)
        click.echo(f"## Resources for stack: {file.name.split('.')[0]}")
        table_data = [
            ['Logical Name', 'Resource Type', 'Name', ],
        ]
        table = terminaltables.AsciiTable(table_data)
        for logical_name, resource in template.get('Resources').items():
            resource_type = resource.get('Type')
            name = '-'
            type_to_name = {
                'AWS::IAM::Role': 'RoleName',
                'AWS::SSM::Parameter': 'Name',
                'AWS::S3::Bucket': 'BucketName',
                'AWS::CodePipeline::Pipeline': 'Name',
                'AWS::CodeBuild::Project': 'Name',
                'AWS::CodeCommit::Repository': 'RepositoryName',
                'AWS::SNS::Topic': 'TopicName',
                'AWS::SQS::Queue': 'QueueName',
            }

            if type_to_name.get(resource_type) is not None:
                name = resource.get('Properties', {}).get(type_to_name.get(resource_type), 'Not Specified')
                if not isinstance(name, str):
                    name = cfn_tools.dump_yaml(name)

            table_data.append([logical_name, resource_type, name])

        click.echo(table.table)
    click.echo(f"n.b. AWS::StackName evaluates to {constants.BOOTSTRAP_STACK_NAME}") 
开发者ID:awslabs,项目名称:aws-service-catalog-puppet,代码行数:42,代码来源:core.py


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