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


Python tableprint.table方法代码示例

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


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

示例1: dispatch

# 需要导入模块: import tableprint [as 别名]
# 或者: from tableprint import table [as 别名]
def dispatch(cls, ns):
        logging.debug("File Dispatch entered")
        explorer = cls(ns)
        explorer.scan()

        if ns.catalog['format'] == "ascii_table":
            headers = ["Path", "Mime/Type", "pii"]
            tableprint.table(explorer.get_tabular(), headers)
        elif ns.catalog['format'] == "json":
            FileStore.save_schemas(explorer) 
开发者ID:tokern,项目名称:piicatcher,代码行数:12,代码来源:files.py

示例2: output

# 需要导入模块: import tableprint [as 别名]
# 或者: from tableprint import table [as 别名]
def output(cls, ns, explorer):
        if ns.catalog['format'] == "ascii_table":
            headers = ["schema", "table", "column", "has_pii"]
            tableprint.table(explorer.get_tabular(ns.list_all), headers)
        elif ns.catalog['format'] == "json":
            FileStore.save_schemas(explorer)
        elif ns.catalog['format'] == "db":
            DbStore.save_schemas(explorer) 
开发者ID:tokern,项目名称:piicatcher,代码行数:10,代码来源:explorer.py

示例3: get_tabular

# 需要导入模块: import tableprint [as 别名]
# 或者: from tableprint import table [as 别名]
def get_tabular(self, list_all):
        tabular = []
        for schema in self.get_schemas():
            for table in schema.get_children():
                for column in table.get_children():
                    if list_all or column.has_pii():
                        tabular.append([schema.get_name(), table.get_name(),
                                       column.get_name(), column.has_pii()])

        return tabular 
开发者ID:tokern,项目名称:piicatcher,代码行数:12,代码来源:explorer.py

示例4: _get_query

# 需要导入模块: import tableprint [as 别名]
# 或者: from tableprint import table [as 别名]
def _get_query(self, schema_name, table_name, column_list):
        count = self._get_table_count(schema_name, table_name)
        logging.debug("No. of rows in {}.{} is {}".format(schema_name, table_name, count))
        if count < self.small_table_max:
            logging.debug("Choosing a SELECT query as table size is small")
            query = self._get_select_query(schema_name, table_name, column_list)
        else:
            try:
                query = self._get_sample_query(schema_name, table_name, column_list)
                logging.debug("Choosing a SAMPLE query as table size is big")
            except NotImplementedError:
                logging.warning("Sample Row is not implemented for %s" % self.__class__.__name__)
                query = self._get_select_query(schema_name, table_name, column_list)

        return query 
开发者ID:tokern,项目名称:piicatcher,代码行数:17,代码来源:explorer.py

示例5: get_columns

# 需要导入模块: import tableprint [as 别名]
# 或者: from tableprint import table [as 别名]
def get_columns(self, schema_name, table_name):
        self._load_catalog()
        tables = self.get_tables(schema_name)
        for t in tables:
            if t.get_name() == table_name:
                return t.get_children()

        raise ValueError("{} table not found".format(table_name)) 
开发者ID:tokern,项目名称:piicatcher,代码行数:10,代码来源:explorer.py

示例6: test_context

# 需要导入模块: import tableprint [as 别名]
# 或者: from tableprint import table [as 别名]
def test_context():
    """Tests the table context manager"""
    output = StringIO()
    with TableContext('ABC', style='round', width=5, out=output) as t:
        t([1, 2, 3])
        t([4, 5, 6])
    assert output.getvalue() == '╭───────┬───────┬───────╮\n│     A │     B │     C │\n├───────┼───────┼───────┤\n│     1 │     2 │     3 │\n│     4 │     5 │     6 │\n╰───────┴───────┴───────╯\n'  # noqa 
开发者ID:nirum,项目名称:tableprint,代码行数:9,代码来源:test_io.py

示例7: test_table

# 需要导入模块: import tableprint [as 别名]
# 或者: from tableprint import table [as 别名]
def test_table():
    """Tests the table function"""
    output = StringIO()
    table([[1, 2, 3], [4, 5, 6]], 'ABC', style='round', width=5, out=output)
    assert output.getvalue() == '╭───────┬───────┬───────╮\n│     A │     B │     C │\n├───────┼───────┼───────┤\n│     1 │     2 │     3 │\n│     4 │     5 │     6 │\n╰───────┴───────┴───────╯\n'  # noqa

    output = StringIO()
    table(["bar"], "foo", style='grid', width=3, out=output)
    assert output.getvalue() == '+---+---+---+\n|  f|  o|  o|\n+---+---+---+\n|  b|  a|  r|\n+---+---+---+\n'  # noqa 
开发者ID:nirum,项目名称:tableprint,代码行数:11,代码来源:test_io.py


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