How to use the colorama.Fore.RED function in colorama

To help you get started, we’ve selected a few colorama examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rhinstaller / anaconda / scripts / run_boss_locally.py View on Github external
import tempfile
import glob
import time
import sys
import shutil
import argparse
from gi.repository import Gio

from pyanaconda.dbus import DBusConnection
from pyanaconda.modules.common.constants.services import BOSS, ALL_KICKSTART_MODULES
from pyanaconda.modules.common.errors.kickstart import SplitKickstartError

try:
    from colorama import Fore, Style
    GREEN = Fore.GREEN
    RED = Fore.RED
    RESET = Style.RESET_ALL
except ImportError as e:
    print("#########################################")
    print("Install python3-colorama for nicer output")
    print("#########################################")
    GREEN = ""
    RED = ""
    RESET = ""


# add project top directory to the python paths
top_dir = os.path.dirname(os.path.realpath(__file__))
top_dir = os.path.split(top_dir)[0]
sys.path.insert(0, top_dir)

# add top dir to the PYTHONPATH env var for Boss and modules
github sukeesh / Jarvis / jarviscli / plugins / evaluator.py View on Github external
return sympy.Limit(term, x, to, directory).doit()
        except sympy.SympifyError:
            return 'Error'
        except NotImplementedError:
            return "Sorry, cannot solve..."

    s_split = s.split()
    limit_to = []
    term = ""
    for token in s_split:
        if token[0] == '@':
            if token[1:].isnumeric():
                limit_to.append(int(token[1:]))
            else:
                jarvis.say("Error: {} Not a number".format(
                    token[1:]), Fore.RED)
        else:
            term += token

    term = remove_equals(jarvis, term)
    term = format_expression(term)
    term = solve_y(term)

    x = sympy.Symbol('x')

    # infinity:
    jarvis.say("lim ->  ∞\t= {}".format(try_limit(term,
                                                  x, +sympy.S.Infinity)), Fore.BLUE)
    jarvis.say("lim -> -∞\t= {}".format(try_limit(term,
                                                  x, -sympy.S.Infinity)), Fore.BLUE)

    for limit in limit_to:
github YuLin12345 / Sneaker-Notify / main / mysql_pipeline.py View on Github external
self.conn.commit()
		
        # If item name contain below words. Tweet it.
        keywords = ['ultra boost', 'air jordan', 'jordan retro', 'nmd', 'boost', 'retro', 'flyknit', 'yeezy', 'ronnie', 'fieg', 'pharrel', 'atmos', 'clots', 'mars', 'yard']
		
        if any(keyword in item['name'].encode('utf-8').lower() for keyword in keywords):
		  # Twitter Auth - Tweet the item with date, time, item name, and link.
          # To obtain Twitter CONSUMER and ACCESS keys go to https://apps.twitter.com/
          CONSUMER_KEY = 'PASTE CONSUMER_KEY HERE'
          CONSUMER_SECRET = 'PASTE CONSUMER_SECRET HERE'
          ACCESS_TOKEN_KEY = 'PASTE ACCESS_TOKEN_KEY HERE'
          ACCESS_TOKEN_SECRET = 'PASTE ACCESS_TOKEN_SECRET HERE'
          API = TwitterAPI(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN_KEY, ACCESS_TOKEN_SECRET)
          TEXT_TO_SEND = DATE + " EST " + item['name'] + " " + item['link']
          TWEET = API.request('statuses/update', {'status': TEXT_TO_SEND})
          print(Fore.RED + 'TWEET LOG SUCCESS: ' + DATE + ' EST ' + item['name'] + ' ' + item['link'] + Style.RESET_ALL if TWEET.status_code == 200 else Fore.RED + 'TWEET LOG FAILURE: FAILED TO TWEET' + Style.RESET_ALL)
		  
		  # WebHook for Discord. Comment/Uncomment the line below to enable/disable.
          # requests.post('DISCORD WEBHOOK URL', data={'content': "**" + item['name'] + "**" + "\n" + item['link'] + "\n" + "\n" + "[ATC]: " + item['size'] + "\n" + "------------" + "\n"})
		  
		  # WebHook for Slack. Comment/Uncomment the line below to enable/disable.
          # requests.post('SLACK WEBHOOK URL', json={'text': "*" + item['name'] + "*" + "\n" + item['link'] + "\n" + "\n" + "[ATC]: " + item['size'] + "\n" + "------------" + "\n"}, headers={'Content-Type': 'application/json'})
		  
    except MySQLdb.Error, e:
      # print (Fore.RED + "MYSQL ERROR %d: %s" % (e.args[0], e.args[1] + Style.RESET_ALL))
      
      return item
