This commit is contained in:
2026-06-10 19:45:12 +08:00
parent 1183d10849
commit a3ebb28ce0
12 changed files with 35469 additions and 491 deletions
+25
View File
@@ -0,0 +1,25 @@
import json, sys, time
path = sys.argv[1]
nb = json.load(open(path, encoding="utf-8"))
g = {"__name__": "__main__"}
n = 0
ok = True
for c in nb["cells"]:
if c["cell_type"] != "code":
continue
n += 1
src = "".join(c["source"])
t0 = time.time()
try:
exec(src, g)
if "plt" in g and getattr(g["plt"], "show", None):
g["plt"].show = lambda *a, **k: None
except Exception as e:
print("CELL", n, "FAILED:", type(e).__name__, e)
ok = False
break
print(f" (cell {n} ok, {time.time()-t0:.1f}s)")
if ok:
print("ALL", n, "CODE CELLS RAN OK")