本文整理汇总了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')
示例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
示例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")
示例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')
示例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')
示例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)
示例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')