forked from flowerinthenight/flowerinthenight.github.io
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathcheckall.py
106 lines (96 loc) · 3.12 KB
/
checkall.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
import os, sys
import time
g_colorPrint = False
# termcolor 貌似存在 bug,colorama 可以用。
def colorPrint(*args, color="red"):
import colorama
global g_colorPrint
if not g_colorPrint:
g_colorPrint = True
colorama.init(autoreset=True)
config = {
"red": colorama.Fore.RED,
"green": colorama.Fore.GREEN,
"yellow": colorama.Fore.YELLOW,
"blue": colorama.Fore.BLUE,
"magenta": colorama.Fore.MAGENTA,
"cyan": colorama.Fore.CYAN,
"white": colorama.Fore.WHITE,
}
msg = " ".join([str(arg) for arg in args])
print(config[color] + msg + colorama.Style.RESET_ALL)
# https://www.jonathan-petitcolas.com/ascii-art-converter/
def printfail(msg):
assert len(msg) == 8, msg
colorPrint(r"""
!mB$@Mj. ')j'
.w@Y` _%B! U@%| x@&^
.q$w I]. Y$o'
IBB< C$Z
1$o. :w%&b@%~ )$o Z$J
,Y$@&8%B@@@C +%@f. /$[ ?$* q$c
.{u-:?@#' "&@n +B$k. >@o d@r
!@&, 'q@0. 'CBz%*" ;@* b@f
:%@~ ,oB| .{%o;:%W! ,%W .b@)
"W@( 'o@j `|8a? ;%%- `W@; .k$z
`#@u 'q$%W@MX, "&@J .h$n 1@%<
'o@Y . "!"
{%s} J@x
""".replace("{%s}", msg))
def printok(msg):
assert len(msg) == 8, msg
colorPrint(r"""
t%&.
C$@'
c$@^
n$@,
~M@h;'' f$@l .+YW@B$*`
XBB?>h@%x {@@~ .}h@w-^
(@W: `)W@0' ~@@zZ@Q>
:B$( ,@@v <$$W-
?@@! |$%" !#@@%b?
i@$f. '|%@X. [email protected]@@or^'.
{%s} C*MMMoC" ]@@+ .{QOx
""".replace("{%s}", msg), color="white")
def main():
print(sys.argv)
atime = time.time()
litime = []
for line in r"""
python3 reindent.py --newline -r .
python3 reindent.py --newline -r invisible
python3 headfmt.py
python3 mdimage.py format
python3 mdurl.py format
python3 mdimage.py format
python3 mdrstrip.py format copyres {} {} {}
""".format(
"ignoreerr" if "ignoreerr" in sys.argv else "",
"rebuild" if "rebuild" in sys.argv else "",
"netfake" if ("netfake" in sys.argv or "fakenet" in sys.argv) else "",
).split("\n"):
line = line.strip()
if not line: continue
if "quick" in sys.argv and line.find("headfmt.py") != -1:
continue
xtime = time.time()
code = os.system(line)
ytime = time.time()
litime.append([code, line, ytime - xtime])
btime = time.time()
codek = 0
print()
print("***" * 30)
for code, line, itime in litime:
print(code, "%-8.2f"%itime, line)
codek += code
print("***" * 30)
msg = "%-8.2f"%(btime - atime)
if codek == 0:
printok(msg)
else:
printfail(msg)
#exit(0)
if __name__ == "__main__":
main()
print("ok")