我们从Python开源项目中,提取了以下23个代码示例,用于说明如何使用colorama.deinit()。
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()
def print_yellow(string): if windows_client(): reinit() print (Fore.YELLOW + Style.BRIGHT + string + Style.RESET_ALL) if windows_client(): deinit()
def print_blue(string): if windows_client(): reinit() print (Fore.BLUE + Style.BRIGHT + string + Style.RESET_ALL) if windows_client(): deinit()
def print_cyan(string): if windows_client(): reinit() print (Fore.CYAN + Style.BRIGHT + string + Style.RESET_ALL) if windows_client(): deinit()
def print_green(string): if windows_client(): reinit() print (Fore.GREEN + Style.BRIGHT + string + Style.RESET_ALL) if windows_client(): deinit()
def print_red(string): if windows_client(): reinit() print (Fore.RED + Style.BRIGHT + string + Style.RESET_ALL) if windows_client(): deinit()
def _restore_terminal(): colorama.deinit()
def stop(self): self.m_info("Restoring terminal...") colorama.deinit()
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)
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)
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
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
def _colorama(*args, **kwargs): """Temporarily enable colorama.""" colorama.init(*args, **kwargs) try: yield finally: colorama.deinit()
def nocolor(): if sys.platform == 'win32' and colorama is not None: colorama.deinit() codes.clear()
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()
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()
def tearDown(self): colorama.deinit()
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()
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"
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"