File size: 644 Bytes
3bccd69
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import json
from pathlib import Path

root = Path("d:/UsefulNotebooks/plc-llm-bench")
nb_path = root / "PLC_LLM_Bench_Colab.ipynb"
nb = json.loads(nb_path.read_text(encoding="utf-8"))

out = []
for idx, c in enumerate(nb["cells"]):
    content = "".join(c.get("source", []))
    if idx == 27:
        content = content.replace("MODE = 'smoke'", "MODE = 'tier2'")
    out.append({
        "index": idx,
        "type": c["cell_type"],
        "content": content
    })

dump_path = root / "cells_to_push.json"
dump_path.write_text(json.dumps(out, indent=2, ensure_ascii=False), encoding="utf-8")
print(f"Dumped {len(out)} cells to {dump_path}")