當前位置: 首頁>>代碼示例>>Python>>正文


Python TextTable.show_header方法代碼示例

本文整理匯總了Python中Shine.CLI.TextTable.TextTable.show_header方法的典型用法代碼示例。如果您正苦於以下問題:Python TextTable.show_header方法的具體用法?Python TextTable.show_header怎麽用?Python TextTable.show_header使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Shine.CLI.TextTable.TextTable的用法示例。


在下文中一共展示了TextTable.show_header方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_sorting

# 需要導入模塊: from Shine.CLI.TextTable import TextTable [as 別名]
# 或者: from Shine.CLI.TextTable.TextTable import show_header [as 別名]
    def test_sorting(self):
        """fill with 2 different sortings"""
        tbl = TextTable(fmt="%4fsname %node")
        tbl.show_header = False
        key = lambda t: t.TYPE
        table_fill(tbl, self._fs, key)
        self.assertEqual(str(tbl), 'c... foo2\nc... foo1\nc... foo3\nc... foo0')

        tbl = TextTable(fmt="%4fsname %node")
        tbl.show_header = False
        key = lambda t: t.DISPLAY_ORDER
        table_fill(tbl, self._fs, key)
        self.assertEqual(str(tbl), 'c... foo0\nc... foo1\nc... foo2\nc... foo3')
開發者ID:kcgthb,項目名稱:lustre-shine,代碼行數:15,代碼來源:DisplayTest.py

示例2: setup_table

# 需要導入模塊: from Shine.CLI.TextTable import TextTable [as 別名]
# 或者: from Shine.CLI.TextTable.TextTable import show_header [as 別名]
def setup_table(options, fmt=None):
    """
    Return a TextTable already setup based on display command line options like
    color and header.
    """
    tbl = TextTable(fmt)
    tbl.color = (options.color == 'auto' and Globals()['color'] == 'auto' \
                      and sys.stdout.isatty()) or \
                (options.color == 'auto' and Globals()['color'] == 'always') \
                or (options.color == 'always')

    tbl.show_header = options.header
    return tbl
開發者ID:kcgthb,項目名稱:lustre-shine,代碼行數:15,代碼來源:Display.py

示例3: test_noheader

# 需要導入模塊: from Shine.CLI.TextTable import TextTable [as 別名]
# 或者: from Shine.CLI.TextTable.TextTable import show_header [as 別名]
 def test_noheader(self):
     """output without header"""
     tbl = TextTable("%one")
     tbl.show_header = False
     tbl.append({'one': 'foo'})
     self.assertEqual(str(tbl), "foo")
開發者ID:kcgthb,項目名稱:lustre-shine,代碼行數:8,代碼來源:TextTableTest.py

示例4: test_support

# 需要導入模塊: from Shine.CLI.TextTable import TextTable [as 別名]
# 或者: from Shine.CLI.TextTable.TextTable import show_header [as 別名]
 def test_support(self):
     """fill with a support filter"""
     tbl = TextTable(fmt="%3type %node %count")
     tbl.show_header = False
     table_fill(tbl, self._fs, None, supports='dev')
     self.assertEqual(str(tbl), 'MGT foo1 1\nMDT foo2 1\nOST foo3 2')
開發者ID:kcgthb,項目名稱:lustre-shine,代碼行數:8,代碼來源:DisplayTest.py

示例5: test_format_group

# 需要導入模塊: from Shine.CLI.TextTable import TextTable [as 別名]
# 或者: from Shine.CLI.TextTable.TextTable import show_header [as 別名]
 def test_format_group(self):
     """fill with group field in format"""
     tbl = TextTable(fmt="%3type %count")
     tbl.show_header = False
     table_fill(tbl, self._fs)
     self.assertEqual(str(tbl), 'MDT 1\nMGT 1\nOST 2\nROU 1')
開發者ID:kcgthb,項目名稱:lustre-shine,代碼行數:8,代碼來源:DisplayTest.py

示例6: _fmt_str

# 需要導入模塊: from Shine.CLI.TextTable import TextTable [as 別名]
# 或者: from Shine.CLI.TextTable.TextTable import show_header [as 別名]
 def _fmt_str(self, fmt, txt):
     tbl = TextTable(fmt)
     tbl.show_header = False
     table_fill(tbl, self._fs)
     self.assertEqual(str(tbl), txt)
開發者ID:kcgthb,項目名稱:lustre-shine,代碼行數:7,代碼來源:DisplayTest.py

示例7: test_padding_noheader

# 需要導入模塊: from Shine.CLI.TextTable import TextTable [as 別名]
# 或者: from Shine.CLI.TextTable.TextTable import show_header [as 別名]
 def test_padding_noheader(self):
     """ignore header labels for padding when disabled"""
     tbl = TextTable("%longer %foo")
     tbl.show_header = False
     tbl.append({'longer': 'short', 'foo': 'data'})
     self.assertEqual(str(tbl), 'short data')
開發者ID:bullxpfs,項目名稱:lustre-shine,代碼行數:8,代碼來源:TextTableTest.py


注:本文中的Shine.CLI.TextTable.TextTable.show_header方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。