How to use the colorama.deinit 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 contains-io / rcli / tests / test_display.py View on Github external
def _colorama(*args, **kwargs):
    """Temporarily enable colorama."""
    colorama.init(*args, **kwargs)
    try:
        yield
    finally:
        colorama.deinit()
github Azure / azure-cli / src / azure-cli-core / azure / cli / core / commands / __init__.py View on Github external
implicit_preview_info = resolve_preview_info(self.cli_ctx, ' '.join(path_comps))
                del path_comps[-1]

            if implicit_preview_info:
                preview_kwargs = implicit_preview_info.__dict__.copy()
                preview_kwargs['object_type'] = 'command'
                del preview_kwargs['_get_tag']
                del preview_kwargs['_get_message']
                previews.append(ImplicitPreviewItem(**preview_kwargs))

        colorama.init()
        for d in deprecations:
            print(d.message, file=sys.stderr)
        for p in previews:
            print(p.message, file=sys.stderr)
        colorama.deinit()
github Azure / azure-devops-cli-extension / azure-devops / azext_devops / dev / pipelines / pipeline_create_helpers / pipelines_resource_provider.py View on Github external
def poll_connection_ready(organization, project, connection_id):
    import colorama
    colorama.init()
    import humanfriendly
    import time
    with humanfriendly.Spinner(label="Checking resource readiness") as spinner:
        se_client = get_service_endpoint_client(organization)
        while True:
            spinner.step()
            time.sleep(0.5)
            service_endpoint = se_client.get_service_endpoint_details(project, connection_id)
            if service_endpoint.is_ready:
                break
    colorama.deinit()
github nccgroup / GTFOBLookup / gtfoblookup.py View on Github external
def exit():
    """Exits the program"""
    colorama.deinit()
    sys.exit()
github gavrilaf / chuck / ext-tools / sc-copy / main.py View on Github external
src = args[""]
        dest = args[""]
        copy_scenarios(src, dest)
    elif args["new"]:
        src = args[""]
        dest = args[""]
        create_scenario(src, dest)
    else:
        print(Fore.RED + "Unknown mode")


if __name__ == "__main__":
    colorama.init()
    args = docopt(__doc__, version='v0.1')
    main(args)
    colorama.deinit()
github h2oai / h2o-3 / h2o-py / h2o / demos.py View on Github external
_h2o_init = h2o.init
    if testing:
        h2o.init = lambda *args, **kwargs: None

    # Run the test
    try:
        body_fn(controller)
        print("\n" + Fore.CYAN + "---- End of Demo ----" + Style.RESET_ALL)
    except (StopExecution, KeyboardInterrupt):
        print("\n" + Fore.RED + "---- Demo aborted ----" + Style.RESET_ALL)

    # Clean-up
    if testing:
        h2o.init = _h2o_init
    print()
    colorama.deinit()
github lancaster-university / codal / utils / merge_hex.py View on Github external
def fail(message):
    print(fail_color + message)

    # If we've included ANSI color in output, reset the output style
    if fail_color:
        print(Fore.RESET)
        deinit()

    return 1
github sarugaku / vistir / src / vistir / spin.py View on Github external
_text = kwargs.pop("text", "Running...")
        kwargs["text"] = start_text if start_text is not None else _text
        kwargs["sigmap"] = sigmap
        kwargs["spinner"] = getattr(Spinners, spinner_name, "")
        write_to_stdout = kwargs.pop("write_to_stdout", True)
        self.stdout = kwargs.pop("stdout", sys.stdout)
        self.stderr = kwargs.pop("stderr", sys.stderr)
        self.out_buff = StringIO()
        self.write_to_stdout = write_to_stdout
        self.is_dummy = bool(yaspin is None)
        self._stop_spin = None  # type: Optional[threading.Event]
        self._hide_spin = None  # type: Optional[threading.Event]
        self._spin_thread = None  # type: Optional[threading.Thread]
        super(VistirSpinner, self).__init__(*args, **kwargs)
        if DISABLE_COLORS:
            colorama.deinit()
github h2oai / h2o-3 / h2o-py / h2o / utils / debugging.py View on Github external
indent = " " * (len(exc_type.__name__) + 2)
    for i in range(i0, 0, -1):
        co = frames[i].f_code
        func = _find_function_from_code(frames[i - 1], co)
        fullname = _get_method_full_name(func) if func else "???." + co.co_name
        highlight = getattr(exc_value, "var_name", None) if i == i0 else None
        args_str = _get_args_str(func, highlight=highlight)
        indent_len = len(exc_type.__name__) + len(fullname) + 6
        line = Fore.LIGHTBLACK_EX + indent + ("in " if i == i0 else "   ")
        line += (Fore.CYAN + fullname + Fore.LIGHTBLACK_EX if i == i0 else fullname) + "("
        line += _wrap(args_str + ") line %d" % frames[i].f_lineno, indent=indent_len)
        line += Style.RESET_ALL
        err(line)
    err()

    colorama.deinit()