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


Python colorful.red方法代碼示例

本文整理匯總了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) 
開發者ID:greenbone,項目名稱:autohooks,代碼行數:4,代碼來源:terminal.py

示例2: error

# 需要導入模塊: import colorful [as 別名]
# 或者: from colorful import red [as 別名]
def error(self, message: str) -> None:
        self._print_end(message, 'error', cf.red) 
開發者ID:greenbone,項目名稱:autohooks,代碼行數:4,代碼來源:terminal.py

示例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'] 
開發者ID:eerkunt,項目名稱:terraform-compliance,代碼行數:40,代碼來源:defaults.py

示例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)) 
開發者ID:eerkunt,項目名稱:terraform-compliance,代碼行數:31,代碼來源:error_handling.py

示例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') 
開發者ID:timofurrer,項目名稱:colorful,代碼行數:32,代碼來源:colors.py

示例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 
開發者ID:serhii73,項目名稱:place2live,代碼行數:11,代碼來源:utils.py


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