当前位置: 首页>>代码示例>>Python>>正文


Python Back.RED属性代码示例

本文整理汇总了Python中colorama.Back.RED属性的典型用法代码示例。如果您正苦于以下问题:Python Back.RED属性的具体用法?Python Back.RED怎么用?Python Back.RED使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在colorama.Back的用法示例。


在下文中一共展示了Back.RED属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: controller_creatr

# 需要导入模块: from colorama import Back [as 别名]
# 或者: from colorama.Back import RED [as 别名]
def controller_creatr(filename):
    """Name of the controller file to be created"""

    path = os.path.abspath('.') + '/controller'
    if not os.path.exists(path):
        os.makedirs(path)

    # if os.path.isfile(path + )

    file_name = str(filename + '.py')
    if os.path.isfile(path + "/" + file_name):
        click.echo(Fore.WHITE + Back.RED + "ERROR: Controller file exists")
        return
    controller_file = open(os.path.abspath('.') + '/controller/' + file_name, 'w+')
    compose = "from bast import Controller\n\nclass " + filename + "(Controller):\n    pass"
    controller_file.write(compose)
    controller_file.close()
    click.echo(Fore.GREEN + "Controller " + filename + " created successfully") 
开发者ID:moluwole,项目名称:Bast,代码行数:20,代码来源:cli.py

示例2: print_body_state

# 需要导入模块: from colorama import Back [as 别名]
# 或者: from colorama.Back import RED [as 别名]
def print_body_state(self, jarvis, bmi):
        """
        According the bmi number, print_body_state finds out the state of the body
        and prints it to the user using colorama library for some coloring
        """
        print("BMI:", str(bmi))
        if bmi < 16:
            print(Back.RED, " " * 2, Style.RESET_ALL)
            jarvis.say('Severe thinness')
        elif bmi < 18.5:
            print(Back.YELLOW, " " * 2, Style.RESET_ALL)
            jarvis.say('Mild thinness')
        elif bmi < 25:
            print(Back.GREEN, " " * 2, Style.RESET_ALL)
            jarvis.say('Healthy')
        elif bmi < 30:
            print(Back.YELLOW, " " * 2, Style.RESET_ALL)
            jarvis.say('Pre-obese')
        else:
            print(Back.RED, " " * 2, Style.RESET_ALL)
            jarvis.say('Obese') 
开发者ID:sukeesh,项目名称:Jarvis,代码行数:23,代码来源:bmi.py

示例3: print_highlighted

# 需要导入模块: from colorama import Back [as 别名]
# 或者: from colorama.Back import RED [as 别名]
def print_highlighted(line, hl_color=Back.WHITE):
    """
    Print a highlighted line
    """
    try:
        # Highlight positives
        colorer = re.compile(r'([^\s]+) POSITIVES: ([1-9]) ')
        line = colorer.sub(Fore.YELLOW + r'\1 ' + 'POSITIVES: ' + Fore.YELLOW + r'\2 ' + Style.RESET_ALL, line)
        colorer = re.compile(r'([^\s]+) POSITIVES: ([0-9]+) ')
        line = colorer.sub(Fore.RED + r'\1 ' + 'POSITIVES: ' + Fore.RED + r'\2 ' + Style.RESET_ALL, line)
        # Keyword highlight
        colorer = re.compile(r'([A-Z_]{2,}:)\s', re.VERBOSE)
        line = colorer.sub(Fore.BLACK + hl_color + r'\1' + Style.RESET_ALL + ' ', line)
        print(line)
    except Exception as e:
        pass 
开发者ID:Neo23x0,项目名称:munin,代码行数:18,代码来源:munin-host.py

示例4: printHighlighted

# 需要导入模块: from colorama import Back [as 别名]
# 或者: from colorama.Back import RED [as 别名]
def printHighlighted(line, hl_color=Back.WHITE, tag_color=False):
    """
    Print a highlighted line
    """
    if tag_color:
        # Tags
        colorer = re.compile('(HARMLESS|SIGNED|MS_SOFTWARE_CATALOGUE|MSSOFT|SUCCESSFULLY\sCOMMENTED)', re.VERBOSE)
        line = colorer.sub(Fore.BLACK + Back.GREEN + r'\1' + Style.RESET_ALL + '', line)
        colorer = re.compile('(REVOKED|EXPLOIT|CVE-[0-9\-]+|OBFUSCATED|RUN\-FILE)', re.VERBOSE)
        line = colorer.sub(Fore.BLACK + Back.RED + r'\1' + Style.RESET_ALL + '', line)
        colorer = re.compile('(EXPIRED|VIA\-TOR|OLE\-EMBEDDED|RTF|ATTACHMENT|ASPACK|UPX|AUTO\-OPEN|MACROS)', re.VERBOSE)
        line = colorer.sub(Fore.BLACK + Back.YELLOW + r'\1' + Style.RESET_ALL + '', line)
    # Extras
    colorer = re.compile('(\[!\])', re.VERBOSE)
    line = colorer.sub(Fore.BLACK + Back.LIGHTMAGENTA_EX + r'\1' + Style.RESET_ALL + '', line)
    # Add line breaks
    colorer = re.compile('(ORIGNAME:)', re.VERBOSE)
    line = colorer.sub(r'\n\1', line)
    # Standard
    colorer = re.compile('([A-Z_]{2,}:)\s', re.VERBOSE)
    line = colorer.sub(Fore.BLACK + hl_color + r'\1' + Style.RESET_ALL + ' ', line)
    print(line) 
