How to use the colorama.Style.RESET_ALL 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 ArturSpirin / test_junkie / test_junkie / cli / utils.py View on Github external
def format_string(value, color):
        Color.__initialize()
        colors = {"red": Fore.RED, "green": Fore.GREEN, "yellow": Fore.YELLOW, "blue": Fore.BLUE}
        return "{style}{color}{value}{reset}".format(style=Style.BRIGHT, color=colors[color],
                                                     value=value, reset=Style.RESET_ALL)
github ray-project / ray / python / ray / worker.py View on Github external
continue
            num_consecutive_messages_received += 1

            data = json.loads(ray.utils.decode(msg["data"]))

            def color_for(data):
                if data["pid"] == "raylet":
                    return colorama.Fore.YELLOW
                else:
                    return colorama.Fore.CYAN

            if data["ip"] == localhost:
                for line in data["lines"]:
                    print("{}{}(pid={}){} {}".format(
                        colorama.Style.DIM, color_for(data), data["pid"],
                        colorama.Style.RESET_ALL, line))
            else:
                for line in data["lines"]:
                    print("{}{}(pid={}, ip={}){} {}".format(
                        colorama.Style.DIM, color_for(data), data["pid"],
                        data["ip"], colorama.Style.RESET_ALL, line))

            if (num_consecutive_messages_received % 100 == 0
                    and num_consecutive_messages_received > 0):
                logger.warning(
                    "The driver may not be able to keep up with the "
                    "stdout/stderr of the workers. To avoid forwarding logs "
                    "to the driver, use 'ray.init(log_to_driver=False)'.")
    except (OSError, redis.exceptions.ConnectionError) as e:
        logger.error("print_logs: {}".format(e))
    finally:
        # Close the pubsub client to avoid leaking file descriptors.
github tenable / csup / csup.py View on Github external
def color(color, msg, colored=True):
    if colored:
        return '{}{}{}'.format(color, msg, Style.RESET_ALL)
    else:
        return msg
github pykong / copier / voodoo / helpers.py View on Github external
def format_message(action, msg='', color='', on_color='', bright=True, indent=12):
    """Format message."""
    action = action.rjust(indent, ' ')
    color = getattr(Fore, color.upper(), '')
    on_color = getattr(Back, on_color.upper(), '')
    style = Style.BRIGHT if bright else Style.DIM if bright is False else ''

    return ''.join([
        color, on_color, style,
        action,
        Fore.RESET, Back.RESET, Style.RESET_ALL,
        '  ',
        msg,
    ])
github krischer / LASIF / lasif / scripts / lasif_cli.py View on Github external
"""
    parser.add_argument("iteration_name", help="name of the iteration")
    args = parser.parse_args(args)

    iteration = args.iteration_name

    comm = _find_project_comm_mpi(".", args.read_only_caches)

    events = comm.events.list()

    for _i, event in enumerate(events):
        if MPI.COMM_WORLD.rank == 0:
            print("\n{green}"
                  "==========================================================="
                  "{reset}".format(green=colorama.Fore.GREEN,
                                   reset=colorama.Style.RESET_ALL))
            print("Starting window selection for event %i of %i..." % (
                  _i + 1, len(events)))
            print("{green}"
                  "==========================================================="
                  "{reset}\n".format(green=colorama.Fore.GREEN,
                                     reset=colorama.Style.RESET_ALL))
        MPI.COMM_WORLD.barrier()
        comm.actions.select_windows(event, iteration)
github DFC302 / subseeker / subseeker_core / searchmodes.py View on Github external
import os
import sys
import concurrent.futures
import subseeker_core.useragents
import platform
import subprocess
from subseeker_core.options import options
from colorama import Fore, Style

class SubSeeker():
	GREEN = Fore.GREEN
	RED = Fore.RED
	YELLOW = Fore.YELLOW
	BLUE = Fore.BLUE
	WHITE = Fore.WHITE
	RESET = Style.RESET_ALL

	if options().domain:
		# domain_regex = r"([^\.]*.(?=com).+)"
		domain_regex = r"[a-zA-Z0-9].*"
		domain = re.findall(domain_regex, options().domain)[0]

	# if user uses api, search for config file, that way no matter what directory user is in,
	# subseeker can find config file.
	if options().api:

		if options().verbose:
			print(f"\n{YELLOW}[!] Looking for config file containing API credentials...{RESET}")
		
		for root, dirs, files in os.walk("/"):
			filename = "subseeker_config.json"
			if filename in files:
github machinalis / iepy / scripts / print_results.py View on Github external
csv_file = opts['']
    evidence = Knowledge.load_from_csv(csv_file)

    for nr, (e, score) in enumerate(evidence.items()):
        fact = e.colored_fact()
        fact_line = []
        if opts['--with-line-number']:
            fact_line.append(str(nr+1))
        if opts['--with-score']:
            if score == 0:
                score_color = Back.YELLOW
            elif score == 1:
                score_color = Back.MAGENTA
            else:
                score_color = Back.CYAN
            colored_score = u''.join([score_color, str(score), Style.RESET_ALL])
            fact_line.append(colored_score)
        fact_line.append(u'FACT: {}'.format(fact))
        print(u'\n' + u'\t'.join(fact_line))
        if e.segment:
            text = e.colored_text()
            print(u'  SEGMENT: {}'.format(text))
github trek10inc / awsume / awsume / awsumepy.py View on Github external
def safe_print(text, end=None, color=Fore.RESET, style=Style.RESET_ALL): # pragma: no cover
    """A simple wrapper around the builting `print` function.
    It should always print to stderr to not interfere with the shell wrappers.
    It should not use any colors or styles when running on Windows.

    Parameters
    ----------
    - text - the text to print
    - end - the character to use in the end
    - color - the colorama color to use when printing
    - style - the style to use when printing
    """
    old_stderr = sys.stderr
    sys.stderr = sys.__stderr__
    if not AWSUME_OPTIONS.get('colors') or os.name == 'nt':
        print(text, file=sys.stderr, end=end)
    else:
github grappa-py / grappa / grappa / reporters / code.py View on Github external
return buf

            # Calculate indentation and line head space for aligment
            space = calculate_space(line)
            indent = ' ' * CodeReporter.INDENT_SPACES

            # Line head
            head = '{}{}{}| {}'.format(
                Fore.GREEN if config.use_colors else '',
                space, line,
                Style.RESET_ALL if config.use_colors else ''
            )

            if line == trace.lineno:
                if config.use_colors:
                    head += Fore.RED + '> ' + Style.RESET_ALL
                else:
                    head += '> '
            else:
                head += '  '

            buf.append(indent + head + code)
            return buf