forked from thuml/depyf
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpython_coverage.py
More file actions
41 lines (29 loc) · 926 Bytes
/
python_coverage.py
File metadata and controls
41 lines (29 loc) · 926 Bytes
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
import dis
import sys
import inspect
from depyf import decompile, Decompiler
filepath = inspect.getfile(Decompiler)
codecontent = open(filepath, "r").read()
considered_opnames = []
for k in dis.opmap:
if k in codecontent:
considered_opnames.append(k)
all_opnames = set(dis.opmap)
considered_opnames = set(considered_opnames)
supported_opnames = set(Decompiler.supported_opnames())
print("Python version:", sys.version)
unconsidered = all_opnames - considered_opnames
unsupported = considered_opnames - supported_opnames
if len(unconsidered) == 0:
print("All opnames are considered!")
else:
print(f"Total {len(unconsidered)} unconsidered opnames:")
for k in unconsidered:
print(k)
print("=" * 80)
if len(unsupported) == 0:
print("All considered opnames are supported!")
else:
print(f"Total {len(unsupported)} unsupported opnames:")
for k in unsupported:
print(k)