Python colorama 模块,deinit() 实例源码

我们从Python开源项目中,提取了以下23个代码示例,用于说明如何使用colorama.deinit()

项目:foliant    作者:foliant-docs    | 项目源码 | 文件源码
def main():
    """Handles command-line params and runs the respective core function."""

    colorama.init(autoreset=True)

    args = docopt(__doc__, version="Foliant %s (Python)" % foliant_version)

    if args["build"] or args["make"]:
        result = builder.build(args["<target>"], args["--path"])

    elif args["upload"] or args["up"]:
        result = uploader.upload(args["<document>"])

    print("---")
    print(Fore.GREEN + "Result: %s" % result)

    colorama.deinit()
项目:Stitch    作者:nathanlopez    | 项目源码 | 文件源码
def print_yellow(string):
    if windows_client(): reinit()
    print (Fore.YELLOW + Style.BRIGHT + string + Style.RESET_ALL)
    if windows_client(): deinit()
项目:Stitch    作者:nathanlopez    | 项目源码 | 文件源码
def print_blue(string):
    if windows_client(): reinit()
    print (Fore.BLUE + Style.BRIGHT + string + Style.RESET_ALL)
    if windows_client(): deinit()
项目:Stitch    作者:nathanlopez    | 项目源码 | 文件源码
def print_cyan(string):
    if windows_client(): reinit()
    print (Fore.CYAN + Style.BRIGHT + string + Style.RESET_ALL)
    if windows_client(): deinit()
项目:Stitch    作者:nathanlopez    | 项目源码 | 文件源码
def print_green(string):
    if windows_client(): reinit()
    print (Fore.GREEN + Style.BRIGHT + string + Style.RESET_ALL)
    if windows_client(): deinit()
项目:Stitch    作者:nathanlopez    | 项目源码 | 文件源码
def print_red(string):
    if windows_client(): reinit()
    print (Fore.RED + Style.BRIGHT + string + Style.RESET_ALL)
    if windows_client(): deinit()
项目:ronin    作者:tliron    | 项目源码 | 文件源码
def _restore_terminal():
    colorama.deinit()
项目:BrundleFuzz    作者:carlosgprado    | 项目源码 | 文件源码
def stop(self):
        self.m_info("Restoring terminal...")
        colorama.deinit()
项目:BrundleFuzz    作者:carlosgprado    | 项目源码 | 文件源码
def stop(self):
        self.m_info("Restoring terminal...")
        colorama.deinit()
项目:BrundleFuzz    作者:carlosgprado    | 项目源码 | 文件源码
def stop(self):
        self.m_info("Restoring terminal...")
        colorama.deinit()
项目:MCExtractor    作者:platomav    | 项目源码 | 文件源码
def mce_exit(code=0) :
    if not param.mce_extr : input("\nPress enter to exit")
    try :
        c.close()
        conn.close() # Close DB connection
    except :
        pass
    colorama.deinit() # Stop Colorama
    sys.exit(code)
项目:MCExtractor    作者:platomav    | 项目源码 | 文件源码
def show_exception_and_exit(exc_type, exc_value, tb) :
    print(col_r + '\nError: MCE just crashed, please report the following:\n')
    traceback.print_exception(exc_type, exc_value, tb)
    input(col_e + '\nPress enter to exit')
    colorama.deinit() # Stop Colorama
    sys.exit(-1)
项目:MEAnalyzer    作者:platomav    | 项目源码 | 文件源码
def show_exception_and_exit(exc_type, exc_value, tb) :
    print(col_r + '\nError: MEA just crashed, please report the following:\n')
    traceback.print_exception(exc_type, exc_value, tb)
    input(col_e + "\nPress enter to exit")
    colorama.deinit() # Stop Colorama
    sys.exit(-1)

# Execute final actions
项目:MEAnalyzer    作者:platomav    | 项目源码 | 文件源码
def mea_exit(code=0) :
    colorama.deinit() # Stop Colorama
    if param.extr_mea or param.print_msg : sys.exit(code)
    input("\nPress enter to exit")
    sys.exit(code)

# Huffman11 not found
项目:rcli    作者:contains-io    | 项目源码 | 文件源码
def _colorama(*args, **kwargs):
    """Temporarily enable colorama."""
    colorama.init(*args, **kwargs)
    try:
        yield
    finally:
        colorama.deinit()