开发者ID:Neo23x0,项目名称:munin,代码行数:24,代码来源:munin_stdout.py

示例5: print_highlighted

# 需要导入模块: from colorama import Back [as 别名]
# 或者: from colorama.Back import RED [as 别名]
def print_highlighted(line, hl_color=Back.WHITE):
    """
    Print a highlighted line
    """
    # Tags
    colorer = re.compile('(HARMLESS|SIGNED|MS_SOFTWARE_CATALOGUE)', re.VERBOSE)
    line = colorer.sub(Fore.BLACK + Back.GREEN + r'\1' + Style.RESET_ALL + ' ', line)
    colorer = re.compile('(SIG_REVOKED)', re.VERBOSE)
    line = colorer.sub(Fore.BLACK + Back.RED + r'\1' + Style.RESET_ALL + ' ', line)
    colorer = re.compile('(SIG_EXPIRED)', re.VERBOSE)
    line = colorer.sub(Fore.BLACK + Back.YELLOW + r'\1' + Style.RESET_ALL + ' ', line)
    # Extras
    colorer = re.compile('(\[!\])', re.VERBOSE)
    line = colorer.sub(Fore.BLACK + Back.CYAN + r'\1' + Style.RESET_ALL + ' ', line)
    # Standard
    colorer = re.compile('([A-Z_]{2,}:)\s', re.VERBOSE)
    line = colorer.sub(Fore.BLACK + hl_color + r'\1' + Style.RESET_ALL + ' ', line)
    print line 
开发者ID:Neo23x0,项目名称:Loki,代码行数:20,代码来源:vt-checker.py

示例6: print_highlighted

# 需要导入模块: from colorama import Back [as 别名]
# 或者: from colorama.Back import RED [as 别名]
def print_highlighted(line, hl_color=Back.WHITE):
    """
    Print a highlighted line
    """
    try:
        # Highlight positives
        colorer = re.compile(r'([^\s]+) POSITIVES: ([1-9]) ')
        line = colorer.sub(Fore.YELLOW + r'\1 ' + 'POSITIVES: ' + Fore.YELLOW + r'\2 ' + Style.RESET_ALL, line)
        colorer = re.compile(r'([^\s]+) POSITIVES: ([0-9]+) ')
        line = colorer.sub(Fore.RED + r'\1 ' + 'POSITIVES: ' + Fore.RED + r'\2 ' + Style.RESET_ALL, line)
        # Keyword highlight
        colorer = re.compile(r'([A-Z_]{2,}:)\s', re.VERBOSE)
        line = colorer.sub(Fore.BLACK + hl_color + r'\1' + Style.RESET_ALL + ' ', line)
        print line
    except Exception, e:
        pass 
开发者ID:Neo23x0,项目名称:Loki,代码行数:18,代码来源:vt-checker-hosts.py

示例7: copy_nox_bin_files

# 需要导入模块: from colorama import Back [as 别名]
# 或者: from colorama.Back import RED [as 别名]
def copy_nox_bin_files():
    adb_file_name = 'nox_adb.exe'
    dll_file_name = 'AdbWinApi.dll'
    path = NOX_BIN
    try:
        os.stat(os.path.join(path, adb_file_name))
        os.stat(os.path.join(path, dll_file_name))
    except FileNotFoundError:
        try:
            path = NOX_BIN_OTHER
            os.stat(os.path.join(path, adb_file_name))
            os.stat(os.path.join(path, dll_file_name))
        except FileNotFoundError:
            print(Fore.RED + """Cannot find the required nox files in either
                    {} or {}, help is requireed""".format(NOX_BIN_OTHER, NOX_BIN))
            return
    copyfile(os.path.join(path, adb_file_name), os.path.join('bin', 'adb.exe'))
    copyfile(os.path.join(path, dll_file_name), os.path.join('bin', dll_file_name))
    print(Back.GREEN + "Copied [{}] into bin folder".format(', '.join([adb_file_name, dll_file_name])) + Back.CYAN) 
开发者ID:will7200,项目名称:Yugioh-bot,代码行数:21,代码来源:install.py

示例8: error

# 需要导入模块: from colorama import Back [as 别名]
# 或者: from colorama.Back import RED [as 别名]
def error(text):
        text = str(text)

        return Back.RED + text + Style.RESET_ALL if Color.is_atty() else text 
开发者ID:PayloadSecurity,项目名称:VxAPI,代码行数:6,代码来源:colors.py

示例9: redtext

# 需要导入模块: from colorama import Back [as 别名]
# 或者: from colorama.Back import RED [as 别名]
def redtext(s):
    """Red text"""
    return Fore.RED + Style.BRIGHT + s + Style.RESET_ALL + Fore.RESET 
