s3_commandhelper.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:orca 作者: bdastur 项目源码 文件源码
def display_s3_summary_table(self, bucket_summary):
        '''
        Display S3 Summary in Tabular output.
        '''
        # Setup table header.
        header = ["Profile", "Total Bucket Count"]
        table = prettytable.PrettyTable(header)

        for profile in bucket_summary.keys():
            row = [profile, bucket_summary[profile]['total_count']]
            table.add_row(row)

        print table

        # Setup table header (loc constraint)
        header = ["Location", "Bucket Count"]
        table = prettytable.PrettyTable(header)

        for profile in bucket_summary.keys():
            row = ["-"*40, "-"*20]
            table.add_row(row)
            row = [profile, " "]
            table.add_row(row)
            row = ["-"*40, "-"*20]
            table.add_row(row)

            locs = bucket_summary[profile]['locs']
            for loc in locs.keys():
                row = [loc, bucket_summary[profile]['locs'][loc]]
                table.add_row(row)
            row = [" ", " "]
            table.add_row(row)

        print table
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号