项目:incubator-ariatosca    作者:apache    | 项目源码 | 文件源码
def _restore_terminal():
    colorama.deinit()
项目:chalktalk_docs    作者:loremIpsum1771    | 项目源码 | 文件源码
def nocolor():
    if sys.platform == 'win32' and colorama is not None:
        colorama.deinit()
    codes.clear()
项目:Jasper    作者:tylerlaberge    | 项目源码 | 文件源码
def __init__(self, force_ansi=True, verbosity_level=0):
        """
        Initialize a new Display object.

        :param force_ansi: Flag for whether or not to force the display to use ansi escape sequences. default is True.
        :param verbosity_level:  The verbosity level for the display to use. default is 0, maxes out at 2.
        """
        self.display_string = ''
        self.indentation_level = 0
        self.verbosity_level = verbosity_level
        self.colored = True
        self.force_ansi = force_ansi
        colorama.deinit()
项目:Jasper    作者:tylerlaberge    | 项目源码 | 文件源码
def display(self):
        """
        Print the prepared data to the screen.
        """
        if sys.platform == 'win32' and not self.force_ansi:
            colorama.init()
        print(self.display_string)
        colorama.deinit()
项目:goal    作者:victorskl    | 项目源码 | 文件源码
def tearDown(self):
        colorama.deinit()
项目:tfs-pullrequest    作者:yuriclaure    | 项目源码 | 文件源码
def print_encoded(string, nl=True):
        end = "\n" if nl else ""
        if sys.stdout.encoding == "cp1252":
            print(string.encode("UTF-8").decode("ISO-8859-1"), end=end, flush=True)
        else:
            colorama.init()
            print(string, end=end, flush=True)
            colorama.deinit()
项目:tsaotun    作者:qazbnm456    | 项目源码 | 文件源码
def eval_command(self, args):
        self.preprocess(args)
        line_n = 0
        try:
            for line in self.client.pull(**args):
                for iterElement in list(json_iterparse(line)):
                    line_n = self.output(iterElement, args)
        except KeyboardInterrupt:
            put_cursor(0, MINY + OFFSET + line_n)
            colorama.deinit()
            raise KeyboardInterrupt
        put_cursor(0, MINY + OFFSET + line_n)
        colorama.deinit()
        self.settings[self.name] = "\r"
项目:tsaotun    作者:qazbnm456    | 项目源码 | 文件源码
def eval_command(self, args):
        try:
            stats = []
            containers = args["containers"]
            del args["containers"]
            args["decode"] = True
            for container in containers:
                args["container"] = container
                stats.append(self.client.stats(**args))
                """
                for line in self.client.stats(**args):
                    for iterElement in list(json_iterparse.json_iterparse(line)):
                        # self.output(iterElement, args)
                        print iterElement
                """
            clear()
            put_cursor(0, 0)
            print pprint_things(
                "CONTAINER\tCPU %\tMEM USAGE / LIMIT\tMEM %\tNET I/O\tBLOCK I/O\tPIDS"),
            while True:
                y = 1
                for stat in stats:
                    put_cursor(0, y)
                    y += 1
                    tmp = next(stat)
                    tmp["Id"] = tmp["id"][:12]
                    tmp["Cpu"] = (tmp["cpu_stats"]["cpu_usage"][
                        "total_usage"] / tmp["cpu_stats"]["system_cpu_usage"])
                    tmp["MemUsage"] = humanize.naturalsize(
                        tmp["memory_stats"]["usage"])
                    tmp["Limit"] = humanize.naturalsize(
                        tmp["memory_stats"]["limit"])
                    tmp["Mem"] = (tmp["memory_stats"]["usage"] /
                                  tmp["memory_stats"]["limit"])
                    tmp["NetInput"] = humanize.naturalsize(
                        tmp["networks"]["eth0"]["rx_bytes"])
                    tmp["NetOutput"] = humanize.naturalsize(
                        tmp["networks"]["eth0"]["tx_bytes"])
                    tmp["Pids"] = tmp["pids_stats"]["current"]
                    print pprint_things(pystache.render(self.defaultTemplate, tmp))
        except KeyboardInterrupt:
            put_cursor(0, y)
            colorama.deinit()
            raise KeyboardInterrupt
        put_cursor(0, y)
        colorama.deinit()
        self.settings[self.name] = "\r"