-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutil.py
63 lines (55 loc) · 2.48 KB
/
util.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
from colorama import Fore, Back, Style
import art
from tqdm import tqdm
import time
# https://github.com/sepandhaghighi/art/blob/master/FontList.ipynb
# FONT = "tarty2" # isometric3 4max bubble digital drpepper future_8 +tarty2 +thin3 tiny2
def logo(_msg, _font="tarty2", _fore=Fore.YELLOW):
print(f"\n{_fore}{art.text2art(_msg.upper(), font=_font)}{Fore.RESET}\n")
# https://github.com/sepandhaghighi/art/blob/master/FontList.ipynb
def countdown(_secs=3, _msg="", _fore=Fore.LIGHTBLACK_EX, _font="ticks"): # LIGHTBLACK_EX funky_dr block2 ticks univers varsity black_bubble fancy141 tarty3
if False:
for i in range(int(_secs)):
s = str(_secs-i)
if True:
print(f"{_fore}{s}{Fore.RESET} ", end='')
else:
s = art.text2art(str(_secs-i) + _msg, font=_font)
logger.info(f"{_fore}{s}{Fore.RESET}")
time.sleep(1)
print()
else:
# bar_format = '|{bar:40}| '
# bar_format = '{l_bar}{bar:60}{r_bar}{bar:-10b}'
# bar_format = '{l_bar}{bar:60} {n_fmt}/{total_fmt} [{elapsed}<{remaining}]'
bar_format = '{bar:44} {remaining}\t'
#bar_format = "{desc}: {percentage:.1f}%|{bar:80}| {n_fmt}/{total_fmt} [{elapsed}<{remaining}]"
tqdm.write(f"{_fore}", end='\n')
div = 1.0
for i in tqdm(range(int(_secs * div)), bar_format=bar_format): # ncols=80 bar_format='{l_bar}{bar:10}{r_bar}{bar:-10b}'
time.sleep(1.0/div)
tqdm.write(f"{Fore.RESET}", end='\n')
"""
Fore: BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE, RESET.
Back: BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE, RESET.
Style: DIM, NORMAL, BRIGHT, RESET_ALL
print()
print(Fore.BLACK + 'BLACK')
print(Fore.BLUE + 'BLUE')
print(Fore.CYAN + 'CYAN')
print(Fore.GREEN + 'GREEN')
print(Fore.LIGHTBLACK_EX + 'LIGHTBLACK_EX')
print(Fore.LIGHTBLUE_EX + 'LIGHTBLUE_EX')
print(Fore.LIGHTCYAN_EX + 'LIGHTCYAN_EX')
print(Fore.LIGHTGREEN_EX + 'LIGHTGREEN_EX')
print(Fore.LIGHTMAGENTA_EX + 'LIGHTMAGENTA_EX')
print(Fore.LIGHTRED_EX + 'LIGHTRED_EX')
print(Fore.LIGHTWHITE_EX + 'LIGHTWHITE_EX')
print(Fore.LIGHTYELLOW_EX + 'LIGHTYELLOW_EX')
print(Fore.MAGENTA + 'MAGENTA')
print(Fore.RED + 'RED')
print(Fore.RESET + 'RESET')
print(Fore.WHITE + 'WHITE')
print(Fore.YELLOW + 'YELLOW')
logger.info(f"\n{Fore.YELLOW}{art.text2art("BLINK", font=ASCIIFONT)}") # {Fore.RESET}
"""