本文整理汇总了Python中colorful.red方法的典型用法代码示例。如果您正苦于以下问题:Python colorful.red方法的具体用法?Python colorful.red怎么用?Python colorful.red使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类colorful
的用法示例。
在下文中一共展示了colorful.red方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: fail
# 需要导入模块: import colorful [as 别名]
# 或者: from colorful import red [as 别名]
def fail(self, message: str) -> None:
self._print_end(message, 'fail', cf.red)
示例2: error
# 需要导入模块: import colorful [as 别名]
# 或者: from colorful import red [as 别名]
def error(self, message: str) -> None:
self._print_end(message, 'error', cf.red)
示例3: __init__
# 需要导入模块: import colorful [as 别名]
# 或者: from colorful import red [as 别名]
def __init__(self):
self.interactive_mode = self.detect_term()
self.no_failure_tags = ['warning', 'no-failure', 'no-fail', 'info', 'nofailure', 'nofail', 'dontfail']
self.case_sensitive_tags = ['case-sensitive', 'case_sensitive', 'casesensitive', 'case-sensitivity']
self.no_skip_tags = ['noskip', 'no-skip', 'dontskip', 'failonskip', 'fail-on-skip']
if '--no-ansi' in sys.argv or not sys.stdout.isatty():
self.skip_colour = \
self.warning_colour = \
self.failure_colour = \
self.info_colour = \
self.yellow = \
self.red = \
self.green = \
self.blue = \
self.no_coloured_output
self.info_icon = '*'
self.warning_icon = '!'
self.tada = ''
self.icon = '>'
else:
self.skip_colour = colorful.bold_purple
self.failure_colour = colorful.bold_red
self.warning_colour = colorful.bold_yellow
self.info_colour = colorful.bold_blue
self.yellow = colorful.yellow
self.red = colorful.red
self.green = colorful.green
self.blue = colorful.blue
self.info_icon = emojize(':bulb:', use_aliases=True)
self.warning_icon = emojize(':exclamation:', use_aliases=True)
self.tada = emojize(':tada:', use_aliases=True)
self.icon = emojize(':triangular_flag_on_post:', use_aliases=True)
self.types_list = ['resource', 'variable', 'provider', 'data', 'resource that supports tags']
示例4: _process
# 需要导入模块: import colorful [as 别名]
# 或者: from colorful import red [as 别名]
def _process(self):
# Prepare message
msg = []
for msg_index in range(0,len(self.message)):
if self.exit_on_failure is False or self.no_failure is True:
msg_header = '{}{}'.format(self.exception_name,
colorful.bold_white(':')) if msg_index == 0 else ' '*(len(self.exception_name)+1)
msg.append('\t\t{} {}'.format(colorful.bold_red(msg_header), colorful.red(self.message[msg_index])))
else:
msg.append(self.message[msg_index] if msg_index == 0
else '{}{} {} {}'.format("\t"*2,
' '*(len(self.exception_name)+1),
colorful.bold_white(':'),
self.message[msg_index]))
if self.exit_on_failure is False or (self.no_failure is True and msg):
for message in msg:
console_write(message)
if self.no_failure is False:
self._fail_step(self.step_obj.id)
else:
self.step_obj.state = Step.State.SKIPPED
for step in self.step_obj.parent.all_steps:
step.runable = False
return
if self.no_failure is False:
raise self.exception('\n'.join(msg))
示例5: show
# 需要导入模块: import colorful [as 别名]
# 或者: from colorful import red [as 别名]
def show():
"""
Show the modifiers and colors
"""
# modifiers
sys.stdout.write(colorful.bold('bold') + ' ')
sys.stdout.write(colorful.dimmed('dimmed') + ' ')
sys.stdout.write(colorful.italic('italic') + ' ')
sys.stdout.write(colorful.underlined('underlined') + ' ')
sys.stdout.write(colorful.inversed('inversed') + ' ')
sys.stdout.write(colorful.concealed('concealed') + ' ')
sys.stdout.write(colorful.struckthrough('struckthrough') + '\n')
# foreground colors
sys.stdout.write(colorful.red('red') + ' ')
sys.stdout.write(colorful.green('green') + ' ')
sys.stdout.write(colorful.yellow('yellow') + ' ')
sys.stdout.write(colorful.blue('blue') + ' ')
sys.stdout.write(colorful.magenta('magenta') + ' ')
sys.stdout.write(colorful.cyan('cyan') + ' ')
sys.stdout.write(colorful.white('white') + '\n')
# background colors
sys.stdout.write(colorful.on_red('red') + ' ')
sys.stdout.write(colorful.on_green('green') + ' ')
sys.stdout.write(colorful.on_yellow('yellow') + ' ')
sys.stdout.write(colorful.on_blue('blue') + ' ')
sys.stdout.write(colorful.on_magenta('magenta') + ' ')
sys.stdout.write(colorful.on_cyan('cyan') + ' ')
sys.stdout.write(colorful.on_white('white') + '\n')
示例6: text_color
# 需要导入模块: import colorful [as 别名]
# 或者: from colorful import red [as 别名]
def text_color(text, txtType=None):
"""Return colored text based on text type."""
if txtType == text_type.WARNING:
return cf.red(text)
if txtType == text_type.QUESTION:
return cf.magenta(text)
if txtType == text_type.ANSWER:
return cf.green(text)
return text