本文整理汇总了Python中quodlibet.util.dprint.Colorise.bold方法的典型用法代码示例。如果您正苦于以下问题:Python Colorise.bold方法的具体用法?Python Colorise.bold怎么用?Python Colorise.bold使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类quodlibet.util.dprint.Colorise
的用法示例。
在下文中一共展示了Colorise.bold方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: print_table
# 需要导入模块: from quodlibet.util.dprint import Colorise [as 别名]
# 或者: from quodlibet.util.dprint.Colorise import bold [as 别名]
def print_table(rows, headers, nicks, order):
"""Print a fancy table"""
rows.insert(0, headers)
rows = filter_table(rows, nicks, order)
if not rows:
return
widths = []
for c in range(len(rows[0])):
widths.append(max(map(lambda r: len(r[c]), rows)))
seperator = " %s " % Colorise.gray("|")
format_string = seperator.join(["%%-%ds" % w for w in widths])
header = []
for i, h in enumerate(rows.pop(0)):
header.append(h.ljust(widths[i], " "))
line_width = len(" ".join(header)) + 2
header = [Colorise.bold(h) for h in header]
header_line = " " + (" %s " % Colorise.gray("|")).join(header)
print_(header_line.rstrip())
print_(Colorise.gray("-" * line_width))
for row in rows:
print_(" " + (format_string % tuple(row)).rstrip())
示例2: printErrors
# 需要导入模块: from quodlibet.util.dprint import Colorise [as 别名]
# 或者: from quodlibet.util.dprint.Colorise import bold [as 别名]
def printErrors(self):
succ = self.testsRun - (len(self.errors) + len(self.failures))
v = Colorise.bold("%3d" % succ)
cv = Colorise.green(v) if succ == self.testsRun else Colorise.red(v)
count = self.TEST_RESULTS_WIDTH - self.testsRun
print_((" " * count) + cv)
self.printErrorList('ERROR', self.errors)
self.printErrorList('FAIL', self.failures)
示例3: __init__
# 需要导入模块: from quodlibet.util.dprint import Colorise [as 别名]
# 或者: from quodlibet.util.dprint.Colorise import bold [as 别名]
def __init__(self, test_name, num_tests, out=sys.stdout, failfast=False):
super(Result, self).__init__()
self.out = out
self.failfast = failfast
if hasattr(out, "flush"):
out.flush()
pref = "%s (%d): " % (Colorise.bold(test_name), num_tests)
line = pref + " " * (self.TEST_NAME_WIDTH - len(test_name) - 7 - int(num_tests and log(num_tests, 10) or 0))
print_(line, end="")