github Neo23x0 / ReginScanner / regin-scanner.py View on Github external
sha256hash = sha256(filePath)
					if sha256hash in EVIL_HASHES:
						print Fore.RED, "\bREGIN SHA256 Hash MATCH: %s FILE: %s" % ( sha256(filePath), filePath), Fore.WHITE
						compromised = True
					if sha256hash in FALSE_POSITIVES:
						compromised = False
						continue

					# Yara Check -------------------------------------------------------
					if 'rules' in locals():
						try:
							matches = rules.match(filePath)
							if matches:
								for match in matches:
									print Fore.RED, "\bREGIN Yara Rule MATCH: %s FILE: %s" % ( match, filePath), Fore.WHITE
									compromised = True
						except Exception, e:
							if args.debug:
								traceback.print_exc()

				except Exception, e:
					if args.debug:
						traceback.print_exc()
	
	# Return result
	return compromised
github sukeesh / Jarvis / jarviscli / packages / chuck.py View on Github external
def main(self):
    try:
        req = requests.get("https://api.chucknorris.io/jokes/random")
        chuck_json = req.json()

        chuck_fact = chuck_json["value"]
        print_say(chuck_fact, self, Fore.RED)
    except:
        print_say("Looks like Chuck broke the Internet...", self, Fore.RED)
github orf / gping / gping / pinger.py View on Github external
average_ping = sum(filtered_data) / len(filtered_data)
    max_ping = max(filtered_data)

    if max_ping > (average_ping * 2):
        max_ping *= 0.75

    # Scale the chart.
    min_scaled, max_scaled = 0, height - 4

    yellow_zone_idx = round(max_scaled * (100 / max_ping))
    green_zone_idx = round(max_scaled * (50 / max_ping))

    for column, datum in enumerate(data_slice):
        if datum == -1:
            # If it's a timeout then do a red questionmark
            canvas[column + 2, 2] = ("?", Fore.RED)
            continue

        # What percentage of the max_ping are we? 0 -> 1
        percent = min(datum / max_ping, 100) if datum < max_ping else 1
        bar_height = round(max_scaled * percent)

        # Our paint callback, we check if the y value of the point is in any of our zones,
        # if it is paint the appropriate color.
        def _paint(x, y):
            if y <= green_zone_idx:
                return Fore.GREEN
            elif y <= yellow_zone_idx:
                return Fore.YELLOW
            else:
                return Fore.RED  # Danger zone
github microsoft / praxxis / src / praxxis / display / display_error.py View on Github external
def invalid_rule_definition(name):
    """error for trying to import an invalid rule"""
    print("%sThe rule definition for rule %s is invalid. This rule will not be imported." %(Fore.RED, name)) 
github creshal / yspave / yspave / util.py View on Github external
def pick (db, query):
	items = sorted (db.finditems (query, True), key=lambda x:x[0])

	if not items:
		print (fg.RED+'No matches found!'+fg.RESET)
		return None

	if len (items) == 1:
		return items[0]

	headings = [['ID', 'Title', 'Details']]
	headings.extend ((i[:2] + (i[3],) for i in items))
	print_table (headings, True)

	while True:
		try:   idchoice = prompt ('Enter an item ID:\n> ')
		except KeyboardInterrupt: return None
		for i in items:
			if i[0] == idchoice:
				return i
		print (fg.RED+'ID not found.'+fg.RESET)
github pwman3 / pwman3 / pwman / data / nodes.py View on Github external
def __str__(self):
        tags = self.tags
        if tags:
            tags = ", ".join(t.decode() for t in tags)
        else:
            tags = ""

        p = "{entry_title:>{width}} {entry:<{width}}\n".format(
            entry_title=pwman.ui.tools.typeset('Username:', Fore.RED),
            width=10, entry=str(self.username))
        p += "{entry_title:>{width}} {entry:<{width}}\n".format(
            entry_title=pwman.ui.tools.typeset('Password:', Fore.RED),
            width=10, entry=str(self.password))
        p += "{entry_title:>{width}} {entry:<{width}}\n".format(
            entry_title=pwman.ui.tools.typeset('URL:', Fore.RED),
            width=10, entry=str(self.url))
        p += "{entry_title:>{width}} {entry:<{width}}\n".format(
            entry_title=pwman.ui.tools.typeset('Notes:', Fore.RED),
            width=10, entry=str(self.notes))
        p += "{entry_title:>{width}} {entry:<{width}}\n".format(
            entry_title=pwman.ui.tools.typeset('Tags:', Fore.RED),
            width=10,
            entry=tags)
        return p