开发者ID:abisee,项目名称:cs224n-win18-squad,代码行数:5,代码来源:pretty_print.py

示例10: redback

# 需要导入模块: from colorama import Back [as 别名]
# 或者: from colorama.Back import RED [as 别名]
def redback(s):
    """Red background"""
    return Back.RED + s + Back.RESET 
开发者ID:abisee,项目名称:cs224n-win18-squad,代码行数:5,代码来源:pretty_print.py

示例11: create_new

# 需要导入模块: from colorama import Back [as 别名]
# 或者: from colorama.Back import RED [as 别名]
def create_new(project_name):
    """Name of the project"""
    git_url = "https://github.com/moluwole/Bast_skeleton"
    path = os.path.abspath('.') + "/" + project_name
    if not os.path.exists(path):
        os.makedirs(path)

    click.echo(Fore.GREEN + '    ___  ___   __________')
    click.echo(Fore.GREEN + '  / _ )/ _ | / __/_  __/')
    click.echo(Fore.GREEN + ' / _  / __ |_\ \  / /')
    click.echo(Fore.GREEN + '/____/_/ |_/___/ /_/')

    click.echo(Fore.GREEN + "Creating Project at %s.... " % path)
    click.echo(Fore.GREEN + "Pulling Project Skeleton from Repo")
    try:
        Repo.clone_from(git_url, path)

        click.echo(Fore.GREEN + "Setting up project")

        shutil.rmtree(path + "/.git")

        if not os.path.exists('/.env'):
            shutil.copy(path + '/.env.example', path + '/.env')

        env_file = path + "/.env"
        if not os.path.isfile(env_file):
            shutil.copy('.env.example', '.env')
        call(['panther', 'generate:key', path])

        click.echo(Fore.GREEN + "New Bast Project created at  %s " % path)
    except Exception as e:
        click.echo(Fore.RED + "An error occurred creating a new project. Try Again.\n Reason: {}".format(e)) 
开发者ID:moluwole,项目名称:Bast,代码行数:34,代码来源:cli.py

示例12: color_diff

# 需要导入模块: from colorama import Back [as 别名]
# 或者: from colorama.Back import RED [as 别名]
def color_diff(diff):
    for line in diff:
        if line.startswith('+'):
            yield Fore.GREEN + line + Fore.RESET
        elif line.startswith('-'):
            yield Fore.RED + line + Fore.RESET
        elif line.startswith('^'):
            yield Fore.BLUE + line + Fore.RESET
        else:
            yield line 
开发者ID:scriptotek,项目名称:alma-slipsomat,代码行数:12,代码来源:slipsomat.py

示例13: resolve_conflict

# 需要导入模块: from colorama import Back [as 别名]
# 或者: from colorama.Back import RED [as 别名]
def resolve_conflict(filename, local_content, remote_content, msg):
    print()
    print(
        '\n' + Back.RED + Fore.WHITE + '\n\n  Conflict: ' + msg + '\n' + Style.RESET_ALL
    )

    msg = 'Continue with {}?'.format(filename)
    while True:
        response = input(Fore.CYAN + "%s [y: yes, n: no, d: diff] " % msg + Style.RESET_ALL).lower()[:1]
        if response == 'd':
            show_diff(remote_content, local_content)
        else:
            return response == 'y' 
开发者ID:scriptotek,项目名称:alma-slipsomat,代码行数:15,代码来源:slipsomat.py

示例14: validate

# 需要导入模块: from colorama import Back [as 别名]
# 或者: from colorama.Back import RED [as 别名]
def validate(self):
        if self.text == '':
            return
        try:
            ElementTree.fromstring(self.text)
        except ElementTree.ParseError as e:
            print('%sError: %s contains invalid XML:%s' % (Fore.RED, self.filename or 'The letter', Style.RESET_ALL))
            print(Fore.RED + str(e) + Style.RESET_ALL)
            return 
开发者ID:scriptotek,项目名称:alma-slipsomat,代码行数:11,代码来源:slipsomat.py

示例15: parseLine

# 需要导入模块: from colorama import Back [as 别名]
# 或者: from colorama.Back import RED [as 别名]
def parseLine(line):
    severity = getSeverity(line)

    # Add color based on severity
    if 'severity' not in locals():
        severity = 3

    if severity == 0:
        color = Style.DIM + Fore.WHITE
    elif severity == 1:
        color = Style.NORMAL + Fore.BLUE
    elif severity == 2:
        color = Style.NORMAL + Fore.CYAN
    elif severity == 3:
        color = Style.NORMAL + Fore.WHITE
    elif severity == 4:
        color = Style.NORMAL + Fore.RED
    elif severity == 5:
        color = Style.NORMAL + Fore.BLACK + Back.RED
    else:
        color = Style.NORMAL + Fore.BLACK + Back.YELLOW

    # Replace html tab entity with actual tabs
    line = clearTags(line)
    line = line.replace('&#09;', "\t")
    return color + line + Style.RESET_ALL 
开发者ID:screepers,项目名称:screeps_console,代码行数:28,代码来源:outputparser.py


注:本文中的colorama.Back.RED属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。