How to use the termcolor.cprint function in termcolor

To help you get started, we’ve selected a few termcolor 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 OverLordGoldDragon / keras-adamw / tests / test_optimizers.py View on Github external
t_cur_history += [K_eval(model.optimizer.t_cur, K)]
                eta_history += [K_eval(model.optimizer.eta_t, K)]
                model.train_on_batch(X[batch_num], Y[batch_num])
                # if batch_num == (num_batches - 2):  Manual Option
                #     K.set_value(model.optimizer.t_cur, -1)

        assert _valid_cosine_annealing(eta_history, total_iterations, num_epochs)
        assert model.optimizer.get_config()  # ensure value evaluation won't error
        _test_save_load(model, X, optimizer_name, optimizer)

        # cleanup
        del model, optimizer
        reset_seeds(reset_graph_with_backend=K)

        cprint("\n<< {} MAIN TEST PASSED >>\n".format(optimizer_name), 'green')
    cprint("\n<< ALL MAIN TESTS PASSED >>\n", 'green')
github ElevenPaths / ibombshell / ibombshell c2 / modules / listener.py View on Github external
# results = post_data[8:].decode("utf-8")
        try:
            post_data = post_data.decode()
            fields = parse_qs(post_data)

            if fields:
                results = fields['results'][0]
                try:
                    url = str(unquote(results))
                    for result in url.split("\\n"):
                        cprint (result, 'yellow')
                except Exception:
                    if results is not '':
                        cprint ('\n' + results, 'yellow')
                    else:
                        cprint ('\n[!] Error reading results!', 'red')
        except Exception as e:
            cprint ('\n[!] Error parsing the result!', 'red')
github fr0der1c / EveryClass-collector / src / english_17.py View on Github external
xq) + " (clsname, day, time, teacher, duration, week, location, students, id) "" \
                ""VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)"
            predefined.print_formatted_info("SQL: " + query)
            cursor.execute(query, (this_clsname,
                                   this_day,
                                   this_time,
                                   this_teacher,
                                   this_duration,
                                   this_week,
                                   this_location,
                                   json.dumps(list()),
                                   this_id)
                           )
            conn.commit()
        else:
            cprint("[Class already exists]", "green", attrs=["bold"])
        predefined.print_formatted_info(class_dict[class_number])
        print("--\n")

    # Process student
    students_list = []
    class_list = []
    for each_people in json_content["docs"]:
        cprint("Now processing [%s]%s in class %s" % (each_people["stuID"],
                                                      each_people["stuName"],
                                                      each_people["className"]
                                                      ),
               attrs=['bold'])

        # Query ec_classes table
        query = "SELECT students FROM ec_classes_" + predefined.get_semester_code_for_db(xq) + " WHERE id=%s"
        if settings.DEBUG:
github JASON0916 / wiki_terminal / wiki / wiki_functions.py View on Github external
@print_start_end
@log_history
def wiki_random(option, opt_str, value, parser):
    """
    used to have a title even show its summary randomly.
    """
    length = len(parser.rargs)
    if length > 1:
        parser.error(colored("option -r has more than one argument!", "red", attrs=["bold"]))
    elif length == 1 and (parser.rargs[0] == "s" or parser.rargs[0] == 'summary'):
        title = random().encode("utf-8")
        cprint(title, 'blue', attrs=['bold', 'dark'])
        try:
            text = summary(title)
            w_print(text, "white", title.split(), "green")
        except DisambiguationError as error:
            parser.error(u"\"{0}\" may refer to: \n{1}".format(error.title, '\n'.join(error.options)))
            exit(1)
    else:
        title = random().encode("utf-8")
        try:
            cprint(title, 'blue', attrs=['bold', 'dark'])
        except UnicodeEncodeError:
            parser.error(colored("Unicode encode failed!", "red", attrs=["bold"]))
            exit(1)
        return title
github AliYmn / djeasy / djeasy / client / management.py View on Github external
"""Gunicorn and nginx setting files"""

        # Gunicorn
        for gunicorn_package in self.data['gunicorn']:
            cprint(gunicorn_package['message'],
                   'white', 'on_red', attrs=['bold'])
            subprocess.call(gunicorn_package['name'], shell=True)

        cprint("Gunicorn successful!", 'white', 'on_red', attrs=['bold'])

        # Nginx
        for nginx_package in self.data['nginx']:
            cprint(nginx_package['message'], 'white', 'on_red', attrs=['bold'])
            subprocess.call(nginx_package['name'], shell=True)

        cprint("Nginx successful!", 'white', 'on_red', attrs=['bold'])
github lanl / BEE / bee-launcher / bee_vm.py View on Github external
def get_docker_img(self, vms):
        cprint("["+self.hostname+"]: pull docker image in parallel.", self.__output_color)
        self.parallel_run(self.__docker.get_docker_img(), vms)
github snovvcrash / usbrip / usbrip / lib / core / common.py View on Github external
def print_info(message):
	if cfg.QUIET:
		return

	if cfg.ISATTY:
		cprint(f'[{_get_time()}] [INFO] {message}', 'green')
	else:
		print(f'[{_get_time("%Y-%m-%d %H:%M:%S")}] [INFO] {message}')
github BusesCanFly / PRETty / PRETty.py View on Github external
def main_art():
	cprint(" ▄▄▄▄▄▄▄▄▄▄▄  ▄▄▄▄▄▄▄▄▄▄▄  ▄▄▄▄▄▄▄▄▄▄▄  ▄▄▄▄▄▄▄▄▄▄▄  ▄▄▄▄▄▄▄▄▄▄▄  ▄         ▄  ", main_color)
	cprint("▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░▌       ▐░▌ ", main_color)
	cprint("▐░█▀▀▀▀▀▀▀█░▌▐░█▀▀▀▀▀▀▀█░▌▐░█▀▀▀▀▀▀▀▀▀  ▀▀▀▀█░█▀▀▀▀  ▀▀▀▀█░█▀▀▀▀ ▐░▌       ▐░▌ ", main_color)
	cprint("▐░▌       ▐░▌▐░▌       ▐░▌▐░▌               ▐░▌          ▐░▌     ▐░▌       ▐░▌ ", main_color)
	cprint("▐░█▄▄▄▄▄▄▄█░▌▐░█▄▄▄▄▄▄▄█░▌▐░█▄▄▄▄▄▄▄▄▄      ▐░▌          ▐░▌     ▐░█▄▄▄▄▄▄▄█░▌ ", main_color)
	cprint("▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌     ▐░▌          ▐░▌     ▐░░░░░░░░░░░▌ ", main_color)
	cprint("▐░█▀▀▀▀▀▀▀▀▀ ▐░█▀▀▀▀█░█▀▀ ▐░█▀▀▀▀▀▀▀▀▀      ▐░▌          ▐░▌      ▀▀▀▀█░█▀▀▀▀  ", main_color)
	cprint("▐░▌          ▐░▌     ▐░▌  ▐░▌               ▐░▌          ▐░▌          ▐░▌      ", main_color)
	cprint("▐░▌          ▐░▌      ▐░▌ ▐░█▄▄▄▄▄▄▄▄▄      ▐░▌          ▐░▌          ▐░▌      ", main_color)
	cprint("▐░▌          ▐░▌       ▐░▌▐░░░░░░░░░░░▌     ▐░▌          ▐░▌          ▐░▌      ", main_color)
	cprint(" ▀            ▀         ▀  ▀▀▀▀▀▀▀▀▀▀▀       ▀            ▀            ▀       ", main_color)
	cprint("  BusesCanFly   		  			    76 33 2e 30        ", sub_color)
	cprint("-------------------------------------------------------------------------------", line_color)
	main_text()
	cprint("-------------------------------------------------------------------------------", line_color)
def interactive_steps():
github detexploit / DetExploit / winupdate.py View on Github external
if updates is not None:
        for update in updates:
            level = report.determine_severity('WinUpdate', update)
            resultdict[update] = (' - ', False, False, False, True, level)
            print('===========================================================')
            cprint(langdata['DETECT_UPDATE_ALERT'], 'red')
            cprint(langdata['UPDATE_NAME'] + update + ' >>', 'blue')
            cprint(langdata['OBJECT_LEVEL'] + level + ' >>', 'blue')
            print('===========================================================')
            count = count + 1
    return resultdict, count


if __name__ == '__main__':
    print('======================================================')
    cprint('   ERROR: Direct execution of winupdate.py detected', 'red')
    cprint('   ERROR: Please run the following to run DetExploit.', 'red')
    cprint('   ERROR: -> main.py for CUI version', 'red')
    cprint('   ERROR: -> gui.py for GUI version', 'red')
    print('======================================================')
github yujinrobot / yujin_tools / src / yujin_tools / ansible_common.py View on Github external
def pretty_print_key_value_pairs(title, key_value_strings, width=None):
    termcolor.cprint(title, "green")
    for k, v in colorise_key_value_pairs(key_value_strings, width).iteritems():
        print("  " + k + ": " + v)