當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。