Python prettytable 模块,ALL 实例源码

我们从Python开源项目中,提取了以下10个代码示例,用于说明如何使用prettytable.ALL

项目:MCExtractor    作者:platomav    | 项目源码 | 文件源码
def display_sql(cursor,title,header,padd):
    col_names = [cn[0].upper() for cn in cursor.description]
    rows = cursor.fetchall()

    sqlr = prettytable.PrettyTable()
    sqlr.header = header
    sqlr.padding_width = padd
    sqlr.hrules = prettytable.ALL
    sqlr.vrules = prettytable.ALL
    sqlr.title = title
    row_id = -1

    for name in col_names:
        row_id += 1
        sqlr.add_column(name, [row[row_id] for row in rows])

    return sqlr

# MCE Version Header
项目:python-muse    作者:aaroncox    | 项目源码 | 文件源码
def print_permissions(account):
    t = PrettyTable(["Permission", "Threshold", "Key/Account"], hrules=allBorders)
    t.align = "r"
    for permission in ["owner", "active"]:
        auths = []
        # account auths:
        for authority in account[permission]["account_auths"]:
            auths.append("%s (%d)" % (Account(authority[0])["name"], authority[1]))
        # key auths:
        for authority in account[permission]["key_auths"]:
            auths.append("%s (%d)" % (authority[0], authority[1]))
        t.add_row([
            permission,
            account[permission]["weight_threshold"],
            "\n".join(auths),
        ])
    print(t)
项目:uptick    作者:xeroc    | 项目源码 | 文件源码
def print_permissions(account):
    t = PrettyTable(["Permission", "Threshold", "Key/Account"], hrules=allBorders)
    t.align = "r"
    for permission in ["owner", "active"]:
        auths = []
        # account auths:
        for authority in account[permission]["account_auths"]:
            auths.append("%s (%d)" % (Account(authority[0])["name"], authority[1]))
        # key auths:
        for authority in account[permission]["key_auths"]:
            auths.append("%s (%d)" % (authority[0], authority[1]))
        t.add_row([
            permission,
            account[permission]["weight_threshold"],
            "\n".join(auths),
        ])
    click.echo(t)
项目:python-decent    作者:aaroncox    | 项目源码 | 文件源码
def print_permissions(account):
    t = PrettyTable(["Permission", "Threshold", "Key/Account"], hrules=allBorders)
    t.align = "r"
    for permission in ["owner", "active"]:
        auths = []
        # account auths:
        for authority in account[permission]["account_auths"]:
            auths.append("%s (%d)" % (Account(authority[0])["name"], authority[1]))
        # key auths:
        for authority in account[permission]["key_auths"]:
            auths.append("%s (%d)" % (authority[0], authority[1]))
        t.add_row([
            permission,
            account[permission]["weight_threshold"],
            "\n".join(auths),
        ])
    print(t)
项目:Nurevam    作者:Maverun    | 项目源码 | 文件源码
def __init__(self,redis,server,play_objec,data,ctx=None,bot=None):
        #RPG Variable
        self.redis=redis
        self.ctx=ctx
        self.server=server
        self.player = play_objec
        self.player_id=self.player.id
        self.credit= int(data.get("credit",100))
        self.health = int(data.get("hp",100))
        self.total_health = self.health
        self.mana = int(data.get("mana",100))
        self.total_mana = self.mana
        self.data = data
        self.profile="{}:Rpg:{}:".format(server,self.player.id) + "{}"
        self.bot = bot
        self.table = PrettyTable()
        self.table.hrules=prettytable.ALL
        self.table.vertical_char="?"
        self.table.horizontal_char="?"
        self.table.junction_char="?"
        # print(data)
项目:MCExtractor    作者:platomav    | 项目源码 | 文件源码
def mc_table(row_col_names,header,padd) :
    pt = prettytable.PrettyTable(row_col_names)
    pt.header = header # Boolean
    pt.padding_width = padd
    pt.hrules = prettytable.ALL
    pt.vrules = prettytable.ALL
    pt_empty = str(pt)

    return pt,pt_empty
项目:MEAnalyzer    作者:platomav    | 项目源码 | 文件源码
def ext_table(row_col_names,header,padd) :
    pt = prettytable.PrettyTable(row_col_names)
    pt.header = header # Boolean
    pt.padding_width = padd
    pt.hrules = prettytable.ALL
    pt.vrules = prettytable.ALL

    return pt

# Detect DB version
项目:pacdoor    作者:SafeBreach-Labs    | 项目源码 | 文件源码
def _mk_tbl(fields):
    tbl = prettytable.PrettyTable(fields, left_padding_width=1, right_padding_width=1, hrules=prettytable.ALL)
    col_max_width = (terminalsize()[0] / len(fields)) - 5

    for k in tbl.align:
        tbl.align[k] = 'l'

    return (tbl, col_max_width)
项目:sweetshot    作者:AnCh7    | 项目源码 | 文件源码
def print_permissions(account):
    t = PrettyTable(["Permission", "Threshold", "Key/Account"], hrules=allBorders)
    t.align = "r"
    for permission in ["owner", "active", "posting"]:
        auths = []
        for type_ in ["account_auths", "key_auths"]:
            for authority in account[permission][type_]:
                auths.append("%s (%d)" % (authority[0], authority[1]))
        t.add_row([
            permission,
            account[permission]["weight_threshold"],
            "\n".join(auths),
        ])
    print(t)
项目:piston-cli    作者:xeroc    | 项目源码 | 文件源码
def print_permissions(account):
    t = PrettyTable(["Permission", "Threshold", "Key/Account"], hrules=allBorders)
    t.align = "r"
    for permission in ["owner", "active", "posting"]:
        auths = []
        for type_ in ["account_auths", "key_auths"]:
            for authority in account[permission][type_]:
                auths.append("%s (%d)" % (authority[0], authority[1]))
        t.add_row([
            permission,
            account[permission]["weight_threshold"],
            "\n".join(auths),
        ])
    print(t)