python类Fore()的实例源码

apk_operations.py 文件源码 项目:nojs 作者: chrisdickinson 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def _Colorize(color, text):
  # |color| as a string to avoid pylint's no-member warning :(.
  # pylint: disable=no-member
  return getattr(colorama.Fore, color) + text + colorama.Fore.RESET
cli.py 文件源码 项目:therapist 作者: rehandalal 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def output(message, **kwargs):
    def repl(match):  # pragma: no cover
        attr = match.group(0)[2:-1].upper()
        if hasattr(colorama.Fore, attr):
            return getattr(colorama.Fore, attr)
        elif hasattr(colorama.Style, attr):
            return getattr(colorama.Style, attr)
        else:
            return match.group(0)

    message, count = re.subn('#{(.+?)}', repl, message)
    message = colorama.Style.RESET_ALL + message + colorama.Style.RESET_ALL
    print_(message, **kwargs)
crayons.py 文件源码 项目:pipenv 作者: pypa 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def color_str(self):
        style = 'BRIGHT' if self.bold else 'NORMAL'
        c = '%s%s%s%s%s' % (getattr(colorama.Fore, self.color), getattr(colorama.Style, style), self.s, colorama.Fore.RESET, getattr(colorama.Style, 'NORMAL'))

        if self.always_color:
            return c
        elif sys.stdout.isatty() and not DISABLE_COLOR:
            return c
        else:
            return self.s
utils.py 文件源码 项目:deb-python-gabbi 作者: openstack 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def _colorize(color, message):
    """Add a color to the message."""
    try:
        return getattr(colorama.Fore, color) + message + colorama.Fore.RESET
    except AttributeError:
        return message
common.py 文件源码 项目:kiwi 作者: alpha1e0 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def colorize(cls, msg, color):
        '''
        get red string
        '''
        cls.tostr(msg)

        if color.lower() in ['red','yellow','blue','green']:
            cstr = getattr(Fore, color.upper())
            return cstr + msg + Style.RESET_ALL
        else:
            return msg
choose_color.py 文件源码 项目:urnote 作者: urnote 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def display_all_fore():
    """?????????Fore?style??"""
    init()
    _display(Fore)
color.py 文件源码 项目:grako 作者: apalala 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def init():
    try:
        import colorama

        global Fore, Back, Style
        Fore = colorama.Fore
        Back = colorama.Back
        Style = colorama.Style
        colorama.Fore
    except ImportError:
        pass


问题


面经


文章

微信
公众号

扫码关注公众号