-
Notifications
You must be signed in to change notification settings - Fork 0
/
BltReport.py
59 lines (49 loc) · 1.64 KB
/
BltReport.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
#!/usr/bin/env python3
# Mission: Keep track of Builtins.
import MkEvalFile
covered = ['False', 'None', 'True', 'bool',
'type', 'int', 'eval', 'quit', 'exit',
'input','print', 'copyright', 'credits',
'license', 'vars', 'isinstance', 'issubclass',
'hasattr','setattr', 'getattr', 'delattr',
'object','enumerate', 'range', 'id', 'repr',
'str', 'locals', 'globals', 'exec',
'compile', 'staticmethod', 'callable',
'classmethod','set', 'dict', 'hash',
'frozenset']
def report(a_list, a_mod):
for ss, item in enumerate(a_list,1):
disp = chr(0x25b7)
if item in covered:
disp = chr(0x25b6)
print(f"{disp:<2}{item:<13}", end='')
if ss % a_mod == 0:
print()
print()
others = list()
common = ['False', 'None', 'True']
uncommon = []
sigma = dir(__builtins__)
import os.path
if not os.path.exists(MkEvalFile.get_fn()):
MkEvalFile.create()
# sigma = sorted(dir(__builtins__), key=lambda a: len(a))
for ss, item in enumerate(sigma,1):
if item.startswith('_'):
uncommon.append(item)
continue
if not item.islower():
others.append(item)
continue
common.append(item)
for the_list in [uncommon,2], [others,1], [common,4]:
report(the_list[0],the_list[1])
sigma = 0
for a_list in uncommon, common, others:
sigma += len(a_list)
version = MkEvalFile.get_version()
print(f"\nVersion {version}, \
Total = {sigma:>03} \n\
Common = {len(common)} \
Covered = {len(covered)} \
({int((len(covered)/len(common))*100)}%)")