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


Python Back.GREEN属性代码示例

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


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

示例1: print_body_state

# 需要导入模块: from colorama import Back [as 别名]
# 或者: from colorama.Back import GREEN [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

示例2: printHighlighted

# 需要导入模块: from colorama import Back [as 别名]
# 或者: from colorama.Back import GREEN [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

示例3: callable_virtualenv

# 需要导入模块: from colorama import Back [as 别名]
# 或者: from colorama.Back import GREEN [as 别名]
def callable_virtualenv():
    """
    Example function that will be performed in a virtual environment.

    Importing at the module level ensures that it will not attempt to import the
    library before it is installed.
    """
    from colorama import Fore, Back, Style
    from time import sleep
    print(Fore.RED + 'some red text')
    print(Back.GREEN + 'and with a green background')
    print(Style.DIM + 'and in dim text')
    print(Style.RESET_ALL)
    for _ in range(10):
        print(Style.DIM + 'Please wait...', flush=True)
        sleep(10)
    print('Finished') 
开发者ID:apache,项目名称:airflow,代码行数:19,代码来源:example_python_operator.py

示例4: print_asm

# 需要导入模块: from colorama import Back [as 别名]
# 或者: from colorama.Back import GREEN [as 别名]
def print_asm(self):
        command = 'u {} l10'.format(self.env.IP)
        try:
            asms = self.execute(command)
        except self.pykd.DbgException as error:
            self.logger.error(error)
        else:
            ip = self.pykd.reg(self.env.IP)
            for line in asms.splitlines()[1:]:
                try:
                    address, opcode, ins = line.split(None, 2)
                except ValueError as error:
                    print(red('{}: {}'.format(line, error)))
                else:
                    line = '{:25} {:25} {}'.format(
                        cyan(address, res=False),
                        yellow(opcode, res=False), red(ins))
                    if int(address, 16) == ip:
                        print(Back.GREEN + line)
                    else:
                        print(line) 
开发者ID:NoviceLive,项目名称:bintut,代码行数:23,代码来源:debuggers.py

示例5: print_highlighted

# 需要导入模块: from colorama import Back [as 别名]
# 或者: from colorama.Back import GREEN [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: copy_nox_bin_files

# 需要导入模块: from colorama import Back [as 别名]
# 或者: from colorama.Back import GREEN [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

示例7: download_tesseract_source

# 需要导入模块: from colorama import Back [as 别名]
# 或者: from colorama.Back import GREEN [as 别名]
def download_tesseract_source(tess_download):
    try:
        os.stat(tess_download.text_content())
        print(Back.GREEN + "Found file {} locally, using instead".format(
            tess_download.text_content()))
        print(Back.GREEN + "Skipping Download" + Style.RESET_ALL)
        return tess_download.text_content()
    except FileNotFoundError:
        pass
    url = domain_tess + tess_download.get('href')
    print(Back.GREEN + Style.BRIGHT + "Downloading {}".format(url))
    response = requests.get(url, stream=True)
    total_size = int(response.headers.get('content-length', 0))
    with tqdm(total=total_size, unit='B', unit_scale=True) as pbar:
        with open(tess_download.text_content(), "wb") as f:
            for data in response.iter_content(chunk_size=1024 * 4):
                f.write(data)
                pbar.update(len(data))
    return tess_download.text_content() 
开发者ID:will7200,项目名称:Yugioh-bot,代码行数:21,代码来源:install.py

示例8: install_tesseract

# 需要导入模块: from colorama import Back [as 别名]
# 或者: from colorama.Back import GREEN [as 别名]
def install_tesseract():
    is_installed, message = check_if_tesseract_installed()
    if is_installed:
        print(Back.GREEN + message + Back.CYAN)
        return
    try:
        os.stat(TESSERACT_SETUP_FILE)
        command_runner(TESSERACT_SETUP_FILE)
    except FileNotFoundError:
        setup_file = download_tesseract()
    try:
        print(Style.BRIGHT + Back.CYAN + 'Make sure to point the installer to the following directory: {}'.format(
            os.path.join(os.getcwd(), 'bin', 'tess')))
        command_runner(setup_file)
    except FileNotFoundError:
        print("Oooo something happened when I downloaded the file, rerun this script") 
开发者ID:will7200,项目名称:Yugioh-bot,代码行数:18,代码来源:install.py

示例9: success

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

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

示例10: execute_command

# 需要导入模块: from colorama import Back [as 别名]
# 或者: from colorama.Back import GREEN [as 别名]
def execute_command(self):
        """
        The web command runs the Scrapple web interface through a simple \
        `Flask <http://flask.pocoo.org>`_ app. 

        When the execute_command() method is called from the \
        :ref:`runCLI() <implementation-cli>` function, it starts of two simultaneous \
        processes : 

        - Calls the run_flask() method to start the Flask app on port 5000 of localhost
        - Opens the web interface on a web browser

        The '/' view of the Flask app, opens up the Scrapple web interface. This \
        provides a basic form, to fill in the required configuration file. On submitting \
        the form, it makes a POST request, passing in the form in the request header. \
        This form is passed to the form_to_json() \
        :ref:`utility function <implementation-utils>`, where the form is converted into \
        the resultant JSON configuration file.

        Currently, closing the web command execution requires making a keyboard interrupt \
        on the command line after the web interface has been closed.

        """
        print(Back.GREEN + Fore.BLACK + "Scrapple Web Interface")
        print(Back.RESET + Fore.RESET)
        p1 = Process(target = self.run_flask)
        p2 = Process(target = lambda : webbrowser.open('http://127.0.0.1:5000'))
        p1.start()
        p2.start() 
开发者ID:AlexMathew,项目名称:scrapple,代码行数:31,代码来源:web.py

示例11: execute_command

# 需要导入模块: from colorama import Back [as 别名]
# 或者: from colorama.Back import GREEN [as 别名]
def execute_command(self):
        """
        The generate command uses `Jinja2 <http://jinja.pocoo.org/>`_ templates \
        to create Python scripts, according to the specification in the configuration \
        file. The predefined templates use the extract_content() method of the \
        :ref:`selector classes <implementation-selectors>` to implement linear extractors \
        and use recursive for loops to implement multiple levels of link crawlers. This \
        implementation is effectively a representation of the traverse_next() \
        :ref:`utility function <implementation-utils>`, using the loop depth to \
        differentiate between levels of the crawler execution. 

        According to the --output_type argument in the CLI input, the results are \
        written into a JSON document or a CSV document. 

        The Python script is written into <output_filename>.py - running this file \
        is the equivalent of using the Scrapple :ref:`run command <command-run>`. 

        """
        print(Back.GREEN + Fore.BLACK + "Scrapple Generate")
        print(Back.RESET + Fore.RESET)
        directory = os.path.join(scrapple.__path__[0], 'templates', 'scripts')
        with open(os.path.join(directory, 'generate.txt'), 'r') as f:
            template_content = f.read()
        template = Template(template_content)
        try:
            with open(self.args['<projectname>'] + '.json', 'r') as f:
                config = json.load(f)
            if self.args['--output_type'] == 'csv':
                from scrapple.utils.config import extract_fieldnames
                config['fields'] = str(extract_fieldnames(config))
            config['output_file'] = self.args['<output_filename>']
            config['output_type'] = self.args['--output_type']
            rendered = template.render(config=config)
            with open(self.args['<output_filename>'] + '.py', 'w') as f:
                f.write(rendered)
            print(Back.WHITE + Fore.RED + self.args['<output_filename>'], \
                  ".py has been created" + Back.RESET + Fore.RESET, sep="")
        except IOError:
            print(Back.WHITE + Fore.RED + self.args['<projectname>'], ".json does not ", \
                  "exist. Use ``scrapple genconfig``." + Back.RESET + Fore.RESET, sep="") 
开发者ID:AlexMathew,项目名称:scrapple,代码行数:42,代码来源:generate.py

示例12: execute_command

# 需要导入模块: from colorama import Back [as 别名]
# 或者: from colorama.Back import GREEN [as 别名]
def execute_command(self):
        """
        The genconfig command depends on predefined `Jinja2 <http://jinja.pocoo.org/>`_ \
        templates for the skeleton configuration files. Taking the --type argument from the \
        CLI input, the corresponding template file is used. 

        Settings for the configuration file, like project name, selector type and URL \
        are taken from the CLI input and using these as parameters, the template is \
        rendered. This rendered JSON document is saved as <project_name>.json.
        
        """
        print(Back.GREEN + Fore.BLACK + "Scrapple Genconfig")
        print(Back.RESET + Fore.RESET)
        directory = os.path.join(scrapple.__path__[0], 'templates', 'configs')
        with open(os.path.join(directory, self.args['--type'] + '.txt'), 'r') as f:
            template_content = f.read()
        print("\n\nUsing the", self.args['--type'], "template\n\n")
        template = Template(template_content)
        settings = {
            'projectname': self.args['<projectname>'],
            'selector_type': self.args['--selector'],
            'url': self.args['<url>'],
            'levels': int(self.args['--levels'])
        }
        rendered = template.render(settings=settings)
        with open(self.args['<projectname>'] + '.json', 'w') as f:
            rendered_data = json.loads(rendered)
            json.dump(rendered_data, f, indent=3)
        print(Back.WHITE + Fore.RED + self.args['<projectname>'], ".json has been created" \
            + Back.RESET + Fore.RESET, sep="") 
开发者ID:AlexMathew,项目名称:scrapple,代码行数:32,代码来源:genconfig.py

示例13: green

# 需要导入模块: from colorama import Back [as 别名]
# 或者: from colorama.Back import GREEN [as 别名]
def green(s):
        """前景色:绿色  背景色:默认"""
        return Fore.GREEN + s 
开发者ID:wechat-tests,项目名称:PyMicroChat,代码行数:5,代码来源:color_console.py

示例14: white_green

# 需要导入模块: from colorama import Back [as 别名]
# 或者: from colorama.Back import GREEN [as 别名]
def white_green(s):
        """前景色:白色  背景色:绿色"""
        return Fore.WHITE + Back.GREEN + s 
开发者ID:wechat-tests,项目名称:PyMicroChat,代码行数:5,代码来源:color_console.py

示例15: print_welcome

# 需要导入模块: from colorama import Back [as 别名]
# 或者: from colorama.Back import GREEN [as 别名]
def print_welcome(self):

        if self.caller == 'main':
            print(Back.GREEN + " ".ljust(79) + Back.BLACK + Fore.GREEN)

            print("      __   ____  __ ______                            ")
            print ("     / /  / __ \/ //_/  _/                            ")
            print ("    / /__/ /_/ / ,< _/ /                              ")
            print ("   /____/\____/_/|_/___/                              ")
            print ("      ________  _____  ____                           ")
            print ("     /  _/ __ \/ ___/ / __/______ ____  ___  ___ ____ ")
            print ("    _/ // /_/ / /__  _\ \/ __/ _ `/ _ \/ _ \/ -_) __/ ")
            print ("   /___/\____/\___/ /___/\__/\_,_/_//_/_//_/\__/_/    ")

            print (Fore.WHITE)
            print ("   Copyright by Florian Roth, Released under the GNU General Public License")
            print ("   Version %s" % __version__)
            print ("  ")
            print ("   DISCLAIMER - USE AT YOUR OWN RISK")
            print ("   Please report false positives via https://github.com/Neo23x0/Loki/issues")
            print ("  ")
            print (Back.GREEN + " ".ljust(79) + Back.BLACK)
            print (Fore.WHITE+''+Back.BLACK)

        else:
            print ("  ")
            print (Back.GREEN + " ".ljust(79) + Back.BLACK + Fore.GREEN)

            print ("  ")
            print ("  LOKI UPGRADER ")

            print ("  ")
            print (Back.GREEN + " ".ljust(79) + Back.BLACK)
            print (Fore.WHITE + '' + Back.BLACK) 
开发者ID:Neo23x0,项目名称:Loki,代码行数:36,代码来源:lokilogger.